Skip to content

Commit dfac9cd

Browse files
authored
Merge branch 'dev' into test/make-nifti-image-temp-cleanup
2 parents 53ce353 + 43c0aae commit dfac9cd

103 files changed

Lines changed: 2505 additions & 963 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build_docs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ jobs:
2323
env:
2424
# minimum supported version of Python
2525
PYTHON_VER1: '3.10'
26+
# force installation of CPU-only PyTorch
27+
PIP_EXTRA_INDEX_URL: 'https://download.pytorch.org/whl/cpu'
2628
steps:
2729
- uses: actions/checkout@v7
2830
- name: Set up Python ${{ env.PYTHON_VER1 }}

.github/workflows/cicd_tests.yml

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
runs-on: ubuntu-latest
5757
strategy:
5858
matrix:
59-
opt: ["codeformat", "mypy"] # "pytype" omitted for being essentially deprecated, see #8865
59+
opt: ["codeformat", "pyrefly"]
6060
steps:
6161
- name: Clean unused tools
6262
run: |
@@ -75,13 +75,12 @@ jobs:
7575
- name: Install dependencies
7676
run: |
7777
python -m pip install --upgrade pip wheel
78-
python -m pip install --no-build-isolation -r requirements-dev.txt
78+
python -m pip install .[all,testing]
7979
- name: Lint and type check
8080
run: |
8181
# clean up temporary files
8282
$(pwd)/runtests.sh --build --clean
83-
# Github actions have multiple cores, so parallelize pytype
84-
$(pwd)/runtests.sh --build --${{ matrix.opt }} -j $(nproc --all)
83+
$(pwd)/runtests.sh --build --${{ matrix.opt }}
8584
8685
min-dep: # Test with minumum dependencies installed for different OS, Python, and PyTorch combinations
8786
runs-on: ${{ matrix.os }}
@@ -138,15 +137,14 @@ jobs:
138137
- name: Prepare pip wheel
139138
run: |
140139
which python
141-
python -m pip install --upgrade pip wheel
142-
python -m pip install --user more-itertools>=8.0
140+
python -m pip install --upgrade pip wheel tomli
143141
- name: Install the minimum dependencies
144142
run: |
145143
# min. requirements
146144
python -m pip install torch==${{ matrix.pytorch-version }}
147-
python -m pip install -r requirements-min.txt
145+
python monai/config/print_dependencies.py build-system | xargs pip install --no-build-isolation
146+
python -m pip install --no-build-isolation .[testing]
148147
python -m pip list
149-
BUILD_MONAI=0 python setup.py develop # no compile of extensions
150148
shell: bash
151149
- if: matrix.os == 'linux-gpu-runner'
152150
name: Print GPU Info
@@ -219,16 +217,17 @@ jobs:
219217
shell: bash
220218
- name: Install the complete dependencies
221219
run: |
222-
python -m pip install --user --upgrade pip wheel pybind11 # TODO: pybind11 added for macOS, may not be needed
223-
cat "requirements-dev.txt"
224-
python -m pip install --no-build-isolation -r requirements-dev.txt
220+
python -m pip install --user --upgrade pip wheel tomli
221+
python monai/config/print_dependencies.py build-system | xargs pip install --no-build-isolation
222+
python -m pip install --no-build-isolation .[all,testing]
225223
python -m pip list
226-
python -m pip install --no-build-isolation -e . # test no compile installation
227224
shell: bash
228225
- name: Run compiled (${{ runner.os }})
229226
run: |
230227
python -m pip uninstall -y monai
231-
BUILD_MONAI=1 python -m pip install --no-build-isolation -e . # compile the cpp extensions
228+
BUILD_MONAI=1 python -m pip install --no-build-isolation -e . # compile the cpp extensions in-place with -e
229+
# ensure extensions were compiled
230+
python -c 'import monai._C' > /dev/null
232231
shell: bash
233232
- if: runner.os != 'macOS'
234233
name: Run full tests
@@ -275,14 +274,15 @@ jobs:
275274
cache: 'pip'
276275
- name: Install dependencies + nvsubquadratic (no-deps)
277276
run: |
278-
python -m pip install --upgrade pip wheel
279-
python -m pip install torch==${PYTORCH_VER1} torchvision==${TORCHVISION_VER1}
280-
python -m pip install --no-build-isolation -r requirements-dev.txt
281-
python -m pip install -e .
282-
# nvsubquadratic runtime imports need only torch + einops + omegaconf; install
283-
# the package itself without its core dependency tree (see job comment above).
284-
python -m pip install omegaconf
285-
python -m pip install --no-deps 'nvsubquadratic>=0.1.1'
277+
python -m pip install --upgrade pip wheel tomli pytest
278+
# need a specific version of torch for nvsubquadratic
279+
python monai/config/print_dependencies.py build-system | \
280+
xargs -d '\n' pip install --no-build-isolation torch==2.10.0 torchvision==0.25.0
281+
# # nvsubquadratic runtime imports need only torch + einops + omegaconf; install
282+
# # the package itself without its core dependency tree (see job comment above).
283+
python -m pip install --no-build-isolation omegaconf
284+
python -m pip install --no-build-isolation --no-deps 'nvsubquadratic>=0.1.1'
285+
python -m pip install --no-build-isolation .[hyena,testing]
286286
python -m pip list
287287
shell: bash
288288
- name: Run Hyena tests (CUDA-required cases skip cleanly)
@@ -299,6 +299,7 @@ jobs:
299299
runs-on: ubuntu-latest
300300
env:
301301
QUICKTEST: True
302+
INDEX_URL: "https://download.pytorch.org/whl/cpu"
302303
steps:
303304
- name: Clean unused tools
304305
run: |
@@ -317,11 +318,10 @@ jobs:
317318
cache: 'pip'
318319
- name: Install dependencies
319320
run: |
320-
python -m pip install --user --upgrade pip setuptools wheel twine packaging
321+
python -m pip install --user --upgrade pip setuptools wheel twine packaging tomli
321322
# install the latest pytorch for testing
322-
# however, "pip install monai*.tar.gz" will build cpp/cuda with an isolated
323-
# fresh torch installation according to pyproject.toml
324-
python -m pip install torch==${PYTORCH_VER1} torchvision --extra-index-url https://download.pytorch.org/whl/cpu
323+
python monai/config/print_dependencies.py build-system all testing | \
324+
xargs -d '\n' pip install --no-build-isolation torch==${PYTORCH_VER1} --extra-index-url $INDEX_URL
325325
- name: Check packages
326326
run: |
327327
python -m pip uninstall -y monai
@@ -350,7 +350,7 @@ jobs:
350350
working-directory: ${{ steps.mktemp.outputs.tmp_dir }}
351351
run: |
352352
# install from wheel
353-
python -m pip install monai*.whl --extra-index-url https://download.pytorch.org/whl/cpu
353+
python -m pip install --no-build-isolation monai*.whl --extra-index-url $INDEX_URL
354354
python -c 'import monai; monai.config.print_config()' 2>&1 | grep -iv "unknown"
355355
python -c 'import monai; print(monai.__file__)'
356356
python -m pip uninstall -y monai
@@ -360,6 +360,14 @@ jobs:
360360
run: |
361361
for name in *.tar.gz; do break; done
362362
echo $name
363-
python -m pip install ${name}[all] --extra-index-url https://download.pytorch.org/whl/cpu
363+
python -m pip install --no-build-isolation ${name}[all] --extra-index-url $INDEX_URL
364+
python -c 'import monai; monai.config.print_config()' 2>&1 | grep -iv "unknown"
365+
python -c 'import monai; print(monai.__file__)'
366+
python -m pip uninstall -y monai
367+
- name: Install using uv
368+
working-directory: ${{ steps.root.outputs.pwd }}
369+
run: |
370+
pip install uv
371+
uv pip install --system --no-build-isolation .[all] --extra-index-url $INDEX_URL
364372
python -c 'import monai; monai.config.print_config()' 2>&1 | grep -iv "unknown"
365373
python -c 'import monai; print(monai.__file__)'

