diff --git a/.gitlab-ci-update-codemeta.yml b/.gitlab-ci-update-codemeta.yml index afe8b8e30be0c813d36ddbc33504f2fe0416446e..5c38a4032bd81196ac7cfde6508759e0ab7e82aa 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: + - master + - tags diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bce39c3c158852759f8015d4c342d0a0f2b43ba2..05804e5b8ebf1de8a794a2263b738b34e0da1cbc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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: diff --git a/codemeta.json b/codemeta.json index 336909cf82f58c6a5aa22b8439a1031e4197013e..eb7493588bff73434ce5de664bcaa17b87ce1a02 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.dev34+g7755847", - "softwareVersion": "v0.7.dev34+g7755847", + "version": "v0.7.dev57+ga3b1f63", + "softwareVersion": "v0.7.dev57+ga3b1f63", "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.dev57+ga3b1f63/eossr-v0.7.dev57+ga3b1f63.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 diff --git a/eossr/scripts/tests/test_scripts.py b/eossr/scripts/tests/test_scripts.py index 6aeecb7e5da950972ea5c86c6bdee71de780f7af..57c1a5672be911b1edc1a1afb4bf588198750798 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 diff --git a/examples/notebooks/ossr_api-Upload_records_OSSR.ipynb b/examples/notebooks/ossr_api-Upload_records_OSSR.ipynb index 30802c336a644c6368bf2f31b8508cc3a60685d6..2724f51b6a3162818631c85ee29628fb48161495 100644 --- a/examples/notebooks/ossr_api-Upload_records_OSSR.ipynb +++ b/examples/notebooks/ossr_api-Upload_records_OSSR.ipynb @@ -25,17 +25,15 @@ "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_TOKEN') # Replace with your own token\n", + "\n", + "if not token:\n", + " raise SystemExit(\"You need to use a token for that notebook!\")" ] }, { @@ -43,12 +41,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,12 +74,7 @@ "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": [ @@ -109,12 +97,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,12 +109,7 @@ "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": [ @@ -154,47 +132,19 @@ "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')" - ] - }, - { - "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": [ + " 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": "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)" - ] - }, - { - "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": [ + "\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": "1f67832d", - "metadata": {}, - "outputs": [], - "source": [] - }, { "cell_type": "markdown", "id": "c6a4df85", @@ -322,12 +229,7 @@ "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": [ @@ -340,12 +242,7 @@ "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": [ @@ -365,12 +262,7 @@ "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": [ @@ -390,12 +282,7 @@ "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": [ @@ -418,12 +305,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 +320,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,12 +332,7 @@ "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": [ @@ -478,7 +350,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -492,15 +364,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": [] } } },