Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Exclude tests from package #297

Merged
merged 1 commit into from
May 22, 2023

Conversation

huonw
Copy link
Contributor

@huonw huonw commented May 22, 2023

The wheels include the tests, due to the find_packages exclusion being subtle: it is a full package path glob, not just a prefix/parent package exclusion. This makes the appropriate adjustment to the find_packages(exclude=...) call to ensure they're not included.

See the "Important" note in https://setuptools.pypa.io/en/latest/userguide/package_discovery.html#finding-simple-packages

curl -O https://files.pythonhosted.org/packages/a8/02/b6c6de2524add783af7be9b057baf8dc1cda62b4aa5cd8b7ea2ede500658/casbin-1.18.2-py3-none-any.whl
unzip -l casbin-1.18.2-py3-none-any.whl
#> ...
#>       637  04-06-2023 17:12   tests/benchmarks/__init__.py
#>      2882  04-06-2023 17:12   tests/benchmarks/benchmark_management_api.py
#> ...
#> ---------                     -------
#>    270392                     60 files

After this patch, the unzip -l on a built wheel includes none of the tests. The uncompressed package is only only 206607 bytes (64KB smaller, -24%) and 46 files.

@casbin-bot
Copy link
Member

@Nekotoxin please review

@casbin-bot casbin-bot requested a review from Nekotoxin May 22, 2023 05:32
@hsluoyz hsluoyz merged commit 9b014a2 into casbin:master May 22, 2023
github-actions bot pushed a commit that referenced this pull request May 22, 2023
## [1.18.3](v1.18.2...v1.18.3) (2023-05-22)

### Bug Fixes

* Exclude tests from package ([#297](#297)) ([9b014a2](9b014a2))
* Stop including README as top-level data file in package ([#296](#296)) ([e85e9b9](e85e9b9))
@github-actions
Copy link

🎉 This PR is included in version 1.18.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@huonw huonw deleted the bugfix/no-tests-in-wheels branch May 22, 2023 08:07
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