Skip to content
Snippets Groups Projects
Commit 9c85ef17 authored by Vuillaume's avatar Vuillaume
Browse files

update codemeta for today's date and description from readme

parent 66302d34
Branches
Tags
1 merge request!109update codemeta for today's date and description from readme
{
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
"@type": "SoftwareSourceCode",
"name": "eossr",
"description": "ESCAPE OSSR library",
"license": "https://spdx.org/licenses/MIT",
"softwareVersion": "v0.3.3",
"codeRepository": "https://gitlab.in2p3.fr/escape2020/wp3/eossr",
"developmentStatus": "active",
"isAccessibleForFree": true,
"isPartOf": [
"https://gitlab.in2p3.fr/escape2020",
"https://projectescape.eu/"
],
"contIntegration": "https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/pipelines",
"buildInstructions": "https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/blob/master/README.md",
"issueTracker": "https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/issues",
"readme": "https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/blob/master/README.md",
"programmingLanguage": [
{
"@type": "ComputerLanguage",
"name": "Python",
"url": "https://www.python.org/"
}
],
"softwareRequirements": [
{
"@type": "SoftwareApplication",
"identifier": "requests",
"name": "requests",
"softwareVersion": ">=3.6"
{
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
"@type": "SoftwareSourceCode",
"name": "eossr",
"description": "<p><img alt=\"eOSSR\" src=\"docs/images/eossr_logo.png\" /></p><h2>The ESCAPE OSSR library</h2><p>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)</p><p>Code: <a href=\"https://gitlab.in2p3.fr/escape2020/wp3/eossr\">https://gitlab.in2p3.fr/escape2020/wp3/eossr</a> <br />Documentation: <a href=\"https://escape2020.pages.in2p3.fr/wp3/eossr/\">https://escape2020.pages.in2p3.fr/wp3/eossr/</a></p><p><a href=\"https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/commits/master\"><img alt=\"pipeline status\" src=\"https://gitlab.in2p3.fr/escape2020/wp3/eossr/badges/master/pipeline.svg\" /></a><a href=\"https://opensource.org/licenses/MIT\"><img alt=\"License: MIT\" src=\"https://img.shields.io/badge/License-MIT-blue.svg\" /></a><a href=\"https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/commits/master\"><img alt=\"coverage report\" src=\"https://gitlab.in2p3.fr/escape2020/wp3/eossr/badges/master/coverage.svg\" /></a><a href=\"https://doi.org/10.5281/zenodo.5524912\"><img alt=\"DOI\" src=\"https://zenodo.org/badge/DOI/10.5281/zenodo.5524912.svg\" /></a><a href=\"https://mybinder.org/v2/git/https%3A%2F%2Fgitlab.in2p3.fr%2Fescape2020%2Fwp3%2Feossr/HEAD\"><img alt=\"Binder\" src=\"https://mybinder.org/badge_logo.svg\" /></a></p><h2>Stable versions</h2><ul><li>v0.3.3: <a href=\"https://doi.org/10.5281/zenodo.5592584\"><img alt=\"DOI\" src=\"https://zenodo.org/badge/DOI/10.5281/zenodo.5592584.svg\" /></a></li><li>v0.2 : <a href=\"https://doi.org/10.5281/zenodo.5524913\"><img alt=\"DOI\" src=\"https://zenodo.org/badge/DOI/10.5281/zenodo.5524913.svg\" /></a></li></ul><h2>Install</h2><p>Commands to be run in your terminal.</p><h3>For users</h3><pre><code>pip install eossr</code></pre><p>You can also run it with docker:</p><pre><code>docker run -it gitlab-registry.in2p3.fr/escape2020/wp3/eossr:latest</code></pre><p><a href=\"https://gitlab.in2p3.fr/escape2020/wp3/eossr/container_registry\">Visit our registry</a> to see the available docker containers.</p><p>Note that <code>latest</code> tag always point to the latest stable released container.</p><h3>For developers</h3><pre><code>git clone https://gitlab.in2p3.fr/escape2020/wp3/eossr.gitpip install -e eossr</code></pre><h4>Running tests</h4><p>To run tests locally, run:</p><pre><code>pip install pytestpytest eossr</code></pre><p>Some tests will be skiped if <code>SANDBOX_ZENODO_TOKEN</code> is not defined in your environment variables.If you want to run these tests, you will need to create a <a href=\"https://sandbox.zenodo.org/account/settings/applications/tokens/new/\">sandbox zenodo token</a> and add it to your env:</p><pre><code>export SANDBOX_ZENODO_TOKEN=&quot;your_sandbox_token&quot;</code></pre><h2>Cite</h2><p>To cite this library, use the cite module in <a href=\"https://zenodo.org/record/5524913#.YWBq79kzZB0\">the Zenodo page</a>.</p>",
"license": "https://spdx.org/licenses/MIT",
"softwareVersion": "v0.3.3",
"codeRepository": "https://gitlab.in2p3.fr/escape2020/wp3/eossr",
"developmentStatus": "active",
"isAccessibleForFree": true,
"isPartOf": [
"https://gitlab.in2p3.fr/escape2020",
"https://projectescape.eu/"
],
"contIntegration": "https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/pipelines",
"buildInstructions": "https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/blob/master/README.md",
"issueTracker": "https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/issues",
"readme": "https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/blob/master/README.md",
"programmingLanguage": [
{
"@type": "ComputerLanguage",
"name": "Python",
"url": "https://www.python.org/"
}
],
"softwareRequirements": [
{
"@type": "SoftwareApplication",
"identifier": "requests",
"name": "requests",
"softwareVersion": ">=3.6"
},
{
"@type": "SoftwareApplication",
"identifier": "pytest",
"name": "pytest",
"softwareVersion": ">=5.4.2"
}
],
"keywords": [
"jupyter-notebook"
],
"runtimePlatform": "",
"downloadUrl": "",
"installUrl": "",
"releaseNotes": "Bug fix in the CI and much lighter docker container",
"dateCreated": "2021-08-31",
"datePublished": "2021-12-02",
"dateModified": "2021-12-02",
"operatingSystem": "",
"maintainer": {
"@type": "Person",
"@id": "https://orcid.org/0000-0003-2224-4594",
"givenName": "Enrique",
"familyName": "Garcia",
"email": "garcia@lapp.in2p3.fr",
"affiliation": {
"@type": "Organization",
"name": "Univ. Savoie Mont Blanc, CNRS, LAPP"
}
},
{
"@type": "SoftwareApplication",
"identifier": "pytest",
"name": "pytest",
"softwareVersion": ">=5.4.2"
}
],
"keywords": ["jupyter-notebook"],
"runtimePlatform": "",
"downloadUrl": "",
"installUrl": "",
"releaseNotes": "Bug fix in the CI and much lighter docker container",
"dateCreated": "2021-08-31",
"datePublished": "2021-10-22",
"dateModified": "2021-10-22",
"operatingSystem": "",
"maintainer": {
"@type": "Person",
"@id": "https://orcid.org/0000-0003-2224-4594",
"givenName": "Enrique",
"familyName": "Garcia",
"email": "garcia@lapp.in2p3.fr",
"affiliation": {
"@type": "Organization",
"name": "Univ. Savoie Mont Blanc, CNRS, LAPP"
}
},
"author": [
{
"@type": "Person",
"@id": "https://orcid.org/0000-0002-5686-2078",
"givenName": "Thomas",
"familyName": "Vuillaume",
"email": "vuillaume@lapp.in2p3.fr",
"affiliation": {
"@type": "Organization",
"name": "Univ. Savoie Mont Blanc, CNRS, LAPP"
}
},
{
"@type": "Person",
"@id": "https://orcid.org/0000-0003-2224-4594",
"givenName": "Enrique",
"familyName": "Garcia",
"email": "garcia@lapp.in2p3.fr",
"affiliation": {
"@type": "Organization",
"name": "Univ. Savoie Mont Blanc, CNRS, LAPP"
}
}
],
"contributor": [
{
"@type": "Person",
"@id": "https://orcid.org/0000-0002-5321-8404",
"givenName": "Christian",
"familyName": "Tacke",
"affiliation": {
"@type": "Organization",
"name": "GSI"
}
},
{
"@type": "Person",
"@id": "https://orcid.org/0000-0001-7821-8673",
"givenName": "Tamás",
"familyName": "Gál",
"email": "tamas.gal@fau.de",
"affiliation": {
"@type": "Organization",
"name": "ECAP, FAU (Nuremberg, Germany)"
}
}
],
"funder":[
{
"@type": "Organization",
"name": "European Commission",
"@id": "https://doi.org/10.13039/501100000780"
}
],
"funding": "824064"
}
"author": [
{
"@type": "Person",
"@id": "https://orcid.org/0000-0002-5686-2078",
"givenName": "Thomas",
"familyName": "Vuillaume",
"email": "vuillaume@lapp.in2p3.fr",
"affiliation": {
"@type": "Organization",
"name": "Univ. Savoie Mont Blanc, CNRS, LAPP"
}
},
{
"@type": "Person",
"@id": "https://orcid.org/0000-0003-2224-4594",
"givenName": "Enrique",
"familyName": "Garcia",
"email": "garcia@lapp.in2p3.fr",
"affiliation": {
"@type": "Organization",
"name": "Univ. Savoie Mont Blanc, CNRS, LAPP"
}
}
],
"contributor": [
{
"@type": "Person",
"@id": "https://orcid.org/0000-0002-5321-8404",
"givenName": "Christian",
"familyName": "Tacke",
"affiliation": {
"@type": "Organization",
"name": "GSI"
}
},
{
"@type": "Person",
"@id": "https://orcid.org/0000-0001-7821-8673",
"givenName": "Tam\u00e1s",
"familyName": "G\u00e1l",
"email": "tamas.gal@fau.de",
"affiliation": {
"@type": "Organization",
"name": "ECAP, FAU (Nuremberg, Germany)"
}
}
],
"funder": [
{
"@type": "Organization",
"name": "European Commission",
"@id": "https://doi.org/10.13039/501100000780"
}
],
"funding": "824064"
}
\ No newline at end of file
import argparse
from pathlib import Path
from eossr.utils import update_codemeta
from eossr import ROOT_DIR
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="Update Codemeta")
parser.add_argument('--codemeta_path', '-c', type=str,
dest='codemeta_path',
help='Path to codemeta.json',
default=Path(ROOT_DIR).joinpath('codemeta.json'),
required=False)
args = parser.parse_args()
html = update_codemeta(codemeta_path=args.codemeta_path)
......@@ -43,3 +43,13 @@ def test_zip_repository():
assert 'test_zip_repo.zip' not in [Path(f).name for f in zo.namelist()]
assert os.path.join(os.path.join(os.path.basename(tmpdir), os.path.basename(subtmpdir)),
os.path.basename(tmpfile)) in zo.namelist()
def test_readme_to_html():
from eossr.utils import readme_to_html
readme_to_html()
def test_update_codemeta():
from eossr.utils import update_codemeta
update_codemeta(overwrite=False)
\ No newline at end of file
......@@ -4,6 +4,9 @@ import shutil
from io import BytesIO
from zipfile import ZipFile
from pathlib import Path
from markdown import markdown
from datetime import date
from . import ROOT_DIR
__all__ = [
'ZipUrl',
......@@ -95,3 +98,41 @@ def zip_repository(directory, zip_filename=None):
print(f"Zipping done: {zip_filename}.zip")
return zip_filename + '.zip'
def readme_to_html(readme_path=Path(ROOT_DIR).joinpath('README.md').as_posix()):
"""
Read README.md and return html transcript
:param readme_path: str
:return: str
text in readme converted to html
"""
html = markdown(open(readme_path).read(), extensions=['fenced_code'])
html = html.replace('\n', '')
return html
def update_codemeta(codemeta_path=Path(ROOT_DIR).joinpath('codemeta.json').as_posix(), published=True, overwrite=True):
"""
Update codemeta.json file for dates and description based on README.md
:param codemeta_path: Path
:param published: boolean
if True, datePublished is updated.
:param overwrite: boolean
overwrite codemeta file
:return:
"""
with open(codemeta_path) as file:
metadata = json.load(file)
metadata['description'] = readme_to_html()
metadata['dateModified'] = f'{date.today()}'
if published:
metadata['datePublished'] = f'{date.today()}'
if overwrite:
with open(codemeta_path, 'w') as file:
json.dump(metadata, file, indent=4)
return metadata
......@@ -33,6 +33,7 @@ setup(
install_requires=[
"requests",
"bs4",
"markdown"
],
packages=find_packages(),
scripts=['eossr/scripts/gitlab_prepare_upload_zenodo.sh'],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment