Skip to content

Excluded from MANIFEST.in and setup.py tests folder and subfolders.#8807

Open
ffvogmv wants to merge 2 commits intoProject-MONAI:devfrom
ffvogmv:dev
Open

Excluded from MANIFEST.in and setup.py tests folder and subfolders.#8807
ffvogmv wants to merge 2 commits intoProject-MONAI:devfrom
ffvogmv:dev

Conversation

@ffvogmv
Copy link
Copy Markdown

@ffvogmv ffvogmv commented Apr 6, 2026

Fixes Tests are installed as a package

Description

This pull request resolves an issue introduced in commit af9e8f96d704a1b4bbce5b5ca52e0e2b7ea076dc, where the tests directory 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__.py files on them.

This caused import conflicts in downstream projects with their own local tests folder, as Python could mistakenly resolve imports to MONAI’s packaged tests module.

To correct this behavior, the following adjustments are made:

  • MANIFEST.in updated to exclude the tests directory:
    exclude tests/*
  • setup.py updated to prevent inclusion of tests and its subpackages:
    packages = find_packages(exclude=("docs", "examples", "tests", "tests.*"))

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

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • Breaking change (fix or new feature that would cause existing functionality to change).
  • New tests added to cover the changes.
  • Integration tests passed locally by running ./runtests.sh -f -u --net --coverage.
  • Quick tests passed locally by running ./runtests.sh --quick --unittests --disttests.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 6, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0c0bd1f2-4bb5-49b1-b1aa-a3463fe21daa

📥 Commits

Reviewing files that changed from the base of the PR and between d08daa2 and fb44494.

📒 Files selected for processing (1)
  • MANIFEST.in
✅ Files skipped from review due to trivial changes (1)
  • MANIFEST.in

📝 Walkthrough

Walkthrough

The PR updates packaging to exclude test code from distributions: MANIFEST.in adds a prune tests directive to remove the tests directory from source distributions, and setup.py extends find_packages(exclude=...) to include tests.*, preventing discovery of any test subpackages.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed Title accurately summarizes the main change: excluding tests folder and subfolders from both MANIFEST.in and setup.py.
Description check ✅ Passed Description follows template structure with issue reference, detailed explanation, code changes, and all checkbox items properly marked.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8d39519 and d08daa2.

📒 Files selected for processing (2)
  • MANIFEST.in
  • setup.py

…s directory from sdist.

Signed-off-by: Javier Vera Olmos <ffvo@gmv.com>
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.

1 participant