[SPARK-58664][PYTHON] Factor out repeated paths in PySpark Classic's setup.py - #57871
Open
nchammas wants to merge 1 commit into
Open
[SPARK-58664][PYTHON] Factor out repeated paths in PySpark Classic's setup.py#57871nchammas wants to merge 1 commit into
nchammas wants to merge 1 commit into
Conversation
uros-b
approved these changes
Aug 9, 2026
dongjoon-hyun
approved these changes
Aug 9, 2026
dongjoon-hyun
left a comment
Member
There was a problem hiding this comment.
LGTM. Nice cleanup — I verified that the install/cleanup ordering is preserved and that the removed variables have no remaining usages (JARS_TARGET/SCRIPTS_TARGET, which are still used elsewhere, are correctly kept). The cleanup change is a real robustness improvement: since it runs in the finally: block, the old code could mask the original exception with a FileNotFoundError when staging failed partway, while the new per-target islink check lets the root cause propagate.
A couple of minor, non-blocking notes:
- In the sdist-install scenario (
in_spark=Falsewithdeps/present),JARS_PATHremains an empty list[], which gets passed intoInstallPath(source: str, ...). Harmless at runtime sinceINSTALL_PATHSis only iterated whenin_sparkis true, but it contradicts the declared type. - Silently skipping missing targets also drops the signal that staging was partial; a one-line note to stderr when skipping could be worth considering.
HyukjinKwon
approved these changes
Aug 10, 2026
zhengruifeng
approved these changes
Aug 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Factor out repeated paths into a single list of install paths that is used throughout the PySpark Classic install script.
Make the packaging cleanup a bit more tolerant to partial staging of dependencies by having it keep going if files are missing. I also changed the check to look at the actual filesystem object -- is it a symlink or not? -- rather than repeat the general check on OS capabilities.
I preserved the order in which the paths are installed and then cleaned up.
Why are the changes needed?
General code hygiene. We shouldn't have to manually touch multiple blocks of code that are supposed to always be in sync.
If a file is missing during cleanup, I think it's a marginal improvement to have the cleanup just move on to the next one. Checking the file's type directly during cleanup is also more robust than checking a general capability.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Was this patch authored or co-authored using generative AI tooling?
I wrote this with assistance from GitHub Copilot.