Skip to content

Commit b69af40

Browse files
authored
Merge branch 'dev' into refactor/remap-labels-sequential
2 parents d999603 + c44ea23 commit b69af40

File tree

13 files changed

+30
-74
lines changed

13 files changed

+30
-74
lines changed

.github/workflows/chatops.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: dispatch
13-
uses: peter-evans/[email protected].0
13+
uses: peter-evans/[email protected].2
1414
with:
1515
token: ${{ secrets.PR_MAINTAIN }}
1616
reaction-token: ${{ secrets.GITHUB_TOKEN }}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
id: pip-cache
2727
run: echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT
2828
- name: cache for pip
29-
uses: actions/cache@v4
29+
uses: actions/cache@v5
3030
id: cache
3131
with:
3232
path: ~/.cache/pip

.github/workflows/docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
python setup.py build
3838
cat build/lib/monai/_version.py
3939
- name: Upload version
40-
uses: actions/upload-artifact@v5
40+
uses: actions/upload-artifact@v6
4141
with:
4242
name: _version.py
4343
path: build/lib/monai/_version.py

.github/workflows/integration.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
id: pip-cache
2323
run: echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT
2424
- name: cache for pip
25-
uses: actions/cache@v4
25+
uses: actions/cache@v5
2626
id: cache
2727
with:
2828
path: |
@@ -98,7 +98,7 @@ jobs:
9898
id: pip-cache
9999
run: echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT
100100
- name: cache for pip
101-
uses: actions/cache@v4
101+
uses: actions/cache@v5
102102
id: cache
103103
with:
104104
path: |

.github/workflows/pythonapp-min.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
4747
shell: bash
4848
- name: cache for pip
49-
uses: actions/cache@v4
49+
uses: actions/cache@v5
5050
id: cache
5151
with:
5252
path: ${{ steps.pip-cache.outputs.dir }}
@@ -96,7 +96,7 @@ jobs:
9696
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
9797
shell: bash
9898
- name: cache for pip
99-
uses: actions/cache@v4
99+
uses: actions/cache@v5
100100
id: cache
101101
with:
102102
path: ${{ steps.pip-cache.outputs.dir }}
@@ -145,7 +145,7 @@ jobs:
145145
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
146146
shell: bash
147147
- name: cache for pip
148-
uses: actions/cache@v4
148+
uses: actions/cache@v5
149149
id: cache
150150
with:
151151
path: ${{ steps.pip-cache.outputs.dir }}

.github/workflows/pythonapp.yml

Lines changed: 9 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,7 @@ jobs:
3333
uses: actions/setup-python@v6
3434
with:
3535
python-version: '3.9'
36-
- name: cache weekly timestamp
37-
id: pip-cache
38-
run: |
39-
echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT
40-
- name: cache for pip
41-
uses: actions/cache@v4
42-
id: cache
43-
with:
44-
path: ~/.cache/pip
45-
key: ${{ runner.os }}-pip-${{ steps.pip-cache.outputs.datew }}
36+
cache: 'pip'
4637
- name: Install dependencies
4738
run: |
4839
find /opt/hostedtoolcache/* -maxdepth 0 ! -name 'Python' -exec rm -rf {} \;
@@ -75,22 +66,11 @@ jobs:
7566
uses: actions/setup-python@v6
7667
with:
7768
python-version: '3.9'
69+
cache: 'pip'
7870
- name: Prepare pip wheel
7971
run: |
8072
which python
8173
python -m pip install --upgrade pip wheel
82-
- name: cache weekly timestamp
83-
id: pip-cache
84-
run: |
85-
echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT
86-
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
87-
shell: bash
88-
- name: cache for pip
89-
uses: actions/cache@v4
90-
id: cache
91-
with:
92-
path: ${{ steps.pip-cache.outputs.dir }}
93-
key: ${{ matrix.os }}-latest-pip-${{ steps.pip-cache.outputs.datew }}
9474
- if: runner.os == 'windows'
9575
name: Install torch cpu from pytorch.org (Windows only)
9676
run: |
@@ -136,26 +116,15 @@ jobs:
136116
uses: actions/setup-python@v6
137117
with:
138118
python-version: '3.9'
139-
- name: cache weekly timestamp
140-
id: pip-cache
141-
run: |
142-
echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT
143-
- name: cache for pip
144-
uses: actions/cache@v4
145-
id: cache
146-
with:
147-
path: |
148-
~/.cache/pip
149-
~/.cache/torch
150-
key: ${{ runner.os }}-pip-${{ steps.pip-cache.outputs.datew }}
119+
cache: 'pip'
151120
- name: Install dependencies
152121
run: |
153122
find /opt/hostedtoolcache/* -maxdepth 0 ! -name 'Python' -exec rm -rf {} \;
154123
python -m pip install --user --upgrade pip setuptools wheel twine packaging
155124
# install the latest pytorch for testing
156125
# however, "pip install monai*.tar.gz" will build cpp/cuda with an isolated
157126
# fresh torch installation according to pyproject.toml
158-
python -m pip install torch>=2.5.1 torchvision
127+
python -m pip install torch>=2.5.1 torchvision --extra-index-url https://download.pytorch.org/whl/cpu
159128
- name: Check packages
160129
run: |
161130
pip uninstall monai
@@ -184,7 +153,7 @@ jobs:
184153
working-directory: ${{ steps.mktemp.outputs.tmp_dir }}
185154
run: |
186155
# install from wheel
187-
python -m pip install monai*.whl
156+
python -m pip install monai*.whl --extra-index-url https://download.pytorch.org/whl/cpu
188157
python -c 'import monai; monai.config.print_config()' 2>&1 | grep -iv "unknown"
189158
python -c 'import monai; print(monai.__file__)'
190159
python -m pip uninstall -y monai
@@ -195,7 +164,7 @@ jobs:
195164
# install from tar.gz
196165
name=$(ls *.tar.gz | head -n1)
197166
echo $name
198-
python -m pip install $name[all]
167+
python -m pip install $name[all] --extra-index-url https://download.pytorch.org/whl/cpu
199168
python -c 'import monai; monai.config.print_config()' 2>&1 | grep -iv "unknown"
200169
python -c 'import monai; print(monai.__file__)'
201170
- name: Quick test
@@ -205,7 +174,7 @@ jobs:
205174
cp ${{ steps.root.outputs.pwd }}/requirements*.txt .
206175
cp -r ${{ steps.root.outputs.pwd }}/tests .
207176
ls -al
208-
python -m pip install -r requirements-dev.txt
177+
python -m pip install -r requirements-dev.txt --extra-index-url https://download.pytorch.org/whl/cpu
209178
python -m unittest -v
210179
env:
211180
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python # https://github.com/Project-MONAI/MONAI/issues/4354
@@ -218,22 +187,11 @@ jobs:
218187
uses: actions/setup-python@v6
219188
with:
220189
python-version: '3.9'
221-
- name: cache weekly timestamp
222-
id: pip-cache
223-
run: |
224-
echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT
225-
- name: cache for pip
226-
uses: actions/cache@v4
227-
id: cache
228-
with:
229-
path: |
230-
~/.cache/pip
231-
~/.cache/torch
232-
key: ${{ runner.os }}-pip-${{ steps.pip-cache.outputs.datew }}
190+
cache: 'pip'
233191
- name: Install dependencies
234192
run: |
235193
python -m pip install --upgrade pip wheel
236-
python -m pip install -r docs/requirements.txt
194+
python -m pip install -r docs/requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu
237195
- name: Make html
238196
run: |
239197
cd docs/

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666

6767
- if: matrix.python-version == '3.9' && startsWith(github.ref, 'refs/tags/')
6868
name: Upload artifacts
69-
uses: actions/upload-artifact@v5
69+
uses: actions/upload-artifact@v6
7070
with:
7171
name: dist
7272
path: dist/
@@ -109,7 +109,7 @@ jobs:
109109
python setup.py build
110110
cat build/lib/monai/_version.py
111111
- name: Upload version
112-
uses: actions/upload-artifact@v5
112+
uses: actions/upload-artifact@v6
113113
with:
114114
name: _version.py
115115
path: build/lib/monai/_version.py

.github/workflows/setupapp.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT
3636
- name: cache for pip
3737
if: ${{ startsWith(github.ref, 'refs/heads/dev') }}
38-
uses: actions/cache@v4
38+
uses: actions/cache@v5
3939
id: cache
4040
with:
4141
path: |
@@ -95,7 +95,7 @@ jobs:
9595
run: |
9696
echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT
9797
- name: cache for pip
98-
uses: actions/cache@v4
98+
uses: actions/cache@v5
9999
id: cache
100100
with:
101101
path: |
@@ -136,7 +136,7 @@ jobs:
136136
run: |
137137
echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT
138138
- name: cache for pip
139-
uses: actions/cache@v4
139+
uses: actions/cache@v5
140140
id: cache
141141
with:
142142
path: |

.github/workflows/weekly-preview.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
run: |
2222
echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT
2323
- name: cache for pip
24-
uses: actions/cache@v4
24+
uses: actions/cache@v5
2525
id: cache
2626
with:
2727
path: ~/.cache/pip

monai/bundle/scripts.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import re
1818
import urllib
1919
import warnings
20-
import zipfile
2120
from collections.abc import Mapping, Sequence
2221
from functools import partial
2322
from pathlib import Path
@@ -30,7 +29,7 @@
3029
from torch.cuda import is_available
3130

3231
from monai._version import get_versions
33-
from monai.apps.utils import _basename, download_url, extractall, get_logger
32+
from monai.apps.utils import _basename, _extract_zip, download_url, extractall, get_logger
3433
from monai.bundle.config_parser import ConfigParser
3534
from monai.bundle.utils import DEFAULT_INFERENCE, DEFAULT_METADATA, merge_kv
3635
from monai.bundle.workflows import BundleWorkflow, ConfigWorkflow
@@ -288,9 +287,8 @@ def _download_from_ngc_private(
288287
if remove_prefix:
289288
filename = _remove_ngc_prefix(filename, prefix=remove_prefix)
290289
extract_path = download_path / f"{filename}"
291-
with zipfile.ZipFile(zip_path, "r") as z:
292-
z.extractall(extract_path)
293-
logger.info(f"Writing into directory: {extract_path}.")
290+
_extract_zip(zip_path, extract_path)
291+
logger.info(f"Writing into directory: {extract_path}.")
294292

295293

296294
def _get_ngc_token(api_key, retry=0):

0 commit comments

Comments
 (0)