Skip to content

Commit f6808db

Browse files
authored
Update imports and error messages of import errors. (#1104)
* Update imports and error messages of import errors. * Update poetry lock file. * Update changelog. * Display error message, not all pims readers imported only once. * Update changelog.
1 parent 4d2eac5 commit f6808db

File tree

12 files changed

+680
-1257
lines changed

12 files changed

+680
-1257
lines changed

docs/poetry.lock

Lines changed: 274 additions & 465 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
dunamai==1.18.1
2-
poetry==1.6.1
2+
poetry==1.8.2

webknossos/Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ For upgrade instructions, please check the respective _Breaking Changes_ section
2121

2222
### Fixed
2323
- Fixed an issue where cube jobs upsampling, downsampling and compress failed when performed on more than 3 dimensions. [#1095](https://github.com/scalableminds/webknossos-libs/pull/1095)
24+
- Fixed an issue where webknossos libs crash when installed with minimal dependencies. [#1104](https://github.com/scalableminds/webknossos-libs/pull/1104)
2425

2526

2627
## [0.14.23](https://github.com/scalableminds/webknossos-libs/releases/tag/v0.14.23) - 2024-06-28

webknossos/poetry.lock

Lines changed: 8 additions & 40 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webknossos/pyproject.toml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ natsort = "^6.2.0"
4141
networkx = "^2.6.2"
4242
numcodecs = "^0.11"
4343
numpy = "^1.21.0" # see https://numpy.org/neps/nep-0029-deprecation_policy.html#support-table
44+
pims = "^0.6.0"
4445
psutil = "^5.6.7"
4546
python-dateutil = "^2.8.0"
4647
python-dotenv = "^0.19.0"
@@ -58,17 +59,15 @@ zipp = "^3.5.0"
5859
# below `extras`. They can be opted into by apps.
5960
imagecodecs = { version = ">=2021.11.20", optional = true }
6061
JPype1 = { version = "^1.3.0", optional = true }
61-
pims = { version = "^0.6.0", optional = true }
6262
tifffile = { version = ">=2021.11.2", optional = true }
6363
pylibCZIrw = { version = "3.5.2", source = "scm", optional = true }
6464

6565
[tool.poetry.extras]
66-
pims = ["pims"]
67-
tifffile = ["pims", "tifffile"]
68-
imagecodecs = ["pims", "imagecodecs"]
69-
bioformats = ["pims","JPype1"]
70-
czi = ["pims", "pylibCZIrw"]
71-
all = ["pims","tifffile","imagecodecs","JPype1","pylibCZIrw"]
66+
tifffile = ["tifffile"]
67+
imagecodecs = ["imagecodecs"]
68+
bioformats = ["JPype1"]
69+
czi = ["pylibCZIrw"]
70+
all = ["tifffile","imagecodecs","JPype1","pylibCZIrw"]
7271

7372
[tool.poetry.group.dev]
7473
optional = true

webknossos/webknossos/dataset/_utils/pims_czi_reader.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,12 @@
44
from typing import Dict, Iterator, List, Set
55

66
import numpy as np
7-
8-
try:
9-
from pims import FramesSequenceND
10-
except ImportError as e:
11-
raise RuntimeError(
12-
"Cannot import pims, please install it e.g. using 'webknossos[all]'"
13-
) from e
7+
from pims import FramesSequenceND
148

159
try:
1610
from pylibCZIrw import czi as pyczi
1711
except ImportError as e:
18-
raise RuntimeError(
12+
raise ImportError(
1913
"Cannot import pylibCZIrw, please install it e.g. using 'webknossos[czi]'"
2014
) from e
2115

webknossos/webknossos/dataset/_utils/pims_dm_readers.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,12 @@
44
from typing import Iterator, Set
55

66
import numpy as np
7+
from pims import FramesSequenceND
78

89
from .vendor.dm3 import DM3 # type: ignore[attr-defined]
910
from .vendor.dm3 import dT_str as DM3_DTYPE_MAPPING # type: ignore[attr-defined]
1011
from .vendor.dm4 import DM4File # type: ignore[attr-defined]
1112

12-
try:
13-
from pims import FramesSequenceND
14-
except ImportError as e:
15-
raise RuntimeError(
16-
"Cannot import pims, please install it e.g. using 'webknossos[all]'"
17-
) from e
18-
1913

2014
class PimsDm3Reader(FramesSequenceND):
2115
@classmethod

webknossos/webknossos/dataset/_utils/pims_imagej_tiff_reader.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,12 @@
33
from typing import Set
44

55
import numpy as np
6-
7-
try:
8-
from pims import FramesSequenceND
9-
except ImportError as e:
10-
raise RuntimeError(
11-
"Cannot import pims, please install it e.g. using 'webknossos[all]'"
12-
) from e
6+
from pims import FramesSequenceND
137

148
try:
159
import tifffile
1610
except ImportError as e:
17-
raise RuntimeError(
11+
raise ImportError(
1812
"Cannot import tifffile, please install it e.g. using 'webknossos[tifffile]'"
1913
) from e
2014

0 commit comments

Comments
 (0)