Updating setup.py to address pkg_resources - #61
Conversation
Signed-off-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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
🧹 Nitpick comments (1)
setup.py (1)
24-24: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRemove 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
| #from pkg_resources import parse_requirements | ||
| from packaging.requirements import Requirement |
There was a problem hiding this comment.
🩺 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
doneRepository: 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
doneRepository: 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")
PYRepository: 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.
|
Thanks @csudre ! |
Fixes #59.
This PR copies the state of
setup.pyfrom thedocs-testbranch to address the issue withpkg_resoucesbeing missing. This passed tests in that branch so would be expected the valid fix.Summary by CodeRabbit