fix: include tests/__init__.py in sdist (resolves #341) - #369
Open
CAOShurong wants to merge 2 commits into
Open
Conversation
MANIFEST.in only listed README.rst and LICENSE. Because setup.py excludes 'tests' from packages, setuptools dropped the package marker tests/__init__.py from the source distribution while still shipping the loose tests/test_*.py modules. A downstream build that does 'from tests import OrderedDict' (test_compliance.py) then fails with ImportError: cannot import name 'OrderedDict' from 'tests'. Adding 'recursive-include tests *.py' makes the sdist carry the __init__.py package marker alongside the test modules.
CAOShurong
pushed a commit
to CAOShurong/CAOShurong
that referenced
this pull request
Aug 29, 2026
…s/__init__.py #341)
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.
Summary
Resolves #341.
MANIFEST.inonly listedREADME.rstandLICENSE. Becausesetup.pyusesfind_packages(exclude=['tests']), setuptools does not treattestsas apackage and therefore drops the package marker
tests/__init__.pyfrom thesource distribution — while still shipping the loose
tests/test_*.pymodules.A downstream build that imports from the package (e.g.
tests/test_compliance.pydoing
from tests import OrderedDict) then fails with:Adding
recursive-include tests *.pymakes the sdist carry the__init__.pypackage marker alongside the test modules.
Verification (no-run-no-claim)
Built the sdist locally with the repo's
setup.py sdist(setuptools 83.0.0,Python 3.13) before and after the change:
tests/test_*.py(7 files) but notests/__init__.py.tests/__init__.pyand all 7tests/test_*.pymodules.Scope
Packaging/
MANIFEST.inonly. No runtime or library code changed; the installedwheel is unaffected (tests were already excluded from the wheel).
AI-assisted contribution: the root-cause analysis and patch were drafted with an AI coding assistant and the author reviewed and verified the sdist build before opening this PR.