From 8baa5c52b9f9b994d455828fd01d3be84790ba64 Mon Sep 17 00:00:00 2001 From: Giovanni Pizzi Date: Wed, 14 Feb 2024 12:34:04 +0100 Subject: [PATCH] Cleaning up schema --- codes.yaml | 42 ++++++++++++++----------------- schemas/codes.schema.json | 2 +- schemas/codes_meta.schema.json | 2 +- schemas/metadata.schema.json | 4 +-- src/code_registry/metadata.py | 14 ----------- src/code_registry/util.py | 21 +++------------- src/mod/templates/main_index.html | 20 ++------------- src/mod/templates/singlepage.html | 29 ++++++++++----------- 8 files changed, 42 insertions(+), 92 deletions(-) diff --git a/codes.yaml b/codes.yaml index a12a3da..ca80c1e 100644 --- a/codes.yaml +++ b/codes.yaml @@ -2,21 +2,21 @@ YAMBO: categories: - ab-initio_engines - git_url: https://github.com/yambo-code/yambo.git metadata: description: | A FORTRAN/C code for Many-Body calculations in solid state and molecular physics. documentation_url: https://www.yambo-code.eu/wiki/index.php/Main_Page title: Yambo - logo: data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBwgHBgkIBwgKCgkLDRYPDQwMDRsUFRAWIB0iIiAdHx8kKDQsJCYxJx8fLT0tMTU3Ojo6Iys/RD84QzQ5OjcBCgoKDQwNGg8PGjclHyU3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3N//AABEIAHgAgAMBIgACEQEDEQH/xAAcAAACAgMBAQAAAAAAAAAAAAAGBwAFAgMEAQj/xABBEAABAwMBBAcFBQYEBwAAAAABAgMEAAURBhIhMUEHEyJRYXGBFDJCkaEzUmKSwRUjQ3KCsRay0fAIJCZTZNPx/8QAGQEAAwEBAQAAAAAAAAAAAAAAAAIDBAEF/8QAIxEAAwACAwACAQUAAAAAAAAAAAECAxEEITESQSITFDJRcf/aAAwDAQACEQMRAD8AeNSpUoAlSpUoA8NSuO63KDaoipVzmMxY6eLjywkZ9efhQpJ16qQrFgtD8pHKVM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BoZS5gHzFHMV5t1hteQSUjINC9wnWK7wi0m8Q85BQVuBGD64qwhSYLcRtJuEI4GM+0I/1pl8d9MonG+n0ZXSwtPrMiE8Y8kfGk4z50LXOxbaz+0rQ2+vm8werJ88bifOil272lkZcu0JPlIT+lVsjWtiigll5+Yv7rDRx8zgUtfD7YmT9L7aBZOl4rqx7NaZhPc692foAavrVoxzg+G4zXNDXE+Zruha0s81QS6+5CUfhkoKR+YZFXUd1qU2FxZbTyT8TTgUD8q5Kj6FxRhfjNtut0S3shMdtII599UmvZXV2nqQQVLVjdV37O9z7u+h/UduVKkxkOuNtthWVqcUEgDzNUaReklPp06MaRCsbZc+0eJWfLlVyqSTuTVDI1HYICEt+3ofUhOENxklwnHcRuqmn6zlvpKLRADAP8eUQpXokbh6mldxKJPNixr0+j61OthY31tqVgPFKaXb0uJO7NDVwsAXnCaPCkHjWhyMlVACjn6Z3ns1QSdOEE4TTuetyVcs1XvWZtXFNdOiOf06fiQD5iuBzTqAd0ZPyFPB7TzZ3hNcbunEn4aAEsLHs+6wE+QqG1KHwYpwq00OSa1HTP4aAFD+yVH4T6CsDYkLOCwMnmBim/8A4Z/DWadM/hoAUA09lJQUOFPMbav9a3s6Zb3f8sMd5GabqNNAcU10t6dSPhoDYq4+niMBKAPIVbRdNEkZTTLZsDaeKasGLQ2ngmgAjqVKlcOEqVKlAHhGa8KAeNSpQBgWkmsFR0HlmvalAGBipPLFY+yJqVKAJ7Gmp7InuzUqUAZCKj7tZJjoHLFe1KAMg0kVmEgcKlSgD//Z + sourcecode_url: https://github.com/yambo-code/yambo.git + logo: https://fresh.yambo-code.eu/wp-content/uploads/2023/02/yambo_logo_overlay.svg Quantum ESPRESSO: categories: - ab-initio_engines - git_url: https://gitlab.com/QEF/q-e metadata: description: | Quantum ESPRESSO is an integrated suite of open-source computer codes for quantum simulations of materials using state-of-the art electronic-structure techniques, based on density-functional theory, density-functional perturbation theory, and many-body perturbation theory, within the plane-wave pseudo-potential and projector-augmented-wave approaches + sourcecode_url: https://gitlab.com/QEF/q-e documentation_url: https://www.quantum-espresso.org/documentation/ title: Quantum ESPRESSO logo: https://www.quantum-espresso.org/wp-content/uploads/2022/03/quantum_ogo_ok.png @@ -25,32 +25,31 @@ ABINIT: categories: - ab-initio_engines - dmft - git_url: https://github.com/abinit/abinit metadata: description: | ABINIT is a software suite to calculate the optical, mechanical, vibrational, and other observable properties of materials. Starting from the quantum equations of density functional theory, you can build up to advanced applications with perturbation theories based on DFT, and many-body Green's functions (GW and DMFT). - documentation_url: https://www.abinit.org + sourcecode_url: https://github.com/abinit/abinit + homepage_url: https://www.abinit.org title: ABINIT logo: https://www.abinit.org/themes/abinit/logo-abinit-2015.svg WIEN2k: categories: - ab-initio_engines - hosted_on: http://susi.theochem.tuwien.ac.at metadata: description: | ABINIT is a software suite to calculate the optical, mechanical, vibrational, and other observable properties of materials. Starting from the quantum equations of density functional theory, you can build up to advanced applications with perturbation theories based on DFT, and many-body Green's functions (GW and DMFT). - documentation_url: http://susi.theochem.tuwien.ac.at + homepage_url: http://susi.theochem.tuwien.ac.at title: WIEN2k logo: http://susi.theochem.tuwien.ac.at/img/wien2k_logo_3.gif VASP: categories: - ab-initio_engines - hosted_on: https://www.vasp.at metadata: description: | The Vienna Ab initio Simulation Package (VASP) is a computer program for atomic scale materials modelling, e.g. electronic structure calculations and quantum-mechanical molecular dynamics, from first principles. + homepage_url: https://www.vasp.at documentation_url: https://www.vasp.at/wiki/index.php/LWANNIER90 title: VASP logo: https://www.vasp.at/wiki/images/vasp_logo_alpha.png @@ -59,12 +58,11 @@ pythtb: categories: - tb - berry - hosted_on: https://pypi.org/project/pythtb/ metadata: description: | Simple solver for tight binding models for use in condensed matter physics and materials science. - documentation_url: https://www.physics.rutgers.edu/pythtb/index.html - interface_docs_url: https://www.physics.rutgers.edu/pythtb/usage.html#pythtb.w90 + sourcecode_url: https://pypi.org/project/pythtb/ + documentation_url: https://www.physics.rutgers.edu/pythtb/usage.html#pythtb.w90 title: PythTB logo: https://www.physics.rutgers.edu/pythtb/_images/graphene.png @@ -72,22 +70,21 @@ tbmodels: categories: - tb - berry - git_url: https://github.com/Z2PackDev/TBmodels metadata: description: | Bmodels is a Python package for evaluating tight-binding models. It features methods for reading and writing tight-binding models to various formats, and evaluating the Hamiltonian and eigenvalues of the system. It is considerably faster than comparable packages, enabling it to handle first-principles derived tight-binding models. - documentation_url: https://tbmodels.greschd.ch/en/latest/tutorial.html - interface_docs_url: https://tbmodels.greschd.ch/en/latest/tutorial.html#id3 + sourcecode_url: https://github.com/Z2PackDev/TBmodels + documentation_url: https://tbmodels.greschd.ch/en/latest/tutorial.html#id3 title: TBmodels logo: https://tbmodels.greschd.ch/en/latest/_images/tbmodels_logo.jpg z2pack: categories: - berry - git_url: https://github.com/Z2PackDev/Z2Pack metadata: description: | Z2Pack automates the calculation of topological numbers of band-structures. It works with first-principles calculations (z2pack.fp), tight-binding models (z2pack.tb) and explicit Hamiltonian matrices (z2pack.hm). + sourcecode_url: https://github.com/Z2PackDev/Z2Pack documentation_url: https://z2pack.greschd.ch/ title: Z2Pack logo: https://z2pack.greschd.ch/en/latest/_static/z2_logo_150.png @@ -96,10 +93,10 @@ wanniertools: categories: - tb - berry - git_url: https://github.com/quanshengwu/wannier_tools metadata: description: | An open-source software package for novel topological materials. + sourcecode_url: https://github.com/quanshengwu/wannier_tools documentation_url: http://www.wanniertools.com/# title: WannierTools logo: https://github.com/quanshengwu/wannier_tools/raw/master/wt-logo.jpg @@ -108,12 +105,12 @@ wannierberri: categories: - tb - berry - git_url: https://github.com/wannier-berri/wannier-berri metadata: description: | A code to calculate different properties by means of Wannier interpolation: Berry curvature, orbital moment and derived properties. - documentation_url: https://wannier-berri.org - interface_docs_url: https://docs.wannier-berri.org/en/master/docs/system.html#id3 + sourcecode_url: https://github.com/wannier-berri/wannier-berri + homepage_url: https://wannier-berri.org + documentation_url: https://docs.wannier-berri.org/en/master/docs/system.html#id3 title: Wannier Berri logo: https://docs.wannier-berri.org/en/master/_static/Book.png @@ -121,10 +118,10 @@ strawberrypy: categories: - tb - berry - git_url: https://github.com/strawberrypy-developers/strawberrypy metadata: description: | StraWBerryPy (Single-poinT and local invaRiAnts for Wannier Berriologies in Python) is a Python package to calculate topological invariants and quantum-geometrical quantities in non-crystalline topological insulators. + sourcecode_url: https://github.com/strawberrypy-developers/strawberrypy documentation_url: https://strawberrypy.readthedocs.io/en/latest/ title: StraWBerryPy logo: https://strawberrypy.readthedocs.io/en/latest/_static/logo.png @@ -133,12 +130,11 @@ linres: categories: - tb - berry - hosted_on: https://bitbucket.org/zeleznyj/wannier-linear-response/src/master/ metadata: description: | Code for calculating linear response properties based on tight-binding Hamiltonians. It is mainly used with tight-binding Hamiltonians obtained from wannier90 or from the FPLO DFT code but any tight-binding can be used. A python program for generating sd models that is also interfaced to the linear response code is also included. The code utilizes Kubo formula with constant Gamma approximation to calculate conductivity and the anomalous Hall effect, spin Hall effect and the current induced spin-polarization, which gives rise to the spin-orbit torque. Other response quantities can be easily implemented. + sourcecode_url: https://bitbucket.org/zeleznyj/wannier-linear-response/src/master/ + homepage_url: https://bitbucket.org/zeleznyj/wannier-linear-response/wiki/Home documentation_url: https://bitbucket.org/zeleznyj/wannier-linear-response/wiki/Home title: linres logo: None - - diff --git a/schemas/codes.schema.json b/schemas/codes.schema.json index a11d912..75dd6ea 100644 --- a/schemas/codes.schema.json +++ b/schemas/codes.schema.json @@ -18,7 +18,7 @@ "type": "object", "additionalProperties": false, "properties": { - "git_url": { + "sourcecode_url": { "type": "string", "format": "uri", "qt-uri-protocols": [ diff --git a/schemas/codes_meta.schema.json b/schemas/codes_meta.schema.json index a87e89b..00a4803 100644 --- a/schemas/codes_meta.schema.json +++ b/schemas/codes_meta.schema.json @@ -32,7 +32,7 @@ "type": "object", "additionalProperties": false, "properties": { - "git_url": { + "sourcecode_url": { "type": "string", "format": "uri", "qt-uri-protocols": [ diff --git a/schemas/metadata.schema.json b/schemas/metadata.schema.json index 51bbde2..b013b63 100644 --- a/schemas/metadata.schema.json +++ b/schemas/metadata.schema.json @@ -7,7 +7,7 @@ "type": "object", "additionalProperties": false, "properties": { - "codename": { + "title": { "type": "string" }, "description": { @@ -24,7 +24,7 @@ "type": "string", "format": "uri" }, - "interface_docs_url": { + "documentation_url": { "type": "string", "format": "uri" }, diff --git a/src/code_registry/metadata.py b/src/code_registry/metadata.py index 67dd4fc..2ea5b20 100644 --- a/src/code_registry/metadata.py +++ b/src/code_registry/metadata.py @@ -23,24 +23,10 @@ def complete_metadata(code_name, metadata, git_url): def fetch_code_data(code_data, code_name): """Fetch additional data for the given code data.""" - # Get Git URL, fail build if git_url is not found or wrong - git_url = code_data.get("git_url", "") - hosted_on = util.get_hosted_on(git_url) if git_url else None - # Check if categories are specified, warn if not if "categories" not in code_data: logger.info(" >> WARNING: No categories specified.") - code_data["metadata"] = complete_metadata(code_name, code_data["metadata"], git_url) - if git_url: - code_data["gitinfo"] = util.get_git_branches(git_url) - if hosted_on: - code_data["hosted_on"] = hosted_on - - # Get logo URL, if it has been specified - if "logo" in code_data["metadata"]: - code_data["logo"] = code_data["metadata"]["logo"] - return code_data diff --git a/src/code_registry/util.py b/src/code_registry/util.py index 29b5939..788fbf4 100644 --- a/src/code_registry/util.py +++ b/src/code_registry/util.py @@ -17,21 +17,8 @@ def get_html_code_fname(code_name): return f"{simple_string}.html" -def get_hosted_on(url): - netloc = urlparse(url).netloc - - # Remove port (if any) - netloc = netloc.partition(":")[0] - - # Remove subdomains (this only works for domain suffixes of length 1!) - # TODO: fix it for domains like yyy.co.uk - netloc = ".".join(netloc.split(".")[-2:]) - - return netloc - - -def get_git_branches(git_url): - t, p = get_transport_and_path_from_url(git_url) +def get_git_branches(sourcecode_url): + t, p = get_transport_and_path_from_url(sourcecode_url) branches = t.get_refs(p) res = {} for key, value in branches.items(): @@ -39,8 +26,8 @@ def get_git_branches(git_url): return res -def get_git_author(git_url): - return urlparse(git_url).path.split("/")[1] +def get_git_author(sourcecode_url): + return urlparse(sourcecode_url).path.split("/")[1] def load_json(path: Path) -> dict: diff --git a/src/mod/templates/main_index.html b/src/mod/templates/main_index.html index 83bf54c..0e09b65 100644 --- a/src/mod/templates/main_index.html +++ b/src/mod/templates/main_index.html @@ -20,9 +20,9 @@

- - {# - {% if not loop.last %} -
- {% endif %} - #} {% endfor %} diff --git a/src/mod/templates/singlepage.html b/src/mod/templates/singlepage.html index 7d51865..f16142b 100644 --- a/src/mod/templates/singlepage.html +++ b/src/mod/templates/singlepage.html @@ -12,8 +12,8 @@

General information

- {% if metadata.git_url %} -
+ {% if metadata.homepage_url %} +

+ Code homepage: {{ metadata.homepage_url }}

- Source code: Go to the code source code -

-
{% endif %} - {% if metadata.external_url %} + {% if metadata.documentation_url %}

- Code homepage: Go to code homepage + Full documentation: {{ metadata.documentation_url }}

{% endif %} - {% if metadata.documentation_url %} -

- Documentation: Go to code documentation + {% if metadata.sourcecode_url %} +

+ Source code: {{ metadata.sourcecode_url }} +

+
{% endif %}

Detailed information

- {% if metadata %} + {% if metadata.description %}
-

- {% if hosted_on %} Source code: {{ hosted_on }}{% endif %} -

Short description: {{ metadata.description }}