From 5a2c8127ba3a8e5a84b385ff7ad70ee54fe1bfb8 Mon Sep 17 00:00:00 2001 From: fynnbe Date: Tue, 7 May 2024 12:41:49 +0200 Subject: [PATCH 1/3] also resolve dois --- bioimageio/spec/_internal/io_utils.py | 9 +++++++++ tests/test_io.py | 2 ++ 2 files changed, 11 insertions(+) diff --git a/bioimageio/spec/_internal/io_utils.py b/bioimageio/spec/_internal/io_utils.py index 9c0cb6d8a..64e60d896 100644 --- a/bioimageio/spec/_internal/io_utils.py +++ b/bioimageio/spec/_internal/io_utils.py @@ -200,6 +200,11 @@ def _get_one_collection(url: str): # set version specific entry ret[c_entry.id + "/" + str(entry["version_number"])] = c_entry + # set doi entry + doi = entry.get("doi") + if doi is not None: + ret[doi] = c_entry + # update 'latest version' entry if c_entry.id not in ret: update = True @@ -216,6 +221,10 @@ def _get_one_collection(url: str): if update: ret[c_entry.id] = c_entry + # set concept doi entry + concept_doi = entry.get("concept_doi") + if concept_doi is not None: + ret[concept_doi] = c_entry return ret diff --git a/tests/test_io.py b/tests/test_io.py index 8b3b6339a..4bedd68cb 100644 --- a/tests/test_io.py +++ b/tests/test_io.py @@ -17,6 +17,8 @@ def test_load_non_existing_rdf(): [ "invigorating-lab-coat", "invigorating-lab-coat/1", + "10.5281/zenodo.11092896", # backup doi of version 1 + "10.5281/zenodo.11092895", # concept doi of backup "invigorating-lab-coat/staged/1", ], ) From 04f6e05daad59766f3e51728f407587ab23bef10 Mon Sep 17 00:00:00 2001 From: fynnbe Date: Tue, 7 May 2024 13:05:43 +0200 Subject: [PATCH 2/3] update changelog --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 19c8ac8b1..f4f893856 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,10 @@ Made with [contrib.rocks](https://contrib.rocks). ### bioimageio.spec Python package +#### bioimageio.spec 0.5.2post4 (to be released) + +* resolve backup DOIs + #### bioimageio.spec 0.5.2post3 * avoid full download when validating urls From 2a4e15db5a25de9a00751615749d6b7263fb1779 Mon Sep 17 00:00:00 2001 From: fynnbe Date: Tue, 7 May 2024 14:17:53 +0200 Subject: [PATCH 3/3] fix test_load_by_id --- tests/test_io.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_io.py b/tests/test_io.py index 4bedd68cb..571942cce 100644 --- a/tests/test_io.py +++ b/tests/test_io.py @@ -27,4 +27,4 @@ def test_load_by_id(rid: str): model = load_description(rid) assert not isinstance(model, InvalidDescr) - assert model.id == rid.split("/")[0] + assert model.id == "invigorating-lab-coat"