From cddc2a8ae2ac864a2708b8bc2760754ef87e787a Mon Sep 17 00:00:00 2001 From: jirka Date: Tue, 30 Dec 2025 13:58:21 +0100 Subject: [PATCH 1/4] resolves CI drive out of space by prune caching and use CPU version of `torch` Signed-off-by: jirka --- .github/workflows/pythonapp.yml | 60 +++++---------------------------- 1 file changed, 9 insertions(+), 51 deletions(-) diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index fca9136763..5fdec1e11e 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -33,16 +33,7 @@ jobs: uses: actions/setup-python@v6 with: python-version: '3.9' - - name: cache weekly timestamp - id: pip-cache - run: | - echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT - - name: cache for pip - uses: actions/cache@v4 - id: cache - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ steps.pip-cache.outputs.datew }} + cache: 'pip' - name: Install dependencies run: | find /opt/hostedtoolcache/* -maxdepth 0 ! -name 'Python' -exec rm -rf {} \; @@ -75,22 +66,11 @@ jobs: uses: actions/setup-python@v6 with: python-version: '3.9' + cache: 'pip' - name: Prepare pip wheel run: | which python python -m pip install --upgrade pip wheel - - name: cache weekly timestamp - id: pip-cache - run: | - echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT - echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT - shell: bash - - name: cache for pip - uses: actions/cache@v4 - id: cache - with: - path: ${{ steps.pip-cache.outputs.dir }} - key: ${{ matrix.os }}-latest-pip-${{ steps.pip-cache.outputs.datew }} - if: runner.os == 'windows' name: Install torch cpu from pytorch.org (Windows only) run: | @@ -136,18 +116,7 @@ jobs: uses: actions/setup-python@v6 with: python-version: '3.9' - - name: cache weekly timestamp - id: pip-cache - run: | - echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT - - name: cache for pip - uses: actions/cache@v4 - id: cache - with: - path: | - ~/.cache/pip - ~/.cache/torch - key: ${{ runner.os }}-pip-${{ steps.pip-cache.outputs.datew }} + cache: 'pip' - name: Install dependencies run: | find /opt/hostedtoolcache/* -maxdepth 0 ! -name 'Python' -exec rm -rf {} \; @@ -155,7 +124,7 @@ jobs: # install the latest pytorch for testing # however, "pip install monai*.tar.gz" will build cpp/cuda with an isolated # fresh torch installation according to pyproject.toml - python -m pip install torch>=2.5.1 torchvision + python -m pip install torch>=2.5.1 torchvision --extra-index-url https://download.pytorch.org/whl/cpu - name: Check packages run: | pip uninstall monai @@ -184,7 +153,7 @@ jobs: working-directory: ${{ steps.mktemp.outputs.tmp_dir }} run: | # install from wheel - python -m pip install monai*.whl + python -m pip install monai*.whl --extra-index-url https://download.pytorch.org/whl/cpu python -c 'import monai; monai.config.print_config()' 2>&1 | grep -iv "unknown" python -c 'import monai; print(monai.__file__)' python -m pip uninstall -y monai @@ -195,7 +164,7 @@ jobs: # install from tar.gz name=$(ls *.tar.gz | head -n1) echo $name - python -m pip install $name[all] + python -m pip install $name[all] --extra-index-url https://download.pytorch.org/whl/cpu python -c 'import monai; monai.config.print_config()' 2>&1 | grep -iv "unknown" python -c 'import monai; print(monai.__file__)' - name: Quick test @@ -205,7 +174,7 @@ jobs: cp ${{ steps.root.outputs.pwd }}/requirements*.txt . cp -r ${{ steps.root.outputs.pwd }}/tests . ls -al - python -m pip install -r requirements-dev.txt + python -m pip install -r requirements-dev.txt --extra-index-url https://download.pytorch.org/whl/cpu python -m unittest -v env: PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python # https://github.com/Project-MONAI/MONAI/issues/4354 @@ -218,22 +187,11 @@ jobs: uses: actions/setup-python@v6 with: python-version: '3.9' - - name: cache weekly timestamp - id: pip-cache - run: | - echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT - - name: cache for pip - uses: actions/cache@v4 - id: cache - with: - path: | - ~/.cache/pip - ~/.cache/torch - key: ${{ runner.os }}-pip-${{ steps.pip-cache.outputs.datew }} + cache: 'pip' - name: Install dependencies run: | python -m pip install --upgrade pip wheel - python -m pip install -r docs/requirements.txt + python -m pip install -r docs/requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu - name: Make html run: | cd docs/ From 931132983e582b746d32bb112967f49fb60e0975 Mon Sep 17 00:00:00 2001 From: jirka Date: Sun, 4 Jan 2026 09:21:49 +0100 Subject: [PATCH 2/4] # type: ignore[arg-type] Signed-off-by: jirka --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 576743c1f7..5ae9d8eabf 100644 --- a/setup.py +++ b/setup.py @@ -146,6 +146,6 @@ def get_cmds(): cmdclass=get_cmds(), packages=find_packages(exclude=("docs", "examples", "tests")), zip_safe=False, - package_data={"monai": ["py.typed", *jit_extension_source]}, + package_data={"monai": ["py.typed", *jit_extension_source]}, # type: ignore[arg-type] ext_modules=get_extensions(), ) From 0d0fc56d7174349b1e69dbae6bfc0df3c9e7a424 Mon Sep 17 00:00:00 2001 From: jirka Date: Sun, 4 Jan 2026 10:01:14 +0100 Subject: [PATCH 3/4] # type: ignore Signed-off-by: jirka --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 5ae9d8eabf..2977d418f2 100644 --- a/setup.py +++ b/setup.py @@ -146,6 +146,6 @@ def get_cmds(): cmdclass=get_cmds(), packages=find_packages(exclude=("docs", "examples", "tests")), zip_safe=False, - package_data={"monai": ["py.typed", *jit_extension_source]}, # type: ignore[arg-type] + package_data={"monai": ["py.typed", *jit_extension_source]}, # type: ignore ext_modules=get_extensions(), ) From e85a62355b6334940b3fcaed70ae1c1f40d5b4e5 Mon Sep 17 00:00:00 2001 From: jirka Date: Sun, 4 Jan 2026 10:39:20 +0100 Subject: [PATCH 4/4] linting Signed-off-by: jirka --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 2977d418f2..df05908bc2 100644 --- a/setup.py +++ b/setup.py @@ -146,6 +146,6 @@ def get_cmds(): cmdclass=get_cmds(), packages=find_packages(exclude=("docs", "examples", "tests")), zip_safe=False, - package_data={"monai": ["py.typed", *jit_extension_source]}, # type: ignore + package_data={"monai": ["py.typed", *jit_extension_source]}, # type: ignore[arg-type] ext_modules=get_extensions(), )