From 2b6b4ea99569522c48c665f42321eda8d5bcd9f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Sch=C3=B6ppach?= <163308053+fabianschoeppach@users.noreply.github.com> Date: Wed, 29 May 2024 14:37:59 +0000 Subject: [PATCH] Fix: Refactor plugin name and module to uibk-plugin --- .cruft.json | 6 +++--- README.md | 12 ++++++------ docs/how_to/contribute_to_this_plugin.md | 4 ++-- docs/how_to/install_this_plugin.md | 2 +- docs/index.md | 2 +- mkdocs.yml | 6 +++--- move_template_files.sh | 4 ++-- pyproject.toml | 14 +++++++------- .../__init__.py | 0 .../parsers/XRFparser.py | 4 ++-- .../parsers/__init__.py | 6 +++--- .../parsers/myparser.py | 2 +- .../schema_packages/XRFreader.py | 10 +++++----- .../schema_packages/XRFschema.py | 4 ++-- .../schema_packages/__init__.py | 4 ++-- .../schema_packages/mypackage.py | 2 +- tests/data/test.archive.yaml | 2 +- tests/parsers/test_parser.py | 2 +- 18 files changed, 43 insertions(+), 43 deletions(-) rename src/{nomad_ubik_plugin => nomad_uibk_plugin}/__init__.py (100%) rename src/{nomad_ubik_plugin => nomad_uibk_plugin}/parsers/XRFparser.py (92%) rename src/{nomad_ubik_plugin => nomad_uibk_plugin}/parsers/__init__.py (82%) rename src/{nomad_ubik_plugin => nomad_uibk_plugin}/parsers/myparser.py (94%) rename src/{nomad_ubik_plugin => nomad_uibk_plugin}/schema_packages/XRFreader.py (97%) rename src/{nomad_ubik_plugin => nomad_uibk_plugin}/schema_packages/XRFschema.py (99%) rename src/{nomad_ubik_plugin => nomad_uibk_plugin}/schema_packages/__init__.py (85%) rename src/{nomad_ubik_plugin => nomad_uibk_plugin}/schema_packages/mypackage.py (94%) diff --git a/.cruft.json b/.cruft.json index 5a5a0e6..a97f8e2 100644 --- a/.cruft.json +++ b/.cruft.json @@ -7,9 +7,9 @@ "full_name": "Fabian Schöppach", "email": "fabian.schoeppach@physik.hu-berlin.de", "github_username": "fabianschoeppach", - "plugin_name": "ubik-plugin", - "module_name": "ubik_plugin", - "short_description": "UBIK schema and parser collection for NOMAD plattform.", + "plugin_name": "uibk-plugin", + "module_name": "uibk_plugin", + "short_description": "UIBK schema and parser collection for NOMAD plattform.", "version": "0.1.0", "license": "Apache Software License 2.0", "include_schema_package": true, diff --git a/README.md b/README.md index 60ebb07..b16c516 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# nomad-ubik-plugin +# nomad-uibk-plugin -UBIK schema and parser collection for NOMAD plattform. +UIBK schema and parser collection for NOMAD plattform. ---- @@ -62,7 +62,7 @@ python -m build --sdist You can install the package with pip: ``` -pip install dist/nomad-ubik-plugin-0.1.0 +pip install dist/nomad-uibk-plugin-0.1.0 ``` Read more about python packages, `pyproject.toml`, and how to upload packages to PyPI @@ -70,7 +70,7 @@ on the [PyPI documentation](https://packaging.python.org/en/latest/tutorials/pac ### Documentation on Github pages -To deploy documentation on Github pages, make sure to [enable GitHub pages via the repo settings](https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#publishing-from-a-branch). +To deploy documentation on Github pages, make sure to [enable GitHub pages via the repo settings](https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#publishing-from-a-branch). To view the documentation locally, install the documentation related packages using: @@ -85,9 +85,9 @@ mkdocs serve ### Template update -We use cruft to update the project based on template changes. A `cruft-update.yml` is included in Github workflows to automatically check for updates and create pull requests to apply updates. Follow the [instructions](https://github.blog/changelog/2022-05-03-github-actions-prevent-github-actions-from-creating-and-approving-pull-requests/) on how to enable Github Actions to create pull requests. +We use cruft to update the project based on template changes. A `cruft-update.yml` is included in Github workflows to automatically check for updates and create pull requests to apply updates. Follow the [instructions](https://github.blog/changelog/2022-05-03-github-actions-prevent-github-actions-from-creating-and-approving-pull-requests/) on how to enable Github Actions to create pull requests. To run the check for updates locally, follow the instructions on [`cruft` website](https://cruft.github.io/cruft/#updating-a-project). ### License -Distributed under the terms of the `Apache Software License 2.0`_ license, "nomad-ubik-plugin" is free and open source software +Distributed under the terms of the `Apache Software License 2.0`_ license, "nomad-uibk-plugin" is free and open source software diff --git a/docs/how_to/contribute_to_this_plugin.md b/docs/how_to/contribute_to_this_plugin.md index e832fd3..0379b58 100644 --- a/docs/how_to/contribute_to_this_plugin.md +++ b/docs/how_to/contribute_to_this_plugin.md @@ -3,8 +3,8 @@ This code is currently under development. To contribute to this project, you should clone the respective repository, [install it](install_this_plugin.md) and create a pull request following the standard procedure.: ```sh -git clone git@github.com:fabianschoeppach/nomad-UBIK-plugin.git -cd nomad-UBIK-plugin +git clone git@github.com:fabianschoeppach/nomad-UIBK-plugin.git +cd nomad-UIBK-plugin ``` ## Contribute to the Documentation diff --git a/docs/how_to/install_this_plugin.md b/docs/how_to/install_this_plugin.md index 9f12894..6132e38 100644 --- a/docs/how_to/install_this_plugin.md +++ b/docs/how_to/install_this_plugin.md @@ -2,7 +2,7 @@ ## For Usage in an NOMAD Distribution Image -To use this plugin in an NOMAD distribution image such as [this one](https://github.com/fabianschoeppach/nomad-UBIK-image) simply list it in the `plugin.txt`. +To use this plugin in an NOMAD distribution image such as [this one](https://github.com/fabianschoeppach/nomad-UIBK-image) simply list it in the `plugin.txt`. ## Stand alone diff --git a/docs/index.md b/docs/index.md index 3b068a5..47e10ad 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,4 +1,4 @@ -# Welcome to the `nomad-ubik-plugin` documentation +# Welcome to the `nomad-uibk-plugin` documentation ## Introduction diff --git a/mkdocs.yml b/mkdocs.yml index ce005fb..c6a0999 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,8 +1,8 @@ -site_name: nomad-ubik-plugin -site_description: UBIK schema and parser collection for NOMAD plattform. +site_name: nomad-uibk-plugin +site_description: UIBK schema and parser collection for NOMAD plattform. site_author: Fabian Schöppach -repo_url: https://github.com/fabianschoeppach/nomad-ubik-plugin +repo_url: https://github.com/fabianschoeppach/nomad-uibk-plugin nav: - Home: index.md diff --git a/move_template_files.sh b/move_template_files.sh index 2eedb32..07632e8 100644 --- a/move_template_files.sh +++ b/move_template_files.sh @@ -1,4 +1,4 @@ #!/bin/sh -rsync -avh nomad-ubik-plugin/ . -rm -rfv nomad-ubik-plugin +rsync -avh nomad-uibk-plugin/ . +rm -rfv nomad-uibk-plugin diff --git a/pyproject.toml b/pyproject.toml index 717a6e9..ae7452b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,8 +13,8 @@ classifiers = [ "Programming Language :: Python :: 3.12", "License :: OSI Approved :: Apache Software License", ] -name = "nomad-ubik-plugin" -description = "UBIK schema and parser collection for NOMAD plattform." +name = "nomad-uibk-plugin" +description = "UIBK schema and parser collection for NOMAD plattform." version = "0.1.0" readme = "README.rst" requires-python = ">=3.9" @@ -31,7 +31,7 @@ dependencies = [ ] [project.urls] -Repository = "https://github.com/fabianschoeppach/nomad-ubik-plugin" +Repository = "https://github.com/fabianschoeppach/nomad-uibk-plugin" [project.optional-dependencies] dev = ["ruff", "pytest", "structlog"] @@ -111,7 +111,7 @@ package-dir = { "" = "src" } where = ["src"] [project.entry-points.'nomad.plugin'] -myparser = "nomad_ubik_plugin.parsers:myparser" -mypackage = "nomad_ubik_plugin.schema_packages:mypackage" -xrfschema = "nomad_ubik_plugin.schema_packages:xrfschema" -xrfparser = "nomad_ubik_plugin.parsers:xrfparser" +myparser = "nomad_uibk_plugin.parsers:myparser" +mypackage = "nomad_uibk_plugin.schema_packages:mypackage" +xrfschema = "nomad_uibk_plugin.schema_packages:xrfschema" +xrfparser = "nomad_uibk_plugin.parsers:xrfparser" diff --git a/src/nomad_ubik_plugin/__init__.py b/src/nomad_uibk_plugin/__init__.py similarity index 100% rename from src/nomad_ubik_plugin/__init__.py rename to src/nomad_uibk_plugin/__init__.py diff --git a/src/nomad_ubik_plugin/parsers/XRFparser.py b/src/nomad_uibk_plugin/parsers/XRFparser.py similarity index 92% rename from src/nomad_ubik_plugin/parsers/XRFparser.py rename to src/nomad_uibk_plugin/parsers/XRFparser.py index f210600..a14cfb1 100644 --- a/src/nomad_ubik_plugin/parsers/XRFparser.py +++ b/src/nomad_uibk_plugin/parsers/XRFparser.py @@ -7,13 +7,13 @@ from nomad.parsing.parser import MatchingParser from nomad_measurements.utils import create_archive -from nomad_ubik_plugin.schema_packages.XRFschema import ELNXRayFluorescence +from nomad_uibk_plugin.schema_packages.XRFschema import ELNXRayFluorescence if TYPE_CHECKING: from nomad.datamodel.datamodel import EntryArchive from structlog.stdlib import BoundLogger -configuration = config.get_plugin_entry_point('nomad_ubik_plugin.parsers:xrfparser') +configuration = config.get_plugin_entry_point('nomad_uibk_plugin.parsers:xrfparser') class RawFileXRFData(EntryData): diff --git a/src/nomad_ubik_plugin/parsers/__init__.py b/src/nomad_uibk_plugin/parsers/__init__.py similarity index 82% rename from src/nomad_ubik_plugin/parsers/__init__.py rename to src/nomad_uibk_plugin/parsers/__init__.py index a1e2961..82cae4c 100644 --- a/src/nomad_ubik_plugin/parsers/__init__.py +++ b/src/nomad_uibk_plugin/parsers/__init__.py @@ -6,7 +6,7 @@ class MyParserEntryPoint(ParserEntryPoint): parameter: int = Field(0, description='Custom configuration parameter') def load(self): - from nomad_ubik_plugin.parsers.myparser import MyParser + from nomad_uibk_plugin.parsers.myparser import MyParser return MyParser(**self.dict()) @@ -25,14 +25,14 @@ class XRFParserEntryPoint(ParserEntryPoint): def load(self): # lazy import to avoid circular dependencies - from nomad_ubik_plugin.parsers.XRFparser import XRFParser + from nomad_uibk_plugin.parsers.XRFparser import XRFParser return XRFParser(**self.dict()) xrfparser = XRFParserEntryPoint( name='XRFParser', - description='XRF Parser for UBIK .txt files.', + description='XRF Parser for UIBK .txt files.', mainfile_name_re='.*\.txt', mainfile_content_re='PositionType\s+Application\s+Sample\s+name\s+Date\s+\n[A-Z0-9-]+\s+Quant\s+analysis', ) diff --git a/src/nomad_ubik_plugin/parsers/myparser.py b/src/nomad_uibk_plugin/parsers/myparser.py similarity index 94% rename from src/nomad_ubik_plugin/parsers/myparser.py rename to src/nomad_uibk_plugin/parsers/myparser.py index eb2c76d..1f42b27 100644 --- a/src/nomad_ubik_plugin/parsers/myparser.py +++ b/src/nomad_uibk_plugin/parsers/myparser.py @@ -15,7 +15,7 @@ from nomad.parsing.parser import MatchingParser configuration = config.get_plugin_entry_point( - 'nomad_ubik_plugin.parsers:myparser' + 'nomad_uibk_plugin.parsers:myparser' ) diff --git a/src/nomad_ubik_plugin/schema_packages/XRFreader.py b/src/nomad_uibk_plugin/schema_packages/XRFreader.py similarity index 97% rename from src/nomad_ubik_plugin/schema_packages/XRFreader.py rename to src/nomad_uibk_plugin/schema_packages/XRFreader.py index 49f3164..353be58 100644 --- a/src/nomad_ubik_plugin/schema_packages/XRFreader.py +++ b/src/nomad_uibk_plugin/schema_packages/XRFreader.py @@ -74,7 +74,7 @@ def group_composition_into_layers( ) elif logger is not None: logger.warn( - 'read_UBIK_txt found unknown unit "{unit}" ' + 'read_UIBK_txt found unknown unit "{unit}" ' 'in file: "{file_path}"' ) return layers @@ -135,7 +135,7 @@ def sort_intensity_values_into_layers( # noqa: PLR0913 def read_xrf_txt(file_path: str, logger: 'BoundLogger' = None) -> dict[str, Any]: # noqa: PLR0915, PLR0912 """ - Function for reading the X-ray fluorescence data in a UBIK `.txt` file. + Function for reading the X-ray fluorescence data in a UIBK `.txt` file. Args: file_path (str): The path to the `.txt` file. @@ -262,7 +262,7 @@ def read_xrf_txt(file_path: str, logger: 'BoundLogger' = None) -> dict[str, Any] ): if logger is not None: logger.warn( - 'read_UBIK_txt found inconsistent number of ' + 'read_UIBK_txt found inconsistent number of ' 'intensity values in file: "{file_path}"' ) @@ -291,12 +291,12 @@ def read_xrf_txt(file_path: str, logger: 'BoundLogger' = None) -> dict[str, Any] xrf_dict[application]['layers'] = layers elif logger is not None: logger.warn( - 'read_UBIK_txt found duplicate application "{application}"' + 'read_UIBK_txt found duplicate application "{application}"' ' in file: "{file_path}".' ) elif logger is not None: logger.warn( - 'read_UBIK_txt failed to extract all necessary information ' + 'read_UIBK_txt failed to extract all necessary information ' 'from file: "{file_path}"' ) diff --git a/src/nomad_ubik_plugin/schema_packages/XRFschema.py b/src/nomad_uibk_plugin/schema_packages/XRFschema.py similarity index 99% rename from src/nomad_ubik_plugin/schema_packages/XRFschema.py rename to src/nomad_uibk_plugin/schema_packages/XRFschema.py index 4b952d6..1cfb002 100644 --- a/src/nomad_ubik_plugin/schema_packages/XRFschema.py +++ b/src/nomad_uibk_plugin/schema_packages/XRFschema.py @@ -62,13 +62,13 @@ ) from nomad_measurements.utils import merge_sections -from nomad_ubik_plugin.schema_packages import XRFreader +from nomad_uibk_plugin.schema_packages import XRFreader if TYPE_CHECKING: from structlog.stdlib import BoundLogger configuration = config.get_plugin_entry_point( - 'nomad_ubik_plugin.schema_packages:xrfschema' + 'nomad_uibk_plugin.schema_packages:xrfschema' ) m_package = SchemaPackage(name='nomad_xrf') diff --git a/src/nomad_ubik_plugin/schema_packages/__init__.py b/src/nomad_uibk_plugin/schema_packages/__init__.py similarity index 85% rename from src/nomad_ubik_plugin/schema_packages/__init__.py rename to src/nomad_uibk_plugin/schema_packages/__init__.py index fd6eacd..5fbebc6 100644 --- a/src/nomad_ubik_plugin/schema_packages/__init__.py +++ b/src/nomad_uibk_plugin/schema_packages/__init__.py @@ -6,7 +6,7 @@ class MySchemaPackageEntryPoint(SchemaPackageEntryPoint): parameter: int = Field(0, description='Custom configuration parameter') def load(self): - from nomad_ubik_plugin.schema_packages.mypackage import m_package + from nomad_uibk_plugin.schema_packages.mypackage import m_package return m_package @@ -20,7 +20,7 @@ class XRFSchemaPackageEntryPoint(SchemaPackageEntryPoint): parameter: int = Field(0, description='Custom configuration parameter') def load(self): - from nomad_ubik_plugin.schema_packages.XRFschema import m_package + from nomad_uibk_plugin.schema_packages.XRFschema import m_package return m_package diff --git a/src/nomad_ubik_plugin/schema_packages/mypackage.py b/src/nomad_uibk_plugin/schema_packages/mypackage.py similarity index 94% rename from src/nomad_ubik_plugin/schema_packages/mypackage.py rename to src/nomad_uibk_plugin/schema_packages/mypackage.py index eedc309..9398fc1 100644 --- a/src/nomad_ubik_plugin/schema_packages/mypackage.py +++ b/src/nomad_uibk_plugin/schema_packages/mypackage.py @@ -16,7 +16,7 @@ from nomad.metainfo import Quantity, SchemaPackage configuration = config.get_plugin_entry_point( - 'nomad_ubik_plugin.schema_packages:mypackage' + 'nomad_uibk_plugin.schema_packages:mypackage' ) m_package = SchemaPackage() diff --git a/tests/data/test.archive.yaml b/tests/data/test.archive.yaml index bff292e..e01b17c 100644 --- a/tests/data/test.archive.yaml +++ b/tests/data/test.archive.yaml @@ -1,3 +1,3 @@ data: - m_def: nomad_ubik_plugin.schema_packages.mypackage.MySchema + m_def: nomad_uibk_plugin.schema_packages.mypackage.MySchema name: Markus diff --git a/tests/parsers/test_parser.py b/tests/parsers/test_parser.py index cddb3b2..c356283 100644 --- a/tests/parsers/test_parser.py +++ b/tests/parsers/test_parser.py @@ -1,7 +1,7 @@ import logging from nomad.datamodel import EntryArchive -from nomad_ubik_plugin.parsers.myparser import MyParser +from nomad_uibk_plugin.parsers.myparser import MyParser def test_parse_file():