Skip to content

Commit 4b719cb

Browse files
authored
Merge branch 'dev' into test/remove-duplicate-test-cases
2 parents 0dd40fa + 43c0aae commit 4b719cb

45 files changed

Lines changed: 2140 additions & 828 deletions

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: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ 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
@@ -137,15 +137,14 @@ jobs:
137137
- name: Prepare pip wheel
138138
run: |
139139
which python
140-
python -m pip install --upgrade pip wheel
141-
python -m pip install --user more-itertools>=8.0
140+
python -m pip install --upgrade pip wheel tomli
142141
- name: Install the minimum dependencies
143142
run: |
144143
# min. requirements
145144
python -m pip install torch==${{ matrix.pytorch-version }}
146-
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]
147147
python -m pip list
148-
BUILD_MONAI=0 python setup.py develop # no compile of extensions
149148
shell: bash
150149
- if: matrix.os == 'linux-gpu-runner'
151150
name: Print GPU Info
@@ -218,16 +217,17 @@ jobs:
218217
shell: bash
219218
- name: Install the complete dependencies
220219
run: |
221-
python -m pip install --user --upgrade pip wheel pybind11 # TODO: pybind11 added for macOS, may not be needed
222-
cat "requirements-dev.txt"
223-
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]
224223
python -m pip list
225-
python -m pip install --no-build-isolation -e . # test no compile installation
226224
shell: bash
227225
- name: Run compiled (${{ runner.os }})
228226
run: |
229227
python -m pip uninstall -y monai
230-
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
231231
shell: bash
232232
- if: runner.os != 'macOS'
233233
name: Run full tests
@@ -274,14 +274,15 @@ jobs:
274274
cache: 'pip'
275275
- name: Install dependencies + nvsubquadratic (no-deps)
276276
run: |
277-
python -m pip install --upgrade pip wheel
278-
python -m pip install torch==${PYTORCH_VER1} torchvision==${TORCHVISION_VER1}
279-
python -m pip install --no-build-isolation -r requirements-dev.txt
280-
python -m pip install -e .
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 omegaconf
284-
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]
285286
python -m pip list
286287
shell: bash
287288
- name: Run Hyena tests (CUDA-required cases skip cleanly)
@@ -298,6 +299,7 @@ jobs:
298299
runs-on: ubuntu-latest
299300
env:
300301
QUICKTEST: True
302+
INDEX_URL: "https://download.pytorch.org/whl/cpu"
301303
steps:
302304
- name: Clean unused tools
303305
run: |
@@ -316,11 +318,10 @@ jobs:
316318
cache: 'pip'
317319
- name: Install dependencies
318320
run: |
319-
python -m pip install --user --upgrade pip setuptools wheel twine packaging
321+
python -m pip install --user --upgrade pip setuptools wheel twine packaging tomli
320322
# install the latest pytorch for testing
321-
# however, "pip install monai*.tar.gz" will build cpp/cuda with an isolated
322-
# fresh torch installation according to pyproject.toml
323-
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
324325
- name: Check packages
325326
run: |
326327
python -m pip uninstall -y monai
@@ -349,7 +350,7 @@ jobs:
349350
working-directory: ${{ steps.mktemp.outputs.tmp_dir }}
350351
run: |
351352
# install from wheel
352-
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
353354
python -c 'import monai; monai.config.print_config()' 2>&1 | grep -iv "unknown"
354355
python -c 'import monai; print(monai.__file__)'
355356
python -m pip uninstall -y monai
@@ -359,6 +360,14 @@ jobs:
359360
run: |
360361
for name in *.tar.gz; do break; done
361362
echo $name
362-
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
363372
python -c 'import monai; monai.config.print_config()' 2>&1 | grep -iv "unknown"
364373
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: 6 additions & 7 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
@@ -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)