Skip to content

Fix: Exclude test package from Python wheels - #338

Merged
ashvardanian merged 2 commits into
ashvardanian:main-devfrom
espressolee:fix-test-package-in-wheels
Oct 2, 2026
Merged

ashvardanian merged 2 commits into
ashvardanian:main-devfrom
espressolee:fix-test-package-in-wheels

Conversation

@espressolee

Copy link
Copy Markdown
Contributor

The inspected 5.x wheels install a top-level test package into site-packages — stringzilla 5.1.2 (macOS arm64, manylinux x86_64), stringzilla 5.0.0, stringzillas-cpus 5.1.2; 4.6.2 did not.

$ uvx check-wheel-contents stringzilla-5.1.2-cp314-cp314-macosx_11_0_arm64.whl
W005: Wheel contains common toplevel name in library: test/

packages=find_packages() used to pick up cli; after cli/ was removed and test/ became a package (both 2026-06-25), the only __init__.py in the tree is test/__init__.py, so the same call now returns ['test'] and the inspected wheels carry all 24 test modules. In a clean venv on a Python that ships no stdlib test package (python-build-standalone), import test resolves to StringZilla's copy; on the Homebrew Python I tried, the stdlib copy wins. stringzillas-cpus, which requires stringzilla at the same version, carries the same 24 paths.

This excludes test from find_packages(). MANIFEST.in gets recursive-include test *.py in place of the two explicit includes (one of which, test/stringzilla.py, no longer matches a file), so the sdist is unaffected: skeleton-built sdists over the real tree shape have identical 337-file lists before and after, while the setup.py change alone would drop 23 test files from it.

espressolee and others added 2 commits October 2, 2026 17:32
find_packages() used to pick up the cli package. Since cli/ was removed and
test/ became a package (both 2026-06-25), the only __init__.py in the tree is
test/__init__.py, so the 5.x wheels ship a top-level `test` package with the
24 test modules. check-wheel-contents flags it (W005, W009), and on a Python
without the stdlib test package `import test` resolves to it.

Exclude test from find_packages(). MANIFEST.in gets `recursive-include test
*.py` in place of the two explicit includes (one of which, test/stringzilla.py,
no longer matches a file), which keeps the sdist file list identical.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
StringZilla ships only extension modules, so `find_packages()` could
only ever pick up folders that are not part of the library, `test/`
today. An explicit empty list keeps any future folder with an
`__init__.py` out of the wheels without an exclusion list to maintain,
and stops setuptools from falling back to its own discovery.
@ashvardanian
ashvardanian force-pushed the fix-test-package-in-wheels branch from 23cce9c to 451c3ba Compare October 2, 2026 16:34
@ashvardanian
ashvardanian changed the base branch from main to main-dev October 2, 2026 16:34
@ashvardanian
ashvardanian merged commit a573a9a into ashvardanian:main-dev Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants