From d0562b3569220e6cc80a0dd1e2fe61a098e92c81 Mon Sep 17 00:00:00 2001 From: Matthias Probst Date: Fri, 27 Oct 2023 13:20:24 +0200 Subject: [PATCH] update to zenodo_search==0.2.1 --- CHANGELOG.md | 3 +++ h5rdmtoolbox/conventions/core.py | 4 ++-- h5rdmtoolbox/conventions/standard_names/table.py | 2 +- setup.cfg | 4 ++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b56e91e..b1552ddc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ Log of changes in the versions +## v0.12.1 +- bugfix in zenodo search (did Zenodo change their API?) + ## v0.12.0 - 0D data is written to MongoDB - new utils like computing filesize diff --git a/h5rdmtoolbox/conventions/core.py b/h5rdmtoolbox/conventions/core.py index 52dd8d43..1eb9ef37 100644 --- a/h5rdmtoolbox/conventions/core.py +++ b/h5rdmtoolbox/conventions/core.py @@ -536,7 +536,7 @@ def from_zenodo(doi, name=None, if not filename.exists() or force_download: record = zsearch.search_doi(doi, parse_doi=False) if name is None: - matches = [file for file in record.files if file['filename'].rsplit('.', 1)[-1] == 'yaml'] + matches = [file for file in record.files if file['key'].rsplit('.', 1)[-1] == 'yaml'] if len(matches) == 0: raise ValueError(f'No file with suffix ".yaml" found in record {doi}') else: @@ -545,7 +545,7 @@ def from_zenodo(doi, name=None, raise ValueError(f'No file with name "{name}" found in record {doi}') file0 = zsearch.ZenodoFile(matches[0]) - if file0['filename'].rsplit('.', 1)[-1] != 'yaml': + if file0['key'].rsplit('.', 1)[-1] != 'yaml': raise ValueError(f'The file with name "{name}" is not a YAML file') _filename = file0.download(destination_dir=filename.parent) diff --git a/h5rdmtoolbox/conventions/standard_names/table.py b/h5rdmtoolbox/conventions/standard_names/table.py index 1c21015a..cf11e614 100644 --- a/h5rdmtoolbox/conventions/standard_names/table.py +++ b/h5rdmtoolbox/conventions/standard_names/table.py @@ -705,7 +705,7 @@ def from_zenodo(doi: str) -> "StandardNameTable": zenrec = zsearch.search_doi(doi) zenfile = zenrec.files[0] - yaml_name = zenrec.files[0]['filename'] + yaml_name = zenrec.files[0]['key'] if not yaml_name.endswith('.yaml'): raise ValueError(f'Expected yaml file, got {yaml_name}') _yaml_filename = zenfile.download() diff --git a/setup.cfg b/setup.cfg index 98c4f97f..f7668d7e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = h5rdmtoolbox -version = 0.12.0 +version = 0.12.1 author = Matthias Probst author_email = matthias.probst@kit.edu description = Supporting a FAIR Research Data lifecycle using Python and HDF5. @@ -34,7 +34,7 @@ install_requires = packaging python-forge == 18.6.0 requests - zenodo_search == 0.2.0 + zenodo_search == 0.2.1 pydantic >= 2.3.0 [options.extras_require]