Skip to content

Commit 1489e02

Browse files
authored
Merge branch 'dev' into feat-ignore-index-support
2 parents 3dbe35d + c4412eb commit 1489e02

149 files changed

Lines changed: 4552 additions & 1255 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/hooks/check-dco.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env bash
2+
# DCO sign-off check for the pre-commit commit-msg stage.
3+
#
4+
# Mirrors the GitHub DCO app requirement: every commit must carry a
5+
# "Signed-off-by:" line identifying the author.
6+
#
7+
# Usage: check-dco.sh <commit-message-file>
8+
9+
set -euo pipefail
10+
11+
msg_file="${1:-}"
12+
13+
if [[ -z "${msg_file}" || ! -f "${msg_file}" ]]; then
14+
echo "DCO check: no commit message file supplied." >&2
15+
exit 1
16+
fi
17+
18+
if grep -qE $'^Signed-off-by: .+ <[^@ ]+@[^@ ]+>\r?$' "${msg_file}"; then
19+
exit 0
20+
fi
21+
22+
cat >&2 <<'EOF'
23+
DCO check failed: commit message is missing a "Signed-off-by:" line.
24+
25+
Add a sign-off using one of:
26+
git commit -s # sign as you create the commit
27+
git commit --amend -s # sign the most recent commit
28+
29+
The line must identify the commit author, for example:
30+
Signed-off-by: Your Name <you@example.com>
31+
EOF
32+
33+
exit 1

