@@ -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__)'
0 commit comments