Skip to content

fix: Exclude tests from package#297

Merged
hsluoyz merged 1 commit into
apache:masterfrom
huonw:bugfix/no-tests-in-wheels
May 22, 2023
Merged

fix: Exclude tests from package#297
hsluoyz merged 1 commit into
apache:masterfrom
huonw:bugfix/no-tests-in-wheels

Conversation

@huonw
Copy link
Copy Markdown
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
Copy Markdown

@Nekotoxin please review

@casbin-bot casbin-bot requested a review from Nekotoxin May 22, 2023 05:32
@hsluoyz hsluoyz merged commit 9b014a2 into apache: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
Copy Markdown

🎉 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
Chimou0 pushed a commit to Chimou0/pycasbin that referenced this pull request Jul 17, 2025
Chimou0 pushed a commit to Chimou0/pycasbin that referenced this pull request Jul 17, 2025
## [1.18.3](apache/casbin-pycasbin@v1.18.2...v1.18.3) (2023-05-22)

### Bug Fixes

* Exclude tests from package ([apache#297](apache#297)) ([9b014a2](apache@9b014a2))
* Stop including README as top-level data file in package ([apache#296](apache#296)) ([e85e9b9](apache@e85e9b9))
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