Skip to content

Commit 0e19c6a

Browse files
committed
Remove Python 3.9
Signed-off-by: Joaquin Anton Guirao <janton@nvidia.com> linter fixes Signed-off-by: Joaquin Anton Guirao <janton@nvidia.com> [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Signed-off-by: Joaquin Anton Guirao <janton@nvidia.com>
1 parent 4e5f4a1 commit 0e19c6a

9 files changed

Lines changed: 29 additions & 20 deletions

File tree

.github/workflows/docker-plugin.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ jobs:
2626
MONAI_ZOO_AUTH_TOKEN: ${{ github.token }}
2727
steps:
2828
- uses: actions/checkout@v5
29-
- name: Set up Python 3.9
29+
- name: Set up Python 3.10
3030
uses: actions/setup-python@v5
3131
with:
32-
python-version: 3.9
32+
python-version: 3.10
3333
- name: clean up
3434
run: |
3535
sudo rm -rf /usr/share/dotnet

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ jobs:
3535
with:
3636
fetch-depth: 0
3737
- uses: actions/setup-node@v4
38-
- name: Set up Python 3.9
38+
- name: Set up Python 3.10
3939
uses: actions/setup-python@v5
4040
with:
41-
python-version: 3.9
41+
python-version: 3.10
4242
- name: Cache for pip
4343
uses: actions/cache@v4
4444
id: cache

docs/source/installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Prerequisites
5252
--------------------------
5353
MONAI Label supports both **Ubuntu** and **Windows** OS with GPU/CUDA enabled.
5454

55-
Make sure you have python 3.8/3.9 version environment with PyTorch and CUDA installed. MONAI Label features on other python version are not verified.
55+
Make sure you have python 3.10+ version environment with PyTorch and CUDA installed. MONAI Label features on other python version are not verified.
5656

5757
- Install `Python <https://www.python.org/downloads/>`_
5858
- Install the following Python libraries

monailabel/interfaces/app.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,11 @@ def __init__(
102102
self._trainers = self.init_trainers() if settings.MONAI_LABEL_TASKS_TRAIN else {}
103103
self._strategies = self.init_strategies() if settings.MONAI_LABEL_TASKS_STRATEGY else {}
104104
self._scoring_methods = self.init_scoring_methods() if settings.MONAI_LABEL_TASKS_SCORING else {}
105-
self._batch_infer = self.init_batch_infer() if settings.MONAI_LABEL_TASKS_BATCH_INFER else {}
105+
self._batch_infer: Callable = (
106+
self.init_batch_infer()
107+
if settings.MONAI_LABEL_TASKS_BATCH_INFER
108+
else lambda *args, **kwargs: self._raise_batch_infer_disabled()
109+
)
106110

107111
self._auto_update_scoring = settings.MONAI_LABEL_AUTO_UPDATE_SCORING
108112
self._sessions = self._load_sessions(load=settings.MONAI_LABEL_SESSIONS)
@@ -319,6 +323,13 @@ def run_infer_in_thread(t, r):
319323

320324
return {"label": label_id, "tag": DefaultLabelTag.ORIGINAL, "file": result_file_name, "params": result_json}
321325

326+
def _raise_batch_infer_disabled(self):
327+
"""Raise an exception when batch inference is disabled."""
328+
raise MONAILabelException(
329+
MONAILabelError.INVALID_INPUT,
330+
"Batch inference is disabled. Set MONAI_LABEL_TASKS_BATCH_INFER to true to enable it.",
331+
)
332+
322333
def batch_infer(self, request, datastore=None):
323334
"""
324335
Run batch inference for an existing pre-trained model.

monailabel/interfaces/tasks/infer_v2.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ class InferType(str, Enum):
3232
OTHERS - Other Model Type
3333
"""
3434

35-
SEGMENTATION: str = "segmentation"
36-
ANNOTATION: str = "annotation"
37-
CLASSIFICATION: str = "classification"
38-
DEEPGROW: str = "deepgrow"
39-
DEEPEDIT: str = "deepedit"
40-
SCRIBBLES: str = "scribbles"
41-
DETECTION: str = "detection"
42-
OTHERS: str = "others"
35+
SEGMENTATION = "segmentation"
36+
ANNOTATION = "annotation"
37+
CLASSIFICATION = "classification"
38+
DEEPGROW = "deepgrow"
39+
DEEPEDIT = "deepedit"
40+
SCRIBBLES = "scribbles"
41+
DETECTION = "detection"
42+
OTHERS = "others"
4343

4444

4545
class InferTask(metaclass=ABCMeta):

monailabel/interfaces/utils/app.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ def app_instance(app_dir=None, studies=None, conf=None):
2828
studies = studies if studies else settings.MONAI_LABEL_STUDIES
2929
cache_key = f"{app_dir}{studies}"
3030

31-
global apps
3231
app = apps.get(cache_key)
3332
if app is not None:
3433
return app
@@ -53,7 +52,6 @@ def app_instance(app_dir=None, studies=None, conf=None):
5352

5453

5554
def clear_cache():
56-
global apps
5755
apps.clear()
5856

5957

monailabel/tasks/infer/bundle.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def pre_transforms(self, data=None) -> Sequence[Callable]:
194194
unload_module("scripts")
195195
self._update_device(data)
196196

197-
pre = []
197+
pre: Sequence[Callable[..., Any]] = []
198198
for k in self.const.key_preprocessing():
199199
if self.bundle_config.get(k):
200200
c = self.bundle_config.get_parsed_content(k, instantiate=True)
@@ -257,7 +257,7 @@ def post_transforms(self, data=None) -> Sequence[Callable]:
257257
unload_module("scripts")
258258
self._update_device(data)
259259

260-
post = []
260+
post: Sequence[Callable[..., Any]] = []
261261
for k in self.const.key_postprocessing():
262262
if self.bundle_config.get(k):
263263
c = self.bundle_config.get_parsed_content(k, instantiate=True)

plugins/dsa/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# See the License for the specific language governing permissions and
1010
# limitations under the License.
1111

12-
FROM python:3.9-slim
12+
FROM python:3.10-slim
1313

1414
RUN python -m pip install histomicstk --find-links https://girder.github.io/large_image_wheels
1515

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ project_urls =
2727
Source Code=https://github.com/Project-MONAI/MONAILabel
2828

2929
[options]
30-
python_requires = >= 3.9
30+
python_requires = >= 3.10
3131
# for compiling and develop setup only
3232
# no need to specify the versions so that we could
3333
# compile for multiple targeted versions.

0 commit comments

Comments
 (0)