Skip to content

Include full tests/ tree in sdist via MANIFEST.in - #367

Open
sak7122 wants to merge 1 commit into
jmespath:developfrom
sak7122:fix-sdist-missing-tests-init
Open

Include full tests/ tree in sdist via MANIFEST.in#367
sak7122 wants to merge 1 commit into
jmespath:developfrom
sak7122:fix-sdist-missing-tests-init

Conversation

@sak7122

@sak7122 sak7122 commented Aug 18, 2026

Copy link
Copy Markdown

Summary

Fixes #341.

setuptools' default sdist file-finder only auto-includes files matching the tests/test*.py glob. It silently drops tests/__init__.py, tests/compliance/*.json, and tests/legacy/*.json, none of which match that pattern. That's why the sdist published for 1.1.0 is missing tests/__init__.py: test_compliance.py does from tests import OrderedDict, which fails once the sdist is extracted and tests are run against it, exactly as reported in #341.

MANIFEST.in never listed the tests/ directory at all — the previously-"working" inclusion of tests/test_*.py was always just setuptools' default optional glob, which happens to miss everything else under tests/.

The fix adds one line to MANIFEST.in to explicitly include the entire tests/ tree (source files + JSON fixtures + subdirectories), rather than relying on the incomplete default heuristic.

Test plan

Built and ran the actual sdist end-to-end locally:

  • git diff before/after this change: before, python setup.py egg_info's generated SOURCES.txt lists tests/test_*.py but omits tests/__init__.py, tests/compliance/*.json, and tests/legacy/*.json.
  • After the MANIFEST.in change: python -m build --sdist produces a tarball whose tests/ directory now contains all of __init__.py, compliance/*.json (16 files), and legacy/literal.json, matching the full contents of the repo's tests/ directory.
  • Extracted the built sdist into a clean directory, pip installed it into a fresh venv, and ran pytest from tests/ against the installed package: 991 passed, 1 skipped, with no import errors (previously this would fail at collection with ImportError: cannot import name 'OrderedDict' from 'tests', per the traceback in sdist is missing tests/__init__.py #341).

Platform tested: Windows 11 (Python 3.14).

Setuptools' default sdist file-finder only auto-includes files
matching tests/test*.py, so tests/__init__.py, tests/compliance/*.json,
and tests/legacy/*.json were silently dropped from the sdist built for
the 1.1.0 release. That breaks pytest when run against the sdist,
since tests/test_compliance.py does `from tests import OrderedDict`.

Fixes jmespath#341
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.

sdist is missing tests/__init__.py

1 participant