Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import os
from glob import glob

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

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.

from setuptools import find_packages
from setuptools import setup

Expand All @@ -17,15 +18,18 @@

# read install requirements from requirements.txt
with open(os.path.join(source_dir, "requirements.txt")) as o:
requirements = [str(r) for r in parse_requirements(o.read())]
#requirements = {str(r).rstrip() for r in o}
requirements = o.read().splitlines()

print(requirements)

setup(
name="MetricsReloaded",
version=version_info["__version__"],
description=version_info["__description__"],
author=version_info["__author__"],
author_email=version_info["__author_email__"],
url="https://github.com/csudre/MetricsReloaded",
url="https://github.com/Project-MONAI/MetricsReloaded",
packages=find_packages(),
py_modules=[
os.path.splitext(os.path.basename(path))[0]
Expand All @@ -46,16 +50,20 @@
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Scientific/Engineering",
],
project_urls={
"Documentation": "https://MetricsReloaded.readthedocs.io/",
"Issue Tracker": "https://github.com/csudre/MetricsReloaded/issues",
"Issue Tracker": "https://github.com/Project-MONAI/MetricsReloaded/issues",
},
python_requires=">=3.7",
install_requires=requirements,
extras_require={},
setup_requires=[
"pytest-runner",
],
entry_points={},
)
)