Skip to content

Commit 8ce6b9f

Browse files
Merge pull request #137 from bioimage-io/shorter_cache_paths
Shorter cache path for unpacking package
2 parents f09c88f + bfd5844 commit 8ce6b9f

File tree

1 file changed

+2
-2
lines changed
  • bioimageio/core/resource_io

1 file changed

+2
-2
lines changed

bioimageio/core/resource_io/io_.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import warnings
44
import zipfile
55
from copy import deepcopy
6+
from hashlib import sha256
67
from typing import Dict, IO, Optional, Sequence, Tuple, Union
78
from zipfile import ZIP_DEFLATED, ZipFile
89

@@ -33,10 +34,10 @@ def extract_resource_package(
3334
cache_folder = BIOIMAGEIO_CACHE_PATH / "extracted_packages"
3435
cache_folder.mkdir(exist_ok=True, parents=True)
3536

37+
package_path = cache_folder / sha256(str(root).encode("utf-8")).hexdigest()
3638
if isinstance(root, raw_nodes.URI):
3739
from urllib.request import urlretrieve
3840

39-
package_path = cache_folder / root.scheme / root.authority / root.path.strip("/") / root.query
4041
for rdf_name in RDF_NAMES:
4142
if (package_path / rdf_name).exists():
4243
download = None
@@ -51,7 +52,6 @@ def extract_resource_package(
5152
else:
5253
download = None
5354
local_source = root
54-
package_path = cache_folder / root.relative_to(list(root.parents)[-1])
5555

5656
if local_source is not None:
5757
with zipfile.ZipFile(local_source) as zf:

0 commit comments

Comments
 (0)