.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: 38 additions & 42 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,26 +137,19 @@ 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
150-
shell: bash
151-
- if: matrix.os == 'linux-gpu-runner'
152-
name: Print GPU Info
153-
run: |
154-
nvidia-smi
155-
python -c 'import torch; print(torch.rand(2,2).to("cuda:0"))'
156148
shell: bash
157149
- name: Run quick tests
158150
run: |
159-
python -c 'import torch; print(torch.__version__); print(torch.rand(5,3))'
160-
python -c "import monai; monai.config.print_config()"
151+
nvidia-smi || true
152+
python monai/config/check_env.py --env --monai
161153
./runtests.sh --min
162154
shell: bash
163155
env:
@@ -219,29 +211,27 @@ jobs:
219211
shell: bash
220212
- name: Install the complete dependencies
221213
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
214+
python -m pip install --user --upgrade pip wheel tomli
215+
python monai/config/print_dependencies.py build-system | xargs pip install --no-build-isolation
216+
python -m pip install --no-build-isolation .[all,testing]
225217
python -m pip list
226-
python -m pip install --no-build-isolation -e . # test no compile installation
227218
shell: bash
228219
- name: Run compiled (${{ runner.os }})
229220
run: |
230221
python -m pip uninstall -y monai
231222
BUILD_MONAI=1 python -m pip install --no-build-isolation -e . # compile the cpp extensions
223+
python -c 'import monai._C' > /dev/null
224+
nvidia-smi || true
225+
python monai/config/check_env.py --env --monai
232226
shell: bash
233227
- if: runner.os != 'macOS'
234228
name: Run full tests
235229
run: |
236-
python -c 'import torch; print(torch.__version__); print(torch.rand(5,3))'
237-
python -c "import monai; monai.config.print_config()"
238230
python -m unittest -v
239231
shell: bash
240232
- if: runner.os == 'macOS'
241233
name: Run min tests
242234
run: |
243-
python -c 'import torch; print(torch.__version__); print(torch.rand(5,3))'
244-
python -c "import monai; monai.config.print_config()"
245235
# TODO: enable large range of macOS tests which don't take a very long time
246236
./runtests.sh --min
247237
shell: bash
@@ -275,14 +265,15 @@ jobs:
275265
cache: 'pip'
276266
- name: Install dependencies + nvsubquadratic (no-deps)
277267
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'
268+
python -m pip install --upgrade pip wheel tomli pytest
269+
# need a specific version of torch for nvsubquadratic
270+
python monai/config/print_dependencies.py build-system | \
271+
xargs -d '\n' pip install --no-build-isolation torch==2.10.0 torchvision==0.25.0
272+
# # nvsubquadratic runtime imports need only torch + einops + omegaconf; install
273+
# # the package itself without its core dependency tree (see job comment above).
274+
python -m pip install --no-build-isolation omegaconf
275+
python -m pip install --no-build-isolation --no-deps 'nvsubquadratic>=0.1.1'
276+
python -m pip install --no-build-isolation .[hyena,testing]
286277
python -m pip list
287278
shell: bash
288279
- name: Run Hyena tests (CUDA-required cases skip cleanly)
@@ -299,6 +290,7 @@ jobs:
299290
runs-on: ubuntu-latest
300291
env:
301292
QUICKTEST: True
293+
INDEX_URL: "https://download.pytorch.org/whl/cpu"
302294
steps:
303295
- name: Clean unused tools
304296
run: |
@@ -317,11 +309,10 @@ jobs:
317309
cache: 'pip'
318310
- name: Install dependencies
319311
run: |
320-
python -m pip install --user --upgrade pip setuptools wheel twine packaging
312+
python -m pip install --user --upgrade pip setuptools wheel twine packaging tomli
321313
# 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
314+
python monai/config/print_dependencies.py build-system all testing | \
315+
xargs -d '\n' pip install --no-build-isolation torch==${PYTORCH_VER1} --extra-index-url $INDEX_URL
325316
- name: Check packages
326317
run: |
327318
python -m pip uninstall -y monai
@@ -350,16 +341,21 @@ jobs:
350341
working-directory: ${{ steps.mktemp.outputs.tmp_dir }}
351342
run: |
352343
# install from wheel
353-
python -m pip install monai*.whl --extra-index-url https://download.pytorch.org/whl/cpu
354-
python -c 'import monai; monai.config.print_config()' 2>&1 | grep -iv "unknown"
355-
python -c 'import monai; print(monai.__file__)'
344+
python -m pip install --no-build-isolation monai*.whl --extra-index-url $INDEX_URL
345+
python -m monai.config
356346
python -m pip uninstall -y monai
357347
rm monai*.whl
358348
- name: Install source archive
359349
working-directory: ${{ steps.mktemp.outputs.tmp_dir }}
360350
run: |
361351
for name in *.tar.gz; do break; done
362352
echo $name
363-
python -m pip install ${name}[all] --extra-index-url https://download.pytorch.org/whl/cpu
364-
python -c 'import monai; monai.config.print_config()' 2>&1 | grep -iv "unknown"
365-
python -c 'import monai; print(monai.__file__)'
353+
python -m pip install --no-build-isolation ${name}[all] --extra-index-url $INDEX_URL
354+
python -m monai.config
355+
python -m pip uninstall -y monai
356+
- name: Install using uv
357+
working-directory: ${{ steps.root.outputs.pwd }}
358+
run: |
359+
pip install uv
360+
uv pip install --system --no-build-isolation .[all] --extra-index-url $INDEX_URL
361+
python -m monai.config

.github/workflows/codeql-analysis.yml

Lines changed: 67 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,67 +9,110 @@
99
# the `language` matrix defined below to confirm you have the correct set of
1010
# supported CodeQL languages.
1111
#
12-
name: "CodeQL"
12+
name: "CodeQL Advanced"
1313

1414
on:
1515
push:
1616
branches: [ dev, main ]
1717
pull_request:
18-
# The branches below must be a subset of the branches above
1918
branches: [ dev ]
2019
schedule:
21-
- cron: '18 1 * * 0'
20+
- cron: '0 2 * * 1' # 2AM Monday
21+
22+
env:
23+
PYTHON_VER: '3.11'
24+
PYTORCH_VER: '2.8.0'
25+
BUILD_MONAI: 1
26+
PIP_EXTRA_INDEX_URL: "https://download.pytorch.org/whl/cpu" # forces CPU PyTorch installation, should be faster
2227

2328
jobs:
2429
analyze:
25-
name: Analyze
30+
name: Analyze (${{ matrix.language }})
31+
# Runner size impacts CodeQL analysis time. To learn more, please see:
32+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
33+
# - https://gh.io/supported-runners-and-hardware-resources
34+
# - https://gh.io/using-larger-runners (GitHub.com only)
35+
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
2636
runs-on: ubuntu-latest
2737
permissions:
38+
# required for all workflows
39+
security-events: write
40+
41+
# required to fetch internal or private CodeQL packs
42+
packages: read
43+
44+
# only required for workflows in private repositories
2845
actions: read
2946
contents: read
30-
security-events: write
3147

3248
strategy:
3349
fail-fast: false
3450
matrix:
35-
language: [ 'cpp', 'python' ]
36-
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37-
# Learn more about CodeQL language support at https://git.io/codeql-language-support
38-
51+
include:
52+
- language: actions
53+
build-mode: none
54+
- language: c-cpp
55+
build-mode: none # TODO: get Cpp building working, autobuild doesn't work and manual fails for inexplicable reasons.
56+
- language: python
57+
build-mode: none
58+
# CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift'
59+
# Use `c-cpp` to analyze code written in C, C++ or both
60+
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
61+
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
62+
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
63+
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
64+
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
65+
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
3966
steps:
4067
- name: Checkout repository
4168
uses: actions/checkout@v7
4269

70+
# Add any setup steps before running the `github/codeql-action/init` action.
71+
# This includes steps like installing compilers or runtimes (`actions/setup-node`
72+
# or others). This is typically only required for manual builds.
73+
# - name: Setup runtime (example)
74+
# uses: actions/setup-example@v1
75+
4376
# Initializes the CodeQL tools for scanning.
4477
- name: Initialize CodeQL
4578
uses: github/codeql-action/init@v4
4679
with:
4780
languages: ${{ matrix.language }}
81+
build-mode: ${{ matrix.build-mode }}
4882
# If you wish to specify custom queries, you can do so here or in a config file.
4983
# By default, queries listed here will override any specified in a config file.
5084
# Prefix the list here with "+" to use these queries and those in the config file.
51-
# queries: ./path/to/local/query, your-org/your-repo/queries@main
5285

53-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
54-
# If this step fails, then you should remove it and run the build manually (see below)
55-
# - name: Autobuild
56-
# uses: github/codeql-action/autobuild@v2
86+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
87+
# queries: security-extended,security-and-quality
5788

89+
# If the analyze step fails for one of the languages you are analyzing with
90+
# "We were unable to automatically build your code", modify the matrix above
91+
# to set the build mode to "manual" for that language. Then modify this step
92+
# to build your code.
5893
# ℹ️ Command-line programs to run using the OS shell.
59-
# 📚 https://git.io/JvXDl
60-
61-
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
62-
# and modify them (or add more) to build your code if your project
63-
# uses a compiled language
94+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
95+
- name: Set up Python ${{ env.PYTHON_VER }}
96+
if: matrix.language == 'c-cpp' && matrix.build-mode == 'manual'
97+
uses: actions/setup-python@v6
98+
with:
99+
python-version: ${{ env.PYTHON_VER }}
100+
cache: 'pip'
64101

65-
- name: Build
102+
- name: Run manual build steps
103+
if: matrix.language == 'c-cpp' && matrix.build-mode == 'manual'
104+
shell: bash
66105
run: |
67106
rm -rf /opt/hostedtoolcache/{node,go,Ruby,Java*}
68107
ls -al /opt/hostedtoolcache
69-
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
72-
BUILD_MONAI=1 ./runtests.sh --build
108+
sudo rm -rf /usr/share/dotnet/
109+
python -m pip install -U pip wheel wheel-stub
110+
python -m pip install torch==${PYTORCH_VER} torchvision
111+
python -m pip install --user --upgrade pip wheel
112+
python monai/config/print_dependencies.py build-system | xargs pip install --no-build-isolation
113+
python -m pip install --no-build-isolation .
73114
74115
- name: Perform CodeQL Analysis
75116
uses: github/codeql-action/analyze@v4
117+
with:
118+
category: "/language:${{matrix.language}}"

.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

0 commit comments

Comments
 (0)