From ef713d7f6c22e34b95e72c7808a653878a175664 Mon Sep 17 00:00:00 2001 From: Vuillaume Date: Wed, 4 May 2022 09:39:56 +0000 Subject: [PATCH 01/15] release option to update codemeta --- codemeta.json | 2 +- eossr/scripts/update_codemeta_eossr.py | 20 +++++++++++++++++++- eossr/utils.py | 6 ++++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/codemeta.json b/codemeta.json index c77bf76..2d957f6 100644 --- a/codemeta.json +++ b/codemeta.json @@ -115,4 +115,4 @@ } ], "funding": "824064" -} \ No newline at end of file +} diff --git a/eossr/scripts/update_codemeta_eossr.py b/eossr/scripts/update_codemeta_eossr.py index fa949da..02e7a54 100644 --- a/eossr/scripts/update_codemeta_eossr.py +++ b/eossr/scripts/update_codemeta_eossr.py @@ -24,17 +24,35 @@ def build_argparser(): default=Path(ROOT_DIR).joinpath('codemeta.json'), required=False, ) + + parser.add_argument( + '--no-release', + action='store_false', + help="Use when making a release. Do not update the publication date, the zip archive URL and remove release notes." + ) + return parser if __name__ == '__main__': parser = build_argparser() args = parser.parse_args() - download_url = f'https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/archive/v{eossr_version}/eossr-v{eossr_version}.zip' + + if args.no_release: + publication_date = False + release_notes = "" + download_url = "" + else: + publication_date = True + release_notes = None + download_url = f'https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/archive/v{eossr_version}/eossr-v{eossr_version}.zip' + html = update_codemeta( codemeta_path=args.codemeta_path, readme_path=Path(__file__).parent.joinpath('../../README.md').resolve(), version=eossr_version, download_url=download_url, + publication_date=publication_date, + release_notes=release_notes, overwrite=True, ) diff --git a/eossr/utils.py b/eossr/utils.py index 4afed6c..b5a7d0a 100644 --- a/eossr/utils.py +++ b/eossr/utils.py @@ -127,6 +127,7 @@ def update_codemeta( modification_date=True, publication_date=True, download_url=None, + release_notes=None, overwrite=True, ): """ @@ -142,6 +143,8 @@ def update_codemeta( If True, updates the publication date with today's :param download_url: str Download URL for the software + :param release_notes: str + release notes. If None, does not update. :param overwrite: bool If True, overwrites the codemeta file """ @@ -163,6 +166,9 @@ def update_codemeta( metadata['version'] = f"v{version}" metadata['softwareVersion'] = f"v{version}" + if release_notes is not None: + metadata['releaseNotes'] = release_notes + if overwrite: with open(codemeta_path, 'w') as file: json.dump(metadata, file, indent=4) -- GitLab From 2bec4c1ee7db8dc3324601d431a8685779f894c4 Mon Sep 17 00:00:00 2001 From: Vuillaume Date: Wed, 4 May 2022 09:40:26 +0000 Subject: [PATCH 02/15] Auto-update codemeta.json [skip ci] --- codemeta.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/codemeta.json b/codemeta.json index 2d957f6..b9ba7f8 100644 --- a/codemeta.json +++ b/codemeta.json @@ -4,8 +4,8 @@ "name": "eossr", "description": "

The ESCAPE OSSR library

The eOSSR Python library gathers all the developments made for the OSSR. In particular, it includes:- an API to programmatically access the OSSR, retrieve records and publish content- functions to map and crosswalk metadata between the CodeMeta schema adopted for the OSSR and Zenodo internal schema- functions to help developers automatically contribute to the OSSR, in particular using their continuous integration (see also code snippets)

Code: https://gitlab.in2p3.fr/escape2020/wp3/eossrDocumentation: https://escape2020.pages.in2p3.fr/wp3/eossr/

\"\"\"\"\"CII\"\"\"\"\"\"

Former stable versions

Install

Commands to be run in your terminal.

For users

pip install eossr

You can also run it with docker:

docker run -it gitlab-registry.in2p3.fr/escape2020/wp3/eossr:latest

Visit our registry to see the available docker containers.

Note that latest tag always point to the latest stable released container.

For developers

git clone https://gitlab.in2p3.fr/escape2020/wp3/eossr.gitpip install -e "./eossr"

Running tests

To run tests locally, run:

pip install -e "./eossr[tests]"pytest eossr

Some tests will be skiped if SANDBOX_ZENODO_TOKEN is not defined in your environment variables.If you want to run these tests, you will need to create a sandbox zenodo token and add it to your env:

export SANDBOX_ZENODO_TOKEN="your_sandbox_token"

License

See LICENSE

Cite

To cite this library, use the cite section in the Zenodo page (rightcolumn, below the Versions section).

", "license": "https://spdx.org/licenses/MIT", - "version": "v0.7.dev32+g33d2f4f", - "softwareVersion": "v0.7.dev32+g33d2f4f", + "version": "v0.7.dev15+gef713d7", + "softwareVersion": "v0.7.dev15+gef713d7", "codeRepository": "https://gitlab.in2p3.fr/escape2020/wp3/eossr", "developmentStatus": "active", "isAccessibleForFree": true, @@ -43,8 +43,8 @@ "zenodo" ], "runtimePlatform": "Python 3", - "downloadUrl": "https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/archive/v0.7.dev32+g33d2f4f/eossr-v0.7.dev32+g33d2f4f.zip", - "releaseNotes": "eossr v0.6 Minor bug fixes and documentation improvements. Full changelog: https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/releases/v0.6", + "downloadUrl": "", + "releaseNotes": "", "dateCreated": "2021-08-31", "datePublished": "2022-05-04", "dateModified": "2022-05-04", @@ -115,4 +115,4 @@ } ], "funding": "824064" -} +} \ No newline at end of file -- GitLab From 7f51cc3b9c6446ff0c0f9dbe1d37397f67e28192 Mon Sep 17 00:00:00 2001 From: Vuillaume Date: Wed, 4 May 2022 09:40:34 +0000 Subject: [PATCH 03/15] Update .gitlab-ci-update-codemeta.yml --- .gitlab-ci-update-codemeta.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci-update-codemeta.yml b/.gitlab-ci-update-codemeta.yml index 7bb1cb7..9499ddf 100644 --- a/.gitlab-ci-update-codemeta.yml +++ b/.gitlab-ci-update-codemeta.yml @@ -28,7 +28,7 @@ update_codemeta: # setuptools_scm needs to be installed before or it can't be used to determine eossr version during install - pip install setuptools_scm - pip install . - - python eossr/scripts/update_codemeta_eossr.py -c codemeta.json + - python eossr/scripts/update_codemeta_eossr.py -c codemeta.json --no-release - cat codemeta.json # Add all generated files to Git - git add codemeta.json -- GitLab From f2697a55f605f43adff2ec65300fac21b5e31ba0 Mon Sep 17 00:00:00 2001 From: Vuillaume Date: Wed, 4 May 2022 09:40:49 +0000 Subject: [PATCH 04/15] Auto-update codemeta.json [skip ci] --- codemeta.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/codemeta.json b/codemeta.json index b9ba7f8..7b04de2 100644 --- a/codemeta.json +++ b/codemeta.json @@ -4,8 +4,8 @@ "name": "eossr", "description": "

The ESCAPE OSSR library

The eOSSR Python library gathers all the developments made for the OSSR. In particular, it includes:- an API to programmatically access the OSSR, retrieve records and publish content- functions to map and crosswalk metadata between the CodeMeta schema adopted for the OSSR and Zenodo internal schema- functions to help developers automatically contribute to the OSSR, in particular using their continuous integration (see also code snippets)

Code: https://gitlab.in2p3.fr/escape2020/wp3/eossrDocumentation: https://escape2020.pages.in2p3.fr/wp3/eossr/

\"\"\"\"\"CII\"\"\"\"\"\"

Former stable versions

  • v0.6: \"DOI\"
  • v0.5: \"DOI\"
  • v0.4: \"DOI\"
  • v0.3.3: \"\"
  • v0.2 : \"\"

Install

Commands to be run in your terminal.

For users

pip install eossr

You can also run it with docker:

docker run -it gitlab-registry.in2p3.fr/escape2020/wp3/eossr:latest

Visit our registry to see the available docker containers.

Note that latest tag always point to the latest stable released container.

For developers

git clone https://gitlab.in2p3.fr/escape2020/wp3/eossr.gitpip install -e "./eossr"

Running tests

To run tests locally, run:

pip install -e "./eossr[tests]"pytest eossr

Some tests will be skiped if SANDBOX_ZENODO_TOKEN is not defined in your environment variables.If you want to run these tests, you will need to create a sandbox zenodo token and add it to your env:

export SANDBOX_ZENODO_TOKEN="your_sandbox_token"

License

See LICENSE

Cite

To cite this library, use the cite section in the Zenodo page (rightcolumn, below the Versions section).

", "license": "https://spdx.org/licenses/MIT", - "version": "v0.7.dev15+gef713d7", - "softwareVersion": "v0.7.dev15+gef713d7", + "version": "v0.7.dev17+g7f51cc3", + "softwareVersion": "v0.7.dev17+g7f51cc3", "codeRepository": "https://gitlab.in2p3.fr/escape2020/wp3/eossr", "developmentStatus": "active", "isAccessibleForFree": true, @@ -43,7 +43,7 @@ "zenodo" ], "runtimePlatform": "Python 3", - "downloadUrl": "", + "downloadUrl": "https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/archive/v0.7.dev17+g7f51cc3/eossr-v0.7.dev17+g7f51cc3.zip", "releaseNotes": "", "dateCreated": "2021-08-31", "datePublished": "2022-05-04", -- GitLab From 8df7b576f4797d021f7007631fb8a1575375f561 Mon Sep 17 00:00:00 2001 From: Vuillaume Date: Mon, 11 Jul 2022 16:19:45 +0000 Subject: [PATCH 05/15] Update .gitlab-ci-update-codemeta.yml --- .gitlab-ci-update-codemeta.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci-update-codemeta.yml b/.gitlab-ci-update-codemeta.yml index afe8b8e..91f2213 100644 --- a/.gitlab-ci-update-codemeta.yml +++ b/.gitlab-ci-update-codemeta.yml @@ -12,9 +12,6 @@ update_codemeta: - only: - - $CI_DEFAULT_BRANCH - - tags stage: update_codemeta image: gitlab-registry.in2p3.fr/escape2020/wp3/eossr:dev before_script: @@ -50,3 +47,6 @@ update_codemeta: echo https://${GITLAB_USERNAME}:${GITLAB_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git git push https://${GITLAB_USERNAME}:${GITLAB_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git -o ci.skip fi + only: + # - $CI_DEFAULT_BRANCH + - tags -- GitLab From dc70f84afd4acc5dcff35f9bf3c44f9f5daf327e Mon Sep 17 00:00:00 2001 From: Vuillaume Date: Mon, 11 Jul 2022 16:20:26 +0000 Subject: [PATCH 06/15] Update .gitlab-ci.yml --- .gitlab-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bce39c3..1e07827 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,14 +1,14 @@ stages: - install - test - - update_codemeta - - test_codemeta +# - update_codemeta +# - test_codemeta - build_containers - zenodo - deploy_pages - pypi_publish -include: '.gitlab-ci-update-codemeta.yml' +# include: '.gitlab-ci-update-codemeta.yml' .junit_template: &junit_definition artifacts: -- GitLab From f0fd8e475409957faecf185b177e979cc08ac70b Mon Sep 17 00:00:00 2001 From: Vuillaume Date: Mon, 11 Jul 2022 16:27:37 +0000 Subject: [PATCH 07/15] Update .gitlab-ci.yml --- .gitlab-ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1e07827..05804e5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,14 +1,14 @@ stages: - install - test -# - update_codemeta -# - test_codemeta + - update_codemeta + - test_codemeta - build_containers - zenodo - deploy_pages - pypi_publish -# include: '.gitlab-ci-update-codemeta.yml' +include: '.gitlab-ci-update-codemeta.yml' .junit_template: &junit_definition artifacts: @@ -106,7 +106,7 @@ build_docker_main: --dockerfile "${CI_PROJECT_DIR}/Dockerfile" --destination "${CI_REGISTRY_IMAGE}:dev" only: - - $CI_DEFAULT_BRANCH + - master deploy_zenodo: @@ -143,7 +143,7 @@ pages: paths: - public only: - - $CI_DEFAULT_BRANCH + - master pypi_publish: -- GitLab From ccff4f4c14f12b8ee11091fddf127a21b250d157 Mon Sep 17 00:00:00 2001 From: Vuillaume Date: Mon, 11 Jul 2022 16:27:53 +0000 Subject: [PATCH 08/15] Update .gitlab-ci-update-codemeta.yml --- .gitlab-ci-update-codemeta.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci-update-codemeta.yml b/.gitlab-ci-update-codemeta.yml index 91f2213..5c38a40 100644 --- a/.gitlab-ci-update-codemeta.yml +++ b/.gitlab-ci-update-codemeta.yml @@ -48,5 +48,5 @@ update_codemeta: git push https://${GITLAB_USERNAME}:${GITLAB_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git -o ci.skip fi only: - # - $CI_DEFAULT_BRANCH + - master - tags -- GitLab From 86dcf63ac232c73de533dcbda5d67af5f8cf5f5a Mon Sep 17 00:00:00 2001 From: Vuillaume Date: Mon, 11 Jul 2022 22:01:16 +0000 Subject: [PATCH 09/15] mark tests requiring token --- eossr/scripts/tests/test_scripts.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eossr/scripts/tests/test_scripts.py b/eossr/scripts/tests/test_scripts.py index 6aeecb7..57c1a56 100644 --- a/eossr/scripts/tests/test_scripts.py +++ b/eossr/scripts/tests/test_scripts.py @@ -50,6 +50,7 @@ def test_help_all_scripts(script): run_script(script, "--help") +@pytest.mark.skipif(os.getenv('SANDBOX_ZENODO_TOKEN') is None, reason="SANDBOX_ZENODO_TOKEN not defined") def test_eossr_upload_repository(tmpdir): path_test_filename = Path(tmpdir).joinpath('test.txt') Path(path_test_filename).write_text('Hello World') @@ -78,6 +79,7 @@ def test_eossr_metadata_validator_not_valid(): run_script('eossr-metadata-validator', path_test_codemeta, '--catch-all-errors') +@pytest.mark.skipif(os.getenv('SANDBOX_ZENODO_TOKEN') is None, reason="SANDBOX_ZENODO_TOKEN not defined") def test_user_entries_cleanup(): from eossr.scripts.zenodo_user_entries_cleanup import zenodo_cleanup -- GitLab From d08fdd8a5b739b5ad42987eb4275dbbd5e0d6d95 Mon Sep 17 00:00:00 2001 From: vuillaut Date: Tue, 12 Jul 2022 10:22:29 +0200 Subject: [PATCH 10/15] set if condition to not execute cells if token is None --- .../ossr_api-Upload_records_OSSR.ipynb | 223 ++++-------------- 1 file changed, 50 insertions(+), 173 deletions(-) diff --git a/examples/notebooks/ossr_api-Upload_records_OSSR.ipynb b/examples/notebooks/ossr_api-Upload_records_OSSR.ipynb index 30802c3..2e2e997 100644 --- a/examples/notebooks/ossr_api-Upload_records_OSSR.ipynb +++ b/examples/notebooks/ossr_api-Upload_records_OSSR.ipynb @@ -25,17 +25,12 @@ "execution_count": null, "id": "52aedbb2", "metadata": { - "execution": { - "iopub.execute_input": "2021-11-30T08:50:52.201170Z", - "iopub.status.busy": "2021-11-30T08:50:52.200443Z", - "iopub.status.idle": "2021-11-30T08:50:52.202813Z", - "shell.execute_reply": "2021-11-30T08:50:52.203237Z" - } + "tags": [] }, "outputs": [], "source": [ "import os\n", - "token = os.getenv('SANDBOX_ZENODO_TOKEN') # Replace with your own token" + "token = os.getenv('SANDBOX_ZENODO_TOKENN') # Replace with your own token" ] }, { @@ -43,12 +38,7 @@ "execution_count": null, "id": "6fcd7ef2", "metadata": { - "execution": { - "iopub.execute_input": "2021-11-30T08:50:52.207043Z", - "iopub.status.busy": "2021-11-30T08:50:52.206395Z", - "iopub.status.idle": "2021-11-30T08:50:52.420839Z", - "shell.execute_reply": "2021-11-30T08:50:52.421281Z" - } + "tags": [] }, "outputs": [], "source": [ @@ -81,16 +71,12 @@ "execution_count": null, "id": "83075f0b", "metadata": { - "execution": { - "iopub.execute_input": "2021-11-30T08:50:52.425468Z", - "iopub.status.busy": "2021-11-30T08:50:52.424845Z", - "iopub.status.idle": "2021-11-30T08:50:52.744593Z", - "shell.execute_reply": "2021-11-30T08:50:52.745263Z" - } + "tags": [] }, "outputs": [], "source": [ - "new_entry = z.create_new_entry()" + "if token:\n", + " new_entry = z.create_new_entry()" ] }, { @@ -109,12 +95,7 @@ "execution_count": null, "id": "22f8e2b2", "metadata": { - "execution": { - "iopub.execute_input": "2021-11-30T08:50:52.750572Z", - "iopub.status.busy": "2021-11-30T08:50:52.749736Z", - "iopub.status.idle": "2021-11-30T08:50:52.752129Z", - "shell.execute_reply": "2021-11-30T08:50:52.752625Z" - } + "tags": [] }, "outputs": [], "source": [ @@ -126,17 +107,13 @@ "execution_count": null, "id": "07fd3360", "metadata": { - "execution": { - "iopub.execute_input": "2021-11-30T08:50:52.756900Z", - "iopub.status.busy": "2021-11-30T08:50:52.756196Z", - "iopub.status.idle": "2021-11-30T08:50:52.758914Z", - "shell.execute_reply": "2021-11-30T08:50:52.759379Z" - } + "tags": [] }, "outputs": [], "source": [ - "status_new_entry = ZenodoHTTPStatus(new_entry.status_code, new_entry.json())\n", - "print(status_new_entry)" + "if token:\n", + " status_new_entry = ZenodoHTTPStatus(new_entry.status_code, new_entry.json())\n", + " print(status_new_entry)" ] }, { @@ -154,47 +131,20 @@ "execution_count": null, "id": "74351af6", "metadata": { - "execution": { - "iopub.execute_input": "2021-11-30T08:50:52.763517Z", - "iopub.status.busy": "2021-11-30T08:50:52.762849Z", - "iopub.status.idle": "2021-11-30T08:50:53.273350Z", - "shell.execute_reply": "2021-11-30T08:50:53.273940Z" - } + "tags": [] }, "outputs": [], "source": [ - "deposit_id = new_entry.json()['id']\n", - "upload_file = z.upload_file_entry(deposit_id, \n", - " name_file='codemeta.json', \n", - " path_file='../../codemeta.json')" + "if token:\n", + " deposit_id = new_entry.json()['id']\n", + " upload_file = z.upload_file_entry(deposit_id, \n", + " name_file='codemeta.json', \n", + " path_file='../../codemeta.json')\n", + " \n", + " status_upload = ZenodoHTTPStatus(upload_file.status_code, upload_file.json())\n", + " print(status_upload)" ] }, - { - "cell_type": "code", - "execution_count": null, - "id": "a836e493", - "metadata": { - "execution": { - "iopub.execute_input": "2021-11-30T08:50:53.279274Z", - "iopub.status.busy": "2021-11-30T08:50:53.278520Z", - "iopub.status.idle": "2021-11-30T08:50:53.281752Z", - "shell.execute_reply": "2021-11-30T08:50:53.282471Z" - } - }, - "outputs": [], - "source": [ - "status_upload = ZenodoHTTPStatus(upload_file.status_code, upload_file.json())\n", - "print(status_upload)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "7809adba", - "metadata": {}, - "outputs": [], - "source": [] - }, { "cell_type": "markdown", "id": "aadbd21e", @@ -210,12 +160,7 @@ "execution_count": null, "id": "c622d5c9", "metadata": { - "execution": { - "iopub.execute_input": "2021-11-30T08:50:53.287806Z", - "iopub.status.busy": "2021-11-30T08:50:53.286665Z", - "iopub.status.idle": "2021-11-30T08:50:53.289185Z", - "shell.execute_reply": "2021-11-30T08:50:53.289759Z" - } + "tags": [] }, "outputs": [], "source": [ @@ -227,12 +172,7 @@ "execution_count": null, "id": "d0b1af6d", "metadata": { - "execution": { - "iopub.execute_input": "2021-11-30T08:50:53.295388Z", - "iopub.status.busy": "2021-11-30T08:50:53.294450Z", - "iopub.status.idle": "2021-11-30T08:50:53.298204Z", - "shell.execute_reply": "2021-11-30T08:50:53.298819Z" - } + "tags": [] }, "outputs": [], "source": [ @@ -248,12 +188,7 @@ "execution_count": null, "id": "9f3cfedc", "metadata": { - "execution": { - "iopub.execute_input": "2021-11-30T08:50:53.302847Z", - "iopub.status.busy": "2021-11-30T08:50:53.302190Z", - "iopub.status.idle": "2021-11-30T08:50:53.437777Z", - "shell.execute_reply": "2021-11-30T08:50:53.438730Z" - } + "tags": [] }, "outputs": [], "source": [ @@ -266,46 +201,18 @@ "execution_count": null, "id": "7c37dc70", "metadata": { - "execution": { - "iopub.execute_input": "2021-11-30T08:50:53.447674Z", - "iopub.status.busy": "2021-11-30T08:50:53.446669Z", - "iopub.status.idle": "2021-11-30T08:50:53.804882Z", - "shell.execute_reply": "2021-11-30T08:50:53.805563Z" - } + "tags": [] }, "outputs": [], "source": [ "with open('.zenodo.json') as f:\n", " zenodo_metadata = json.load(f)\n", - "update_metadata_info = z.set_deposit_metadata(deposit_id, zenodo_metadata)" + "if token:\n", + " update_metadata_info = z.set_deposit_metadata(deposit_id, zenodo_metadata)\n", + " status_metadata = ZenodoHTTPStatus(update_metadata_info.status_code, update_metadata_info.json())\n", + " print(status_metadata)" ] }, - { - "cell_type": "code", - "execution_count": null, - "id": "ae6554d9", - "metadata": { - "execution": { - "iopub.execute_input": "2021-11-30T08:50:53.810641Z", - "iopub.status.busy": "2021-11-30T08:50:53.809836Z", - "iopub.status.idle": "2021-11-30T08:50:53.812428Z", - "shell.execute_reply": "2021-11-30T08:50:53.812947Z" - } - }, - "outputs": [], - "source": [ - "status_metadata = ZenodoHTTPStatus(update_metadata_info.status_code, update_metadata_info.json())\n", - "print(status_metadata)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "1f67832d", - "metadata": {}, - "outputs": [], - "source": [] - }, { "cell_type": "markdown", "id": "c6a4df85", @@ -322,17 +229,13 @@ "execution_count": null, "id": "4389a073", "metadata": { - "execution": { - "iopub.execute_input": "2021-11-30T08:50:53.824434Z", - "iopub.status.busy": "2021-11-30T08:50:53.823719Z", - "iopub.status.idle": "2021-11-30T08:50:53.826347Z", - "shell.execute_reply": "2021-11-30T08:50:53.826855Z" - } + "tags": [] }, "outputs": [], "source": [ - "new_record = Record(update_metadata_info.json())\n", - "new_record" + "if token:\n", + " new_record = Record(update_metadata_info.json())\n", + " new_record" ] }, { @@ -340,16 +243,12 @@ "execution_count": null, "id": "9f696410", "metadata": { - "execution": { - "iopub.execute_input": "2021-11-30T08:50:53.830708Z", - "iopub.status.busy": "2021-11-30T08:50:53.830076Z", - "iopub.status.idle": "2021-11-30T08:50:53.833035Z", - "shell.execute_reply": "2021-11-30T08:50:53.832540Z" - } + "tags": [] }, "outputs": [], "source": [ - "new_record.print_info()" + "if token:\n", + " new_record.print_info()" ] }, { @@ -365,16 +264,12 @@ "execution_count": null, "id": "f0328d01", "metadata": { - "execution": { - "iopub.execute_input": "2021-11-30T08:50:53.837299Z", - "iopub.status.busy": "2021-11-30T08:50:53.836702Z", - "iopub.status.idle": "2021-11-30T08:50:53.839038Z", - "shell.execute_reply": "2021-11-30T08:50:53.839457Z" - } + "tags": [] }, "outputs": [], "source": [ - "new_record.data['files']" + "if token:\n", + " new_record.data['files']" ] }, { @@ -390,16 +285,12 @@ "execution_count": null, "id": "7111b368", "metadata": { - "execution": { - "iopub.execute_input": "2021-11-30T08:50:53.843926Z", - "iopub.status.busy": "2021-11-30T08:50:53.843275Z", - "iopub.status.idle": "2021-11-30T08:50:53.845563Z", - "shell.execute_reply": "2021-11-30T08:50:53.845955Z" - } + "tags": [] }, "outputs": [], "source": [ - "new_record.data['metadata']" + "if token:\n", + " new_record.data['metadata']" ] }, { @@ -418,12 +309,7 @@ "execution_count": null, "id": "6a9f1f09", "metadata": { - "execution": { - "iopub.execute_input": "2021-11-30T08:50:53.849694Z", - "iopub.status.busy": "2021-11-30T08:50:53.848996Z", - "iopub.status.idle": "2021-11-30T08:50:53.851064Z", - "shell.execute_reply": "2021-11-30T08:50:53.851523Z" - } + "tags": [] }, "outputs": [], "source": [ @@ -438,12 +324,7 @@ "execution_count": null, "id": "a2a81e21", "metadata": { - "execution": { - "iopub.execute_input": "2021-11-30T08:50:53.854967Z", - "iopub.status.busy": "2021-11-30T08:50:53.854360Z", - "iopub.status.idle": "2021-11-30T08:50:53.856066Z", - "shell.execute_reply": "2021-11-30T08:50:53.856464Z" - } + "tags": [] }, "outputs": [], "source": [ @@ -455,16 +336,12 @@ "execution_count": null, "id": "a1562ae2", "metadata": { - "execution": { - "iopub.execute_input": "2021-11-30T08:50:53.861542Z", - "iopub.status.busy": "2021-11-30T08:50:53.859580Z", - "iopub.status.idle": "2021-11-30T08:50:54.408003Z", - "shell.execute_reply": "2021-11-30T08:50:54.408588Z" - } + "tags": [] }, "outputs": [], "source": [ - "erase_entry = z.erase_entry(deposit_id)" + "if token:\n", + " erase_entry = z.erase_entry(deposit_id)" ] }, { @@ -478,7 +355,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -492,15 +369,15 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.2" + "version": "3.10.4" }, "pycharm": { "stem_cell": { "cell_type": "raw", - "source": [], "metadata": { "collapsed": false - } + }, + "source": [] } } }, -- GitLab From 200e05808fd5a5af529c5cd6edcf124186601b35 Mon Sep 17 00:00:00 2001 From: vuillaume Date: Tue, 12 Jul 2022 08:44:19 +0000 Subject: [PATCH 11/15] Auto-update codemeta.json --- codemeta.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/codemeta.json b/codemeta.json index 336909c..4f1da47 100644 --- a/codemeta.json +++ b/codemeta.json @@ -4,8 +4,8 @@ "name": "eossr", "description": "

The ESCAPE OSSR library

The eOSSR Python library gathers all the developments made for the OSSR. In particular, it includes:- an API to programmatically access the OSSR, retrieve records and publish content- functions to map and crosswalk metadata between the CodeMeta schema adopted for the OSSR and Zenodo internal schema- functions to help developers automatically contribute to the OSSR, in particular using their continuous integration (see also code snippets)

Code: https://gitlab.in2p3.fr/escape2020/wp3/eossrDocumentation: https://escape2020.pages.in2p3.fr/wp3/eossr/

\"\"\"\"\"CII\"\"\"\"\"\"

Former stable versions

  • v0.6: \"DOI\"
  • v0.5: \"DOI\"
  • v0.4: \"DOI\"
  • v0.3.3: \"\"
  • v0.2 : \"\"

Install

Commands to be run in your terminal.

For users

pip install eossr

You can also run it with docker:

docker run -it gitlab-registry.in2p3.fr/escape2020/wp3/eossr:latest

Visit our registry to see the available docker containers.

Note that latest tag always point to the latest stable released container.

For developers

git clone https://gitlab.in2p3.fr/escape2020/wp3/eossr.gitpip install -e "./eossr"

Running tests

To run tests locally, run:

pip install -e "./eossr[tests]"pytest eossr

Some tests will be skiped if SANDBOX_ZENODO_TOKEN is not defined in your environment variables.If you want to run these tests, you will need to create a sandbox zenodo token and add it to your env:

export SANDBOX_ZENODO_TOKEN="your_sandbox_token"

License

See LICENSE

Cite

To cite this library, use the cite section in the Zenodo page (rightcolumn, below the Versions section).

", "license": "https://spdx.org/licenses/MIT", - "version": "v0.7.dev34+g7755847", - "softwareVersion": "v0.7.dev34+g7755847", + "version": "v0.7.dev52+gd08fdd8", + "softwareVersion": "v0.7.dev52+gd08fdd8", "codeRepository": "https://gitlab.in2p3.fr/escape2020/wp3/eossr", "developmentStatus": "active", "isAccessibleForFree": true, @@ -43,11 +43,11 @@ "zenodo" ], "runtimePlatform": "Python 3", - "downloadUrl": "https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/archive/v0.7.dev34+g7755847/eossr-v0.7.dev34+g7755847.zip", + "downloadUrl": "https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/archive/v0.7.dev52+gd08fdd8/eossr-v0.7.dev52+gd08fdd8.zip", "releaseNotes": "", "dateCreated": "2021-08-31", - "datePublished": "2022-06-30", - "dateModified": "2022-06-30", + "datePublished": "2022-07-12", + "dateModified": "2022-07-12", "operatingSystem": "", "maintainer": { "@type": "Person", @@ -115,4 +115,4 @@ } ], "funding": "824064" -} +} \ No newline at end of file -- GitLab From a643cc4db20da67b04b6a46e56729a4a1528d87d Mon Sep 17 00:00:00 2001 From: vuillaut Date: Tue, 12 Jul 2022 10:53:40 +0200 Subject: [PATCH 12/15] raise systemexit --- .../ossr_api-Upload_records_OSSR.ipynb | 75 +++++++++++-------- 1 file changed, 44 insertions(+), 31 deletions(-) diff --git a/examples/notebooks/ossr_api-Upload_records_OSSR.ipynb b/examples/notebooks/ossr_api-Upload_records_OSSR.ipynb index 2e2e997..59ba631 100644 --- a/examples/notebooks/ossr_api-Upload_records_OSSR.ipynb +++ b/examples/notebooks/ossr_api-Upload_records_OSSR.ipynb @@ -22,15 +22,36 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "52aedbb2", "metadata": { "tags": [] }, - "outputs": [], + "outputs": [ + { + "ename": "SystemExit", + "evalue": "You need to !", + "output_type": "error", + "traceback": [ + "An exception has occurred, use %tb to see the full traceback.\n", + "\u001b[0;31mSystemExit\u001b[0m\u001b[0;31m:\u001b[0m You need to !\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/Users/thomasvuillaume/opt/anaconda3/envs/escape/lib/python3.10/site-packages/IPython/core/interactiveshell.py:3406: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D.\n", + " warn(\"To exit: use 'exit', 'quit', or Ctrl-D.\", stacklevel=1)\n" + ] + } + ], "source": [ "import os\n", - "token = os.getenv('SANDBOX_ZENODO_TOKENN') # Replace with your own token" + "token = os.getenv('SANDBOX_ZENODO_TOKEN') # Replace with your own token\n", + "\n", + "if not token:\n", + " raise SystemExit(\"You need to use a token for that notebook!\")" ] }, { @@ -75,8 +96,7 @@ }, "outputs": [], "source": [ - "if token:\n", - " new_entry = z.create_new_entry()" + "new_entry = z.create_new_entry()" ] }, { @@ -111,9 +131,8 @@ }, "outputs": [], "source": [ - "if token:\n", - " status_new_entry = ZenodoHTTPStatus(new_entry.status_code, new_entry.json())\n", - " print(status_new_entry)" + "status_new_entry = ZenodoHTTPStatus(new_entry.status_code, new_entry.json())\n", + "print(status_new_entry)" ] }, { @@ -135,14 +154,13 @@ }, "outputs": [], "source": [ - "if token:\n", - " deposit_id = new_entry.json()['id']\n", - " upload_file = z.upload_file_entry(deposit_id, \n", - " name_file='codemeta.json', \n", - " path_file='../../codemeta.json')\n", - " \n", - " status_upload = ZenodoHTTPStatus(upload_file.status_code, upload_file.json())\n", - " print(status_upload)" + "deposit_id = new_entry.json()['id']\n", + "upload_file = z.upload_file_entry(deposit_id, \n", + " name_file='codemeta.json', \n", + " path_file='../../codemeta.json')\n", + "\n", + "status_upload = ZenodoHTTPStatus(upload_file.status_code, upload_file.json())\n", + "print(status_upload)" ] }, { @@ -207,10 +225,10 @@ "source": [ "with open('.zenodo.json') as f:\n", " zenodo_metadata = json.load(f)\n", - "if token:\n", - " update_metadata_info = z.set_deposit_metadata(deposit_id, zenodo_metadata)\n", - " status_metadata = ZenodoHTTPStatus(update_metadata_info.status_code, update_metadata_info.json())\n", - " print(status_metadata)" + "\n", + "update_metadata_info = z.set_deposit_metadata(deposit_id, zenodo_metadata)\n", + "status_metadata = ZenodoHTTPStatus(update_metadata_info.status_code, update_metadata_info.json())\n", + "print(status_metadata)" ] }, { @@ -233,9 +251,8 @@ }, "outputs": [], "source": [ - "if token:\n", - " new_record = Record(update_metadata_info.json())\n", - " new_record" + "new_record = Record(update_metadata_info.json())\n", + "new_record" ] }, { @@ -247,8 +264,7 @@ }, "outputs": [], "source": [ - "if token:\n", - " new_record.print_info()" + "new_record.print_info()" ] }, { @@ -268,8 +284,7 @@ }, "outputs": [], "source": [ - "if token:\n", - " new_record.data['files']" + "new_record.data['files']" ] }, { @@ -289,8 +304,7 @@ }, "outputs": [], "source": [ - "if token:\n", - " new_record.data['metadata']" + "new_record.data['metadata']" ] }, { @@ -340,8 +354,7 @@ }, "outputs": [], "source": [ - "if token:\n", - " erase_entry = z.erase_entry(deposit_id)" + "erase_entry = z.erase_entry(deposit_id)" ] }, { -- GitLab From 375149a77674c14b84c22015fc72a188e28baca7 Mon Sep 17 00:00:00 2001 From: vuillaume Date: Tue, 12 Jul 2022 08:58:07 +0000 Subject: [PATCH 13/15] Auto-update codemeta.json --- codemeta.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/codemeta.json b/codemeta.json index 4f1da47..4d5c302 100644 --- a/codemeta.json +++ b/codemeta.json @@ -4,8 +4,8 @@ "name": "eossr", "description": "

The ESCAPE OSSR library

The eOSSR Python library gathers all the developments made for the OSSR. In particular, it includes:- an API to programmatically access the OSSR, retrieve records and publish content- functions to map and crosswalk metadata between the CodeMeta schema adopted for the OSSR and Zenodo internal schema- functions to help developers automatically contribute to the OSSR, in particular using their continuous integration (see also code snippets)

Code: https://gitlab.in2p3.fr/escape2020/wp3/eossrDocumentation: https://escape2020.pages.in2p3.fr/wp3/eossr/

\"\"\"\"\"CII\"\"\"\"\"\"

Former stable versions

  • v0.6: \"DOI\"
  • v0.5: \"DOI\"
  • v0.4: \"DOI\"
  • v0.3.3: \"\"
  • v0.2 : \"\"

Install

Commands to be run in your terminal.

For users

pip install eossr

You can also run it with docker:

docker run -it gitlab-registry.in2p3.fr/escape2020/wp3/eossr:latest

Visit our registry to see the available docker containers.

Note that latest tag always point to the latest stable released container.

For developers

git clone https://gitlab.in2p3.fr/escape2020/wp3/eossr.gitpip install -e "./eossr"

Running tests

To run tests locally, run:

pip install -e "./eossr[tests]"pytest eossr

Some tests will be skiped if SANDBOX_ZENODO_TOKEN is not defined in your environment variables.If you want to run these tests, you will need to create a sandbox zenodo token and add it to your env:

export SANDBOX_ZENODO_TOKEN="your_sandbox_token"

License

See LICENSE

Cite

To cite this library, use the cite section in the Zenodo page (rightcolumn, below the Versions section).

", "license": "https://spdx.org/licenses/MIT", - "version": "v0.7.dev52+gd08fdd8", - "softwareVersion": "v0.7.dev52+gd08fdd8", + "version": "v0.7.dev55+ga0b54ec", + "softwareVersion": "v0.7.dev55+ga0b54ec", "codeRepository": "https://gitlab.in2p3.fr/escape2020/wp3/eossr", "developmentStatus": "active", "isAccessibleForFree": true, @@ -43,7 +43,7 @@ "zenodo" ], "runtimePlatform": "Python 3", - "downloadUrl": "https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/archive/v0.7.dev52+gd08fdd8/eossr-v0.7.dev52+gd08fdd8.zip", + "downloadUrl": "https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/archive/v0.7.dev55+ga0b54ec/eossr-v0.7.dev55+ga0b54ec.zip", "releaseNotes": "", "dateCreated": "2021-08-31", "datePublished": "2022-07-12", -- GitLab From a3b1f63425edce14310b1bb491a4ab46a3acd66e Mon Sep 17 00:00:00 2001 From: vuillaut Date: Tue, 12 Jul 2022 11:01:34 +0200 Subject: [PATCH 14/15] clear outpout --- .../ossr_api-Upload_records_OSSR.ipynb | 22 ++----------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/examples/notebooks/ossr_api-Upload_records_OSSR.ipynb b/examples/notebooks/ossr_api-Upload_records_OSSR.ipynb index 59ba631..2724f51 100644 --- a/examples/notebooks/ossr_api-Upload_records_OSSR.ipynb +++ b/examples/notebooks/ossr_api-Upload_records_OSSR.ipynb @@ -22,30 +22,12 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "52aedbb2", "metadata": { "tags": [] }, - "outputs": [ - { - "ename": "SystemExit", - "evalue": "You need to !", - "output_type": "error", - "traceback": [ - "An exception has occurred, use %tb to see the full traceback.\n", - "\u001b[0;31mSystemExit\u001b[0m\u001b[0;31m:\u001b[0m You need to !\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/Users/thomasvuillaume/opt/anaconda3/envs/escape/lib/python3.10/site-packages/IPython/core/interactiveshell.py:3406: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D.\n", - " warn(\"To exit: use 'exit', 'quit', or Ctrl-D.\", stacklevel=1)\n" - ] - } - ], + "outputs": [], "source": [ "import os\n", "token = os.getenv('SANDBOX_ZENODO_TOKEN') # Replace with your own token\n", -- GitLab From e5ddba6e4f68707642545b107ef69a26f6098392 Mon Sep 17 00:00:00 2001 From: vuillaume Date: Tue, 12 Jul 2022 11:57:10 +0000 Subject: [PATCH 15/15] Auto-update codemeta.json --- codemeta.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/codemeta.json b/codemeta.json index 4d5c302..eb74935 100644 --- a/codemeta.json +++ b/codemeta.json @@ -4,8 +4,8 @@ "name": "eossr", "description": "

The ESCAPE OSSR library

The eOSSR Python library gathers all the developments made for the OSSR. In particular, it includes:- an API to programmatically access the OSSR, retrieve records and publish content- functions to map and crosswalk metadata between the CodeMeta schema adopted for the OSSR and Zenodo internal schema- functions to help developers automatically contribute to the OSSR, in particular using their continuous integration (see also code snippets)

Code: https://gitlab.in2p3.fr/escape2020/wp3/eossrDocumentation: https://escape2020.pages.in2p3.fr/wp3/eossr/

\"\"\"\"\"CII\"\"\"\"\"\"

Former stable versions

  • v0.6: \"DOI\"
  • v0.5: \"DOI\"
  • v0.4: \"DOI\"
  • v0.3.3: \"\"
  • v0.2 : \"\"

Install

Commands to be run in your terminal.

For users

pip install eossr

You can also run it with docker:

docker run -it gitlab-registry.in2p3.fr/escape2020/wp3/eossr:latest

Visit our registry to see the available docker containers.

Note that latest tag always point to the latest stable released container.

For developers

git clone https://gitlab.in2p3.fr/escape2020/wp3/eossr.gitpip install -e "./eossr"

Running tests

To run tests locally, run:

pip install -e "./eossr[tests]"pytest eossr

Some tests will be skiped if SANDBOX_ZENODO_TOKEN is not defined in your environment variables.If you want to run these tests, you will need to create a sandbox zenodo token and add it to your env:

export SANDBOX_ZENODO_TOKEN="your_sandbox_token"

License

See LICENSE

Cite

To cite this library, use the cite section in the Zenodo page (rightcolumn, below the Versions section).

", "license": "https://spdx.org/licenses/MIT", - "version": "v0.7.dev55+ga0b54ec", - "softwareVersion": "v0.7.dev55+ga0b54ec", + "version": "v0.7.dev57+ga3b1f63", + "softwareVersion": "v0.7.dev57+ga3b1f63", "codeRepository": "https://gitlab.in2p3.fr/escape2020/wp3/eossr", "developmentStatus": "active", "isAccessibleForFree": true, @@ -43,7 +43,7 @@ "zenodo" ], "runtimePlatform": "Python 3", - "downloadUrl": "https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/archive/v0.7.dev55+ga0b54ec/eossr-v0.7.dev55+ga0b54ec.zip", + "downloadUrl": "https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/archive/v0.7.dev57+ga3b1f63/eossr-v0.7.dev57+ga3b1f63.zip", "releaseNotes": "", "dateCreated": "2021-08-31", "datePublished": "2022-07-12", -- GitLab