.github/workflows/codeql-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ jobs:
6767
rm -rf /opt/hostedtoolcache/{node,go,Ruby,Java*}
6868
ls -al /opt/hostedtoolcache
6969
rm -rf /usr/share/dotnet/
70-
python -m pip install -U --no-build-isolation pip wheel wheel-stub
71-
python -m pip install --no-build-isolation -r requirements-dev.txt
70+
python -m pip install -U pip wheel wheel-stub
71+
python -m pip install .[all,testing]
7272
BUILD_MONAI=1 ./runtests.sh --build
7373
7474
- name: Perform CodeQL Analysis

.github/workflows/cron-ngc-bundle.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ jobs:
2929
- name: Install dependencies
3030
run: |
3131
rm -rf /github/home/.cache/torch/hub/bundle/
32-
python -m pip install --no-build-isolation --upgrade pip wheel wheel-stub
33-
python -m pip install --no-build-isolation -r requirements-dev.txt
32+
python -m pip install -U pip wheel wheel-stub
33+
python -m pip install .[all,testing]
3434
- name: Loading Bundles
3535
run: |
3636
# clean up temporary files

.github/workflows/cron.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
python -m pip install --upgrade pip wheel
4444
python -m pip uninstall -y torch torchvision
4545
python -m pip install ${{ matrix.pytorch }}
46-
python -m pip install -r requirements-dev.txt
46+
python -m pip install .[all,testing]
4747
python -m pip list
4848
- name: Run tests report coverage
4949
env:
@@ -91,7 +91,7 @@ jobs:
9191
run: |
9292
which python
9393
python -m pip install --upgrade pip wheel
94-
python -m pip install -r requirements-dev.txt
94+
python -m pip install .[all,testing]
9595
python -m pip list
9696
- name: Run tests report coverage
9797
env:
@@ -137,7 +137,8 @@ jobs:
137137
- name: Install the dependencies
138138
run: |
139139
which python
140-
python -m pip install --upgrade pip wheel twine
140+
python -m pip install --upgrade pip wheel twine tomli
141+
python monai/config/print_dependencies.py build-system all testing | xargs -d '\n' pip install --no-build-isolation
141142
python -m pip list
142143
- name: Run tests report coverage
143144
shell: bash
@@ -171,7 +172,6 @@ jobs:
171172
python -c 'import monai; print(monai.__file__)'
172173
173174
# run tests
174-
cp $root_dir/requirements*.txt "$tmp_dir"
175175
cp -r $root_dir/tests "$tmp_dir"
176176
pwd
177177
ls -al
@@ -186,7 +186,6 @@ jobs:
186186
python -c $'import torch\na,b=torch.zeros(1,device="cuda:0"),torch.zeros(1,device="cuda:1");\nwhile True:print(a,b)' > /dev/null &
187187
python -c "import torch; print(torch.__version__); print('{} of GPUs available'.format(torch.cuda.device_count()))"
188188
189-
python -m pip install -r requirements-dev.txt
190189
PYTHONPATH="$tmp_dir":$PYTHONPATH BUILD_MONAI=1 python ./tests/runner.py -p 'test_((?!integration).)' # unit tests
191190
if pgrep python; then pkill python; fi
192191
@@ -214,7 +213,7 @@ jobs:
214213
python -c "import torch; print(torch.__version__); print('{} of GPUs available'.format(torch.cuda.device_count()))"
215214
python -c 'import torch; print(torch.rand(5,3, device=torch.device("cuda:0")))'
216215
ngc --version
217-
BUILD_MONAI=1 ./runtests.sh --build --coverage --unittests --disttests # unit tests with pytype checks, coverage report
216+
BUILD_MONAI=1 ./runtests.sh --build --coverage --pyrefly --unittests --disttests # unit tests with pyrefly checks, coverage report
218217
BUILD_MONAI=1 ./runtests.sh --build --coverage --net # integration tests with coverage report
219218
coverage xml --ignore-errors
220219
if pgrep python; then pkill python; fi
@@ -238,8 +237,8 @@ jobs:
238237
id: monai-install
239238
run: |
240239
which python
241-
python -m pip install --upgrade pip wheel
242-
python -m pip install -r requirements-dev.txt
240+
python -m pip install --upgrade pip wheel tomli
241+
python monai/config/print_dependencies.py build-system | xargs -d '\n' pip install --no-cache-dir --no-build-isolation
243242
BUILD_MONAI=1 python setup.py develop # install monai
244243
nvidia-smi
245244
export CUDA_VISIBLE_DEVICES=$(python -m tests.utils | tail -n 1)

