Skip to content

Commit 2be2bed

Browse files
Modernize build commands for setuptools 80+ compatibility (#8728)
## Description This PR modernizes MONAI's build and installation commands to be compatible with setuptools 80+, which removed the deprecated `setup.py develop --uninstall` command as part of PEP 660 modernization. ## Changes - **runtests.sh**: Updated `compile_cpp()` and `clean_py()` functions to use `pip` commands instead of deprecated `setup.py develop` - **requirements-min.txt**: Removed setuptools upper bound (<=79.0.1) for Python 3.12+ - **docs/source/installation.md**: Updated editable installation examples to use modern `pip install -e .` - **.github/workflows/pythonapp.yml**: Updated CI workflow to use pip commands ## Rationale In setuptools 80+, the `setup.py develop --uninstall` command 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 monai` ## Testing - Verified bash syntax in runtests.sh has no errors - Confirmed no remaining references to deprecated commands - All changes maintain functional equivalence with modern pip approach ## Types of changes - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [x] Documentation update Fixes #8439 --------- Signed-off-by: Mohamed Salah <eng.mohamed.tawab@gmail.com> Co-authored-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com>
1 parent 867a499 commit 2be2bed

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

.github/workflows/pythonapp.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@ jobs:
8787
cat "requirements-dev.txt"
8888
python -m pip install --no-build-isolation -r requirements-dev.txt
8989
python -m pip list
90-
python setup.py develop # test no compile installation
90+
python -m pip install -e . # test no compile installation
9191
shell: bash
9292
- name: Run compiled (${{ runner.os }})
9393
run: |
94-
python setup.py develop --uninstall
95-
BUILD_MONAI=1 python setup.py develop # compile the cpp extensions
94+
python -m pip uninstall -y monai
95+
BUILD_MONAI=1 python -m pip install -e . # compile the cpp extensions
9696
shell: bash
9797
- name: Run quick tests (CPU ${{ runner.os }})
9898
run: |

docs/source/installation.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,23 +135,23 @@ You can install it by running:
135135

136136
```bash
137137
cd MONAI/
138-
python setup.py develop
138+
pip install -e .
139139
```
140140

141141
or, to build with MONAI C++/CUDA extensions and install:
142142

143143
```bash
144144
cd MONAI/
145-
BUILD_MONAI=1 python setup.py develop
145+
BUILD_MONAI=1 pip install -e .
146146
# for MacOS
147-
BUILD_MONAI=1 CC=clang CXX=clang++ python setup.py develop
147+
BUILD_MONAI=1 CC=clang CXX=clang++ pip install -e .
148148
```
149149

150150
To uninstall the package please run:
151151

152152
```bash
153153
cd MONAI/
154-
python setup.py develop --uninstall
154+
pip uninstall -y monai
155155

156156
# to further clean up the MONAI/ folder (Bash script)
157157
./runtests.sh --clean

runtests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ function compile_cpp {
145145
${cmdPrefix}"${PY_EXE}" -m pip uninstall -y monai
146146
if [[ "$OSTYPE" == "darwin"* ]];
147147
then # clang for mac os
148-
CC=clang CXX=clang++ ${cmdPrefix}"${PY_EXE}" setup.py develop --user
148+
BUILD_MONAI=1 CC=clang CXX=clang++ ${cmdPrefix}"${PY_EXE}" -m pip install -e .
149149
else
150-
${cmdPrefix}"${PY_EXE}" setup.py develop --user
150+
BUILD_MONAI=1 ${cmdPrefix}"${PY_EXE}" -m pip install -e .
151151
fi
152152
}
153153

0 commit comments

Comments
 (0)