Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load from DOI #592

Merged
merged 3 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions bioimageio/spec/_internal/io_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
4 changes: 3 additions & 1 deletion tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
],
)
Expand All @@ -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"
Loading