Skip to content

[SPARK-48107][PYTHON] Exclude tests from Python distribution#46354

Closed
nchammas wants to merge 1 commit into
apache:masterfrom
nchammas:SPARK-48107-package-json
Closed

[SPARK-48107][PYTHON] Exclude tests from Python distribution#46354
nchammas wants to merge 1 commit into
apache:masterfrom
nchammas:SPARK-48107-package-json

Conversation

@nchammas

@nchammas nchammas commented May 3, 2024

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Change the Python manifest so that tests are excluded from the packages that are built for distribution.

Why are the changes needed?

Tests were unintentionally included in the distributions as part of #44920. See this comment.

Does this PR introduce any user-facing change?

No, since #44920 hasn't been released to any users yet.

How was this patch tested?

I built Python packages and inspected SOURCES.txt to confirm that tests were excluded:

cd python
rm -rf pyspark.egg-info || echo "No existing egg info file, skipping deletion"
python3 packaging/classic/setup.py sdist
python3 packaging/connect/setup.py sdist
find dist -name '*.tar.gz' | xargs -I _ tar xf _ --directory=dist
cd ..
open python/dist
find python/dist -name SOURCES.txt | xargs code

Was this patch authored or co-authored using generative AI tooling?

No.

@github-actions github-actions Bot added the PYTHON label May 3, 2024
Comment thread python/MANIFEST.in
# Reference: https://setuptools.pypa.io/en/latest/userguide/miscellaneous.html

graft pyspark
recursive-include pyspark *.pyi py.typed *.json

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HyukjinKwon - Instead of this, I prefer to exclude tests as follows:

$ diff python/MANIFEST-json.in python/MANIFEST-notests.in 
19c19
< recursive-include pyspark *.pyi py.typed *.json
---
> graft pyspark
31a32
> global-exclude **/tests/**

That way, if we add new files in the future that don't happen to match the glob expressions on this line they will still be picked up.

But I believe you prefer the approach taken here, so I've started with that.

@dongjoon-hyun dongjoon-hyun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, LGTM.

@HyukjinKwon

Copy link
Copy Markdown
Member

Merged to master.

@HyukjinKwon

Copy link
Copy Markdown
Member

:-)

@dongjoon-hyun

Copy link
Copy Markdown
Member

:)

@nchammas nchammas deleted the SPARK-48107-package-json branch May 3, 2024 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants