Skip to content

Updating setup.py to address pkg_resources - #61

Merged
csudre merged 1 commit into
Project-MONAI:monai-supportfrom
ericspod:monai-support-fix
Jul 29, 2026
Merged

Updating setup.py to address pkg_resources#61
csudre merged 1 commit into
Project-MONAI:monai-supportfrom
ericspod:monai-support-fix

Conversation

@ericspod

@ericspod ericspod commented Jul 18, 2026

Copy link
Copy Markdown
Member

Fixes #59.

This PR copies the state of setup.py from the docs-test branch to address the issue with pkg_resouces being missing. This passed tests in that branch so would be expected the valid fix.

Summary by CodeRabbit

  • Chores
    • Updated project and issue-tracker links to the current repository.
    • Added Python 3.11, 3.12, and 3.13 to the supported-version metadata.
    • Improved handling of installation requirements during package setup.

Signed-off-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 22529d9f-f5a5-47aa-9ba3-7e671546ba91

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
setup.py (1)

24-24: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove the debug print from package setup.

Printing the requirements on every build or metadata query adds noisy, unintended output. Use logging only when explicitly debugging.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@setup.py` at line 24, Remove the print statement that outputs requirements
from the package setup flow, leaving requirement handling unchanged and avoiding
any output during builds or metadata queries.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@setup.py`:
- Around line 7-8: Remove the unused Requirement import and the commented
pkg_resources parser line from setup.py, leaving setup execution independent of
the undeclared packaging dependency.

---

Nitpick comments:
In `@setup.py`:
- Line 24: Remove the print statement that outputs requirements from the package
setup flow, leaving requirement handling unchanged and avoiding any output
during builds or metadata queries.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2a63498a-2f63-4cc6-877b-27a4ed32da69

📥 Commits

Reviewing files that changed from the base of the PR and between 090a9a7 and 157216e.

📒 Files selected for processing (1)
  • setup.py

Comment thread setup.py
Comment on lines +7 to +8
#from pkg_resources import parse_requirements
from packaging.requirements import Requirement

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n## setup.py\n'
wc -l setup.py
cat -n setup.py

printf '\n## dependency/build files\n'
git ls-files | rg '^(pyproject\.toml|setup\.cfg|requirements(\.txt|/|$)|constraints\.txt|Pipfile|poetry\.lock|tox\.ini|noxfile\.py)$'
for f in pyproject.toml setup.cfg requirements.txt; do
  if [ -f "$f" ]; then
    printf '\n### %s\n' "$f"
    cat -n "$f"
  fi
done

Repository: Project-MONAI/MetricsReloaded

Length of output: 3418


🏁 Script executed:

#!/bin/bash
set -euo pipefail

for f in setup.py pyproject.toml setup.cfg requirements.txt; do
  [ -f "$f" ] && echo "### $f" && cat -n "$f" && echo
done

Repository: Project-MONAI/MetricsReloaded

Length of output: 3348


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from importlib import metadata

for dist_name in ["setuptools", "wheel", "packaging", "setuptools_scm"]:
    try:
        dist = metadata.distribution(dist_name)
        print(f"## {dist_name}")
        print("version:", dist.version)
        reqs = dist.requires or []
        if reqs:
            for r in reqs:
                print("requires:", r)
        else:
            print("requires: <none>")
        print()
    except metadata.PackageNotFoundError:
        print(f"## {dist_name}\nnot installed\n")
PY

Repository: Project-MONAI/MetricsReloaded

Length of output: 360


Remove the unused Requirement import and commented parser line. setup.py runs during isolated builds, and packaging isn’t declared in [build-system], so this import can break source installs before setup() executes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@setup.py` around lines 7 - 8, Remove the unused Requirement import and the
commented pkg_resources parser line from setup.py, leaving setup execution
independent of the undeclared packaging dependency.

@csudre
csudre merged commit 5fea77d into Project-MONAI:monai-support Jul 29, 2026
1 check passed
@ericspod
ericspod deleted the monai-support-fix branch July 29, 2026 13:04
@ericspod

Copy link
Copy Markdown
Member Author

Thanks @csudre !

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