Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-50824][PYTHON] Avoid importing optional Python packages for ch…
…ecking ### What changes were proposed in this pull request? This PR proposes to avoid importing optional Python packages for checking, by using `importlib.util.find_spec` instead of actually loading/importing the package. ### Why are the changes needed? a409199 changed to import optional dependencies in main code. After that, technically f223b8d broke the Python Spark Core tests, (because now we will import `pyspark.testing`, and it will import optional dependencies) but it did not run the tests. By importing `deepspeed`, via logger, it can show stdout (https://github.com/microsoft/DeepSpeed/blob/master/accelerator/real_accelerator.py#L182). This broke the test in `pyspark.conf`. After that, the real test failure was found when core change was triggered at 6f3b778. In the PR, build passed because it was before f223b8d was merged. ### Does this PR introduce _any_ user-facing change? Technically yes. There might be some side effects by importing optional dependencies, and this PR avoid them. ### How was this patch tested? CI in this PR should verify it. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #49500 from HyukjinKwon/SPARK-50824. Authored-by: Hyukjin Kwon <gurwls223@apache.org> Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
- Loading branch information