Modernize build commands for setuptools 80+ compatibility#8728
Modernize build commands for setuptools 80+ compatibility#8728engmohamedsalah wants to merge 1 commit intoProject-MONAI:devfrom
Conversation
📝 WalkthroughWalkthroughReplaces setup.py-based editable install and uninstall commands with pip equivalents across CI, docs, and test scripts: Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
runtests.sh (1)
142-151:⚠️ Potential issue | 🟠 MajorPreserve
BUILD_MONAI=1or--buildwon’t compile extensions.
compile_cppnow runspip install -e .without the env flag, so the C++/CUDA build is skipped by default.🔧 Suggested fix
- CC=clang CXX=clang++ ${cmdPrefix}"${PY_EXE}" -m pip install -e . --user + BUILD_MONAI=1 CC=clang CXX=clang++ ${cmdPrefix}"${PY_EXE}" -m pip install -e . --user else - ${cmdPrefix}"${PY_EXE}" -m pip install -e . --user + BUILD_MONAI=1 ${cmdPrefix}"${PY_EXE}" -m pip install -e . --user fi
961b2ab to
e27faf9
Compare
|
Thanks @coderabbitai for catching the critical BUILD_MONAI=1 issue! I've updated the PR to explicitly set The changes now include:
Regarding the docstring coverage warning: This is expected for infrastructure/build changes. The modified files (runtests.sh, requirements-min.txt, installation.md, pythonapp.yml) don't contain Python functions that require docstrings. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@runtests.sh`:
- Around line 146-152: The editable-install commands use the --user flag which
breaks inside virtualenvs; remove --user from both invocations of the install
command (the non-mac branch and the mac branch that sets BUILD_MONAI and
CC=clang/CXX=clang++), i.e., change ${cmdPrefix}"${PY_EXE}" -m pip install -e .
--user to ${cmdPrefix}"${PY_EXE}" -m pip install -e . so the package installs
into the active virtualenv.
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 0 🏁 Script executed: Length of output: 46 🏁 Script executed: Length of output: 1320
Line 149 (macOS): ✅ Both branches correctly export Your docstring explanation is correct—infrastructure files don't require Python docstrings. The PR is ready from my perspective. |
Replace deprecated setup.py develop commands with modern pip equivalents: - Replace 'setup.py develop --uninstall' with 'pip uninstall -y monai' - Replace 'setup.py develop' with 'pip install -e .' - Remove setuptools upper bound for Python 3.12+ (previously <=79.0.1) - Add BUILD_MONAI=1 explicitly in compile_cpp to ensure C++/CUDA extensions build - Remove --user flag from editable installs for virtualenv compatibility In setuptools 80+, the 'setup.py develop --uninstall' command was removed as part of PEP 660 modernization. The build system now delegates to pip for all installation and uninstallation operations. When using 'pip install -e .', the BUILD_MONAI environment variable must be set explicitly to trigger C++/CUDA compilation, as it's not automatically inherited due to pip's build isolation. The --user flag is removed from editable installs because it breaks inside virtualenvs (the modern development standard). Without --user, pip installs into the active virtualenv when present, or prompts for sudo when needed. Changes made: - runtests.sh: Updated compile_cpp() and clean_py() to use pip commands, set BUILD_MONAI=1 explicitly, and removed --user flag - requirements-min.txt: Removed setuptools <=79.0.1 upper bound for Python 3.12+ - docs/source/installation.md: Updated editable installation examples - .github/workflows/pythonapp.yml: Updated CI workflow to use pip commands Fixes Project-MONAI#8439 Signed-off-by: Mohamed Salah <eng.mohamed.tawab@gmail.com>
e27faf9 to
7fbb868
Compare
|
✅ Fixed: Removed Per @coderabbitai's second review comment, I've removed the Why this is correct:
Final changes:
All CodeRabbitAI suggestions have been addressed! |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 1780
runtests.sh (lines 149, 151):
pythonapp.yml (line 95):
Note: Lines 85 & 123 in pythonapp.yml still have All review suggestions successfully addressed. Great work! 🎉 If you found this review helpful, would you consider giving us a shout-out on X? Thank you for using CodeRabbit! |
Description
This PR modernizes MONAI's build and installation commands to be compatible with setuptools 80+, which removed the deprecated
setup.py develop --uninstallcommand as part of PEP 660 modernization.Changes
compile_cpp()andclean_py()functions to usepipcommands instead of deprecatedsetup.py developpip install -e .Rationale
In setuptools 80+, the
setup.py develop --uninstallcommand was removed because the build system now delegates to pip for all installation/uninstallation operations (PEP 660). The old approach:python setup.py develop→ Now:pip install -e .python setup.py develop --uninstall→ Now:pip uninstall -y monaiTesting
Types of changes
Fixes #8439