Skip to content

Commit c3605c5

Browse files
authored
Merge branch 'dev' into ci-gate-tests-by-change-scan-8971
Signed-off-by: Siddhardha Nanda <99672439+SID-6921@users.noreply.github.com>
2 parents e602050 + 02201b8 commit c3605c5

170 files changed

Lines changed: 7125 additions & 1295 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/blossom-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
runs-on: ubuntu-latest
5252
steps:
5353
- name: Checkout code
54-
uses: actions/checkout@v4
54+
uses: actions/checkout@v7
5555
with:
5656
repository: ${{ fromJson(needs.Authorization.outputs.args).repo }}
5757
ref: ${{ fromJson(needs.Authorization.outputs.args).ref }}

.github/workflows/build_docs.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ 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:
27-
- uses: actions/checkout@v6
29+
- uses: actions/checkout@v7
2830
- name: Set up Python ${{ env.PYTHON_VER1 }}
2931
uses: actions/setup-python@v6
3032
with:

.github/workflows/cicd_tests.yml

Lines changed: 91 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ jobs:
100100
runs-on: ubuntu-latest
101101
strategy:
102102
matrix:
103-
opt: ["codeformat", "mypy"] # "pytype" omitted for being essentially deprecated, see #8865
103+
opt: ["codeformat", "pyrefly"]
104104
steps:
105105
- name: Clean unused tools
106106
run: |
@@ -110,7 +110,7 @@ jobs:
110110
sudo rm -rf /opt/ghc /usr/local/.ghcup
111111
sudo docker system prune -f
112112
113-
- uses: actions/checkout@v6
113+
- uses: actions/checkout@v7
114114
- name: Set up Python ${{ env.PYTHON_VER1 }}
115115
uses: actions/setup-python@v6
116116
with:
@@ -119,13 +119,12 @@ jobs:
119119
- name: Install dependencies
120120
run: |
121121
python -m pip install --upgrade pip wheel
122-
python -m pip install --no-build-isolation -r requirements-dev.txt
122+
python -m pip install .[all,testing]
123123
- name: Lint and type check
124124
run: |
125125
# clean up temporary files
126126
$(pwd)/runtests.sh --build --clean
127-
# Github actions have multiple cores, so parallelize pytype
128-
$(pwd)/runtests.sh --build --${{ matrix.opt }} -j $(nproc --all)
127+
$(pwd)/runtests.sh --build --${{ matrix.opt }}
129128
130129
min-dep: # Test with minumum dependencies installed for different OS, Python, and PyTorch combinations
131130
needs: changes
@@ -175,7 +174,7 @@ jobs:
175174
sudo rm -rf /usr/local/lib/android
176175
sudo rm -rf /opt/ghc /usr/local/.ghcup
177176
sudo docker system prune -f
178-
- uses: actions/checkout@v6
177+
- uses: actions/checkout@v7
179178
- name: Set up Python ${{ matrix.python-version }}
180179
uses: actions/setup-python@v6
181180
with:
@@ -184,15 +183,14 @@ jobs:
184183
- name: Prepare pip wheel
185184
run: |
186185
which python
187-
python -m pip install --upgrade pip wheel
188-
python -m pip install --user more-itertools>=8.0
186+
python -m pip install --upgrade pip wheel tomli
189187
- name: Install the minimum dependencies
190188
run: |
191189
# min. requirements
192190
python -m pip install torch==${{ matrix.pytorch-version }}
193-
python -m pip install -r requirements-min.txt
191+
python monai/config/print_dependencies.py build-system | xargs pip install --no-build-isolation
192+
python -m pip install --no-build-isolation .[testing]
194193
python -m pip list
195-
BUILD_MONAI=0 python setup.py develop # no compile of extensions
196194
shell: bash
197195
- if: matrix.os == 'linux-gpu-runner'
198196
name: Print GPU Info
@@ -219,7 +217,7 @@ jobs:
219217
strategy:
220218
fail-fast: false
221219
matrix:
222-
os: [windows-latest, ubuntu-latest] # macOS-latest omitted for now for being very slow, see #8864
220+
os: [windows-latest, ubuntu-latest, macOS-latest] # macOS-latest is very slow (#8864), testing install only
223221
timeout-minutes: 120
224222
env:
225223
QUICKTEST: True
@@ -239,7 +237,7 @@ jobs:
239237
minimum-size: 8GB
240238
maximum-size: 16GB
241239
disk-root: "D:"
242-
- uses: actions/checkout@v6
240+
- uses: actions/checkout@v7
243241
- name: Set up Python ${{ env.PYTHON_VER1 }}
244242
uses: actions/setup-python@v6
245243
with:
@@ -267,30 +265,91 @@ jobs:
267265
shell: bash
268266
- name: Install the complete dependencies
269267
run: |
270-
python -m pip install --user --upgrade pip wheel pybind11 # TODO: pybind11 added for macOS, may not be needed
271-
cat "requirements-dev.txt"
272-
python -m pip install --no-build-isolation -r requirements-dev.txt
268+
python -m pip install --user --upgrade pip wheel tomli
269+
python monai/config/print_dependencies.py build-system | xargs pip install --no-build-isolation
270+
python -m pip install --no-build-isolation .[all,testing]
273271
python -m pip list
274-
python -m pip install -e . # test no compile installation
275272
shell: bash
276273
- name: Run compiled (${{ runner.os }})
277274
run: |
278275
python -m pip uninstall -y monai
279-
BUILD_MONAI=1 python -m pip install -e . # compile the cpp extensions
276+
BUILD_MONAI=1 python -m pip install --no-build-isolation -e . # compile the cpp extensions in-place with -e
277+
# ensure extensions were compiled
278+
python -c 'import monai._C' > /dev/null
280279
shell: bash
281-
- name: Run quick tests
280+
- if: runner.os != 'macOS'
281+
name: Run full tests
282282
run: |
283283
python -c 'import torch; print(torch.__version__); print(torch.rand(5,3))'
284284
python -c "import monai; monai.config.print_config()"
285285
python -m unittest -v
286286
shell: bash
287+
- if: runner.os == 'macOS'
288+
name: Run min tests
289+
run: |
290+
python -c 'import torch; print(torch.__version__); print(torch.rand(5,3))'
291+
python -c "import monai; monai.config.print_config()"
292+
# TODO: enable large range of macOS tests which don't take a very long time
293+
./runtests.sh --min
294+
shell: bash
295+
296+
hyena-dep: # Optional HyenaND dependency + the no-CUDA Hyena tests.
297+
# nvsubquadratic >= 0.1.1 supports Python >= 3.10 and keeps its CUDA-kernel sdist
298+
# (subquadratic-ops-torch-cu12) plus the megatron / dali / timm packages in opt-in
299+
# extras, so it installs on a CPU runner. We still pass ``--no-deps`` deliberately:
300+
# (1) the HyenaND operators import only torch + einops + omegaconf at runtime, so
301+
# skipping the (still batteries-included: datasets/lightning/wandb) core deps
302+
# keeps this job lean; and
303+
# (2) nvsubquadratic pins torch>=2.10,<2.11, which would otherwise upgrade/clash
304+
# with the torch this job (and MONAI's matrix) installs.
305+
# CUDA-required Hyena tests skip cleanly here; the GPU surface is covered by
306+
# ``.github/workflows/pythonapp-hyena-gpu.yml``.
307+
runs-on: ubuntu-latest
308+
timeout-minutes: 30
309+
steps:
310+
- name: Clean unused tools
311+
run: |
312+
find /opt/hostedtoolcache/* -maxdepth 0 ! -name 'Python' -exec rm -rf {} \;
313+
sudo rm -rf /usr/share/dotnet
314+
sudo rm -rf /usr/local/lib/android
315+
sudo rm -rf /opt/ghc /usr/local/.ghcup
316+
sudo docker system prune -f
317+
- uses: actions/checkout@v6
318+
- name: Set up Python ${{ env.PYTHON_VER1 }}
319+
uses: actions/setup-python@v6
320+
with:
321+
python-version: ${{ env.PYTHON_VER1 }}
322+
cache: 'pip'
323+
- name: Install dependencies + nvsubquadratic (no-deps)
324+
run: |
325+
python -m pip install --upgrade pip wheel tomli pytest
326+
# need a specific version of torch for nvsubquadratic
327+
python monai/config/print_dependencies.py build-system | \
328+
xargs -d '\n' pip install --no-build-isolation torch==2.10.0 torchvision==0.25.0
329+
# # nvsubquadratic runtime imports need only torch + einops + omegaconf; install
330+
# # the package itself without its core dependency tree (see job comment above).
331+
python -m pip install --no-build-isolation omegaconf
332+
python -m pip install --no-build-isolation --no-deps 'nvsubquadratic>=0.1.1'
333+
python -m pip install --no-build-isolation .[hyena,testing]
334+
python -m pip list
335+
shell: bash
336+
- name: Run Hyena tests (CUDA-required cases skip cleanly)
337+
run: |
338+
python -c "from monai.networks.blocks.hyena import is_nvsubquadratic_available; \
339+
assert is_nvsubquadratic_available(), 'nvsubquadratic must be importable'"
340+
python -m pytest -v \
341+
tests/networks/blocks/test_hyena_block.py \
342+
tests/networks/nets/test_hyena_nd_unetr.py \
343+
tests/networks/nets/test_swin_unetr.py
344+
shell: bash
287345

288346
packaging: # Test package generation
289347
needs: changes
290348
if: needs.changes.outputs.run_tests == 'true'
291349
runs-on: ubuntu-latest
292350
env:
293351
QUICKTEST: True
352+
INDEX_URL: "https://download.pytorch.org/whl/cpu"
294353
steps:
295354
- name: Clean unused tools
296355
run: |
@@ -299,7 +358,7 @@ jobs:
299358
sudo rm -rf /usr/local/lib/android
300359
sudo rm -rf /opt/ghc /usr/local/.ghcup
301360
sudo docker system prune -f
302-
- uses: actions/checkout@v6
361+
- uses: actions/checkout@v7
303362
with:
304363
fetch-depth: 0
305364
- name: Set up Python ${{ env.PYTHON_VER1 }}
@@ -309,11 +368,10 @@ jobs:
309368
cache: 'pip'
310369
- name: Install dependencies
311370
run: |
312-
python -m pip install --user --upgrade pip setuptools wheel twine packaging
371+
python -m pip install --user --upgrade pip setuptools wheel twine packaging tomli
313372
# install the latest pytorch for testing
314-
# however, "pip install monai*.tar.gz" will build cpp/cuda with an isolated
315-
# fresh torch installation according to pyproject.toml
316-
python -m pip install torch==${PYTORCH_VER1} torchvision --extra-index-url https://download.pytorch.org/whl/cpu
373+
python monai/config/print_dependencies.py build-system all testing | \
374+
xargs -d '\n' pip install --no-build-isolation torch==${PYTORCH_VER1} --extra-index-url $INDEX_URL
317375
- name: Check packages
318376
run: |
319377
python -m pip uninstall -y monai
@@ -342,7 +400,7 @@ jobs:
342400
working-directory: ${{ steps.mktemp.outputs.tmp_dir }}
343401
run: |
344402
# install from wheel
345-
python -m pip install monai*.whl --extra-index-url https://download.pytorch.org/whl/cpu
403+
python -m pip install --no-build-isolation monai*.whl --extra-index-url $INDEX_URL
346404
python -c 'import monai; monai.config.print_config()' 2>&1 | grep -iv "unknown"
347405
python -c 'import monai; print(monai.__file__)'
348406
python -m pip uninstall -y monai
@@ -352,6 +410,14 @@ jobs:
352410
run: |
353411
for name in *.tar.gz; do break; done
354412
echo $name
355-
python -m pip install ${name}[all] --extra-index-url https://download.pytorch.org/whl/cpu
413+
python -m pip install --no-build-isolation ${name}[all] --extra-index-url $INDEX_URL
414+
python -c 'import monai; monai.config.print_config()' 2>&1 | grep -iv "unknown"
415+
python -c 'import monai; print(monai.__file__)'
416+
python -m pip uninstall -y monai
417+
- name: Install using uv
418+
working-directory: ${{ steps.root.outputs.pwd }}
419+
run: |
420+
pip install uv
421+
uv pip install --system --no-build-isolation .[all] --extra-index-url $INDEX_URL
356422
python -c 'import monai; monai.config.print_config()' 2>&1 | grep -iv "unknown"
357423
python -c 'import monai; print(monai.__file__)'

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838

3939
steps:
4040
- name: Checkout repository
41-
uses: actions/checkout@v6
41+
uses: actions/checkout@v7
4242

4343
# Initializes the CodeQL tools for scanning.
4444
- name: Initialize CodeQL
@@ -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/conda.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
minimum-size: 8GB
3333
maximum-size: 16GB
3434
disk-root: "D:"
35-
- uses: actions/checkout@v6
35+
- uses: actions/checkout@v7
3636
- name: Clean up disk space
3737
run: |
3838
find /opt/hostedtoolcache/* -maxdepth 0 ! -name 'Python' -exec rm -rf {} \;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
if: github.repository == 'Project-MONAI/MONAI'
1818
runs-on: ubuntu-latest
1919
steps:
20-
- uses: actions/checkout@v6
20+
- uses: actions/checkout@v7
2121
- name: Set up Python 3.10
2222
uses: actions/setup-python@v6
2323
with:
@@ -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

0 commit comments

Comments
 (0)