Excluded from MANIFEST.in and setup.py tests folder and subfolders.#8807
Excluded from MANIFEST.in and setup.py tests folder and subfolders.#8807ffvogmv wants to merge 1 commit intoProject-MONAI:devfrom
Conversation
📝 WalkthroughWalkthroughThe pull request modifies packaging configuration to exclude test files and packages from source distributions. Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@MANIFEST.in`:
- Line 3: Replace the problematic MANIFEST.in pattern "exclude tests/*" with the
correct directive "prune tests" so the entire tests directory (including nested
files and subdirectories) is excluded from source distributions; update the
MANIFEST.in entry that currently contains exclude tests/* to use prune tests
instead.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 905678a6-a4bf-4a65-a9f7-f84cffc752e8
📒 Files selected for processing (2)
MANIFEST.insetup.py
| include versioneer.py | ||
| include monai/_version.py | ||
|
|
||
| exclude tests/* |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
In setuptools MANIFEST.in, does exclude tests/*match files in nested subdirectories, and isprune tests the correct way to exclude the full tests tree from sdist?
💡 Result:
exclude tests/*will not match files in nested subdirectories liketests/unit/test_x.py; inMANIFEST.inglob patterns,*does not match path separators (so it only matches the immediate children oftests/). [1]- To exclude the entire top-level
tests/tree from the sdist,prune testsis the appropriate directive (it removes all files under directories matchingtests, relative to the project root). [1] - Alternative equivalent:
recursive-exclude tests *(remove everything undertests/). [1]
Source: Setuptools MANIFEST.in command and glob semantics documentation. [1]
Use prune tests instead of exclude tests/* to exclude the entire tests directory from sdist.
The * pattern in MANIFEST.in does not match path separators, so exclude tests/* only excludes immediate children and will miss nested files like tests/unit/test_x.py.
Proposed fix
-exclude tests/*
+prune tests🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@MANIFEST.in` at line 3, Replace the problematic MANIFEST.in pattern "exclude
tests/*" with the correct directive "prune tests" so the entire tests directory
(including nested files and subdirectories) is excluded from source
distributions; update the MANIFEST.in entry that currently contains exclude
tests/* to use prune tests instead.
Fixes Tests are installed as a package
Description
This pull request resolves an issue introduced in commit
af9e8f96d704a1b4bbce5b5ca52e0e2b7ea076dc, where thetestsdirectory was inadvertently included as an installable package starting from MONAI 1.5.0, due to the refactor on tests that created multiple subfolders with__init__.pyfiles on them.This caused import conflicts in downstream projects with their own local
testsfolder, as Python could mistakenly resolve imports to MONAI’s packagedtestsmodule.To correct this behavior, the following adjustments are made:
MANIFEST.inupdated to exclude thetestsdirectory:exclude tests/*setup.pyupdated to prevent inclusion oftestsand its subpackages:These changes ensure that the MONAI test suite is not installed as part of the distributed package, restoring expected import resolution for downstream users.
Types of changes
./runtests.sh -f -u --net --coverage../runtests.sh --quick --unittests --disttests.make htmlcommand in thedocs/folder.