.github/workflows/docker.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ jobs:
6969
cat _version.py
7070
mv _version.py monai/
7171
72-
# build "latest": remove flake package as it is not needed on hub.docker.com
73-
sed -i '/flake/d' requirements-dev.txt
7472
docker build -t projectmonai/monai:latest -f Dockerfile .
7573
7674
# distribute as always w/ tag "latest" to hub.docker.com

.github/workflows/integration.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ jobs:
3737
pip uninstall -y monai
3838
pip uninstall -y monai-weekly
3939
pip uninstall -y monai-weekly
40-
python -m pip install --upgrade torch torchvision torchaudio torchtext
41-
python -m pip install -r requirements-dev.txt
40+
python monai/config/print_dependencies.py build-system | xargs -d '\n' pip install --no-cache-dir --no-build-isolation
41+
python -m pip install --no-build-isolation .[all,testing]
4242
rm -rf /github/home/.cache/torch/hub/mmars/
4343
- name: Clean directory
4444
run: |
@@ -113,8 +113,7 @@ jobs:
113113
pip uninstall -y monai
114114
pip uninstall -y monai-weekly
115115
pip uninstall -y monai-weekly
116-
python -m pip install --upgrade torch torchvision torchaudio torchtext
117-
python -m pip install -r requirements-dev.txt
116+
python -m pip install .[all,testing]
118117
rm -rf /github/home/.cache/torch/hub/mmars/
119118
- name: Clean directory
120119
run: |
@@ -124,7 +123,7 @@ jobs:
124123
nvidia-smi
125124
export CUDA_VISIBLE_DEVICES=$(python -m tests.utils -c 1 | tail -n 1)
126125
echo $CUDA_VISIBLE_DEVICES
127-
python -c "import torch; print(torch.__version__); print('{} of GPUs available'.format(torch.cuda.device_count()))"
126+
python -c "import torch; print(torch.__version__); print(f'{torch.cuda.device_count()} of GPUs available')"
128127
python -c 'import torch; print(torch.rand(5,3, device=torch.device("cuda:0")))'
129128
130129
- name: Auto3dseg latest algo

.github/workflows/pythonapp-gpu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ jobs:
9696
rm -rf $(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")/ruamel*
9797
rm -rf $(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")/llvmlite* #6377
9898
python -m pip install ${{ matrix.pytorch }}
99-
python -m pip install -r requirements-dev.txt
99+
python -m pip install .[all,testing]
100100
python -m pip list
101101
- name: Run quick tests (GPU)
102102
if: github.event.pull_request.merged != true

.github/workflows/pythonapp-hyena-gpu.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ jobs:
4747
run: |
4848
python -m pip install --upgrade pip wheel
4949
python -c "import sys; assert sys.version_info >= (3, 10), f'Python >= 3.10 required for nvsubquadratic, got {sys.version}'"
50-
python -m pip install -r requirements-dev.txt
51-
python -m pip install -e .
50+
python -m pip install -e .[all,testing]
5251
# Install nvsubquadratic with --no-deps: the default torch_fft path needs only
5352
# torch + einops + omegaconf, and nvsubquadratic pins torch>=2.10,<2.11 which can
5453
# clash with the container's torch. To exercise the accelerated fused CUDA

.github/workflows/release.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ jobs:
2222
uses: actions/setup-python@v6
2323
with:
2424
python-version: ${{ matrix.python-version }}
25-
- name: Install setuptools
25+
- name: Install Dependencies
2626
run: |
27-
python -m pip install --user --upgrade setuptools wheel packaging
27+
python -m pip install --user --upgrade setuptools wheel packaging tomli
28+
python monai/config/print_dependencies.py build-system all testing | xargs -d '\n' pip install --no-build-isolation
2829
- name: Build and test source archive and wheel file
2930
run: |
3031
find /opt/hostedtoolcache/* -maxdepth 0 ! -name 'Python' -exec rm -rf {} \;
@@ -55,11 +56,10 @@ jobs:
5556
# clean up
5657
cd "$root_dir"
5758
rm -r "$tmp_dir"
58-
rm -rf monai/
5959
ls -al .
6060
- name: Quick test installed
6161
run: |
62-
python -m pip install -r requirements-min.txt
62+
python -m pip install -e .[testing]
6363
python -m tests.min_tests
6464
env:
6565
QUICKTEST: True
@@ -105,7 +105,8 @@ jobs:
105105
run: |
106106
find /opt/hostedtoolcache/* -maxdepth 0 ! -name 'Python' -exec rm -rf {} \;
107107
git describe
108-
python -m pip install --user --upgrade setuptools wheel packaging
108+
python -m pip install --user --upgrade setuptools wheel packaging tomli
109+
python monai/config/print_dependencies.py build-system all testing | xargs -d '\n' pip install --no-build-isolation
109110
python setup.py build
110111
cat build/lib/monai/_version.py
111112
- name: Upload version
@@ -159,8 +160,6 @@ jobs:
159160
echo "unmatched version string, please check the tagging branch."
160161
exit 1
161162
fi
162-
# remove flake package as it is not needed on hub.docker.com
163-
sed -i '/flake/d' requirements-dev.txt
164163
docker build -t projectmonai/monai:"$RELEASE_VERSION" -f Dockerfile .
165164
# distribute with a tag to hub.docker.com
166165
echo "${{ secrets.DOCKER_PW }}" | docker login -u projectmonai --password-stdin

0 commit comments

Comments
 (0)