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 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..571942cce 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", ], ) @@ -25,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"