Skip to content

Commit

Permalink
updated packaging in setup, utils
Browse files Browse the repository at this point in the history
Signed-off-by: dedeepyasai <[email protected]>
  • Loading branch information
dedeepyasai committed Jul 26, 2024
1 parent ab3ae73 commit 967f4ad
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ onnxruntime; python_version <= '3.10'
zarr
huggingface_hub
pyamg>=5.0.0
packaging
9 changes: 4 additions & 5 deletions monai/utils/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import torch

import importlib.metadata
from packaging import version


# bundle config system flags
Expand Down Expand Up @@ -567,10 +566,10 @@ def version_leq(lhs: str, rhs: str) -> bool:
"""

lhs, rhs = str(lhs), str(rhs)
pkging, has_ver = optional_import("packaging", name="packaging")
pkging, has_ver = optional_import("packaging")
if has_ver:
try:
return cast(bool, version(lhs) <= version(rhs))
return cast(bool, pkging.version.Version(lhs) <= pkging.version.Version(rhs))
except version.InvalidVersion:
return True

Expand All @@ -594,10 +593,10 @@ def version_geq(lhs: str, rhs: str) -> bool:
"""
lhs, rhs = str(lhs), str(rhs)
pkging, has_ver = optional_import("packaging", name="packaging")
pkging, has_ver = optional_import("packaging")
if has_ver:
try:
return cast(bool, version(lhs) >= version(rhs))
return cast(bool, pkging.version.Version(lhs) >= pkging.version.Version(rhs))
except version.InvalidVersion:
return True

Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@ nvidia-ml-py
huggingface_hub
pyamg>=5.0.0
git+https://github.com/Project-MONAI/GenerativeModels.git@7428fce193771e9564f29b91d29e523dd1b6b4cd
packaging
1 change: 1 addition & 0 deletions requirements-min.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ setuptools>=50.3.0,<66.0.0,!=60.6.0 ; python_version < "3.12"
setuptools>=70.2.0; python_version >= "3.12"
coverage>=5.5
parameterized
packaging
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ pyyaml =
pyyaml
fire =
fire
packaging =
packaging
jsonschema =
jsonschema
pynrrd =
Expand Down

0 comments on commit 967f4ad

Please sign in to comment.