diff --git a/nomad-{{cookiecutter.plugin_name}}/py_sources/src/normalizers/mynormalizer.py b/nomad-{{cookiecutter.plugin_name}}/py_sources/src/normalizers/mynormalizer.py index 64e25ba..3c403ed 100644 --- a/nomad-{{cookiecutter.plugin_name}}/py_sources/src/normalizers/mynormalizer.py +++ b/nomad-{{cookiecutter.plugin_name}}/py_sources/src/normalizers/mynormalizer.py @@ -1,17 +1,7 @@ -from typing import ( - TYPE_CHECKING, -) - -if TYPE_CHECKING: - from nomad.datamodel.datamodel import ( - EntryArchive, - ) - from structlog.stdlib import ( - BoundLogger, - ) - from nomad.config import config +from nomad.datamodel.datamodel import EntryArchive from nomad.normalizing import Normalizer +from structlog.stdlib import BoundLogger configuration = config.get_plugin_entry_point( 'nomad_{{cookiecutter.module_name}}.normalizers:mynormalizer' @@ -19,7 +9,7 @@ class MyNormalizer(Normalizer): - def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: + def normalize(self, archive: EntryArchive, logger: BoundLogger) -> None: super().normalize(archive, logger) logger.info('MyNormalizer.normalize', parameter=configuration.parameter) if archive.results and archive.results.material: diff --git a/nomad-{{cookiecutter.plugin_name}}/py_sources/src/parsers/myparser.py b/nomad-{{cookiecutter.plugin_name}}/py_sources/src/parsers/myparser.py index 63e8c25..fd30e89 100644 --- a/nomad-{{cookiecutter.plugin_name}}/py_sources/src/parsers/myparser.py +++ b/nomad-{{cookiecutter.plugin_name}}/py_sources/src/parsers/myparser.py @@ -1,18 +1,9 @@ -from typing import ( - TYPE_CHECKING, -) - -if TYPE_CHECKING: - from nomad.datamodel.datamodel import ( - EntryArchive, - ) - from structlog.stdlib import ( - BoundLogger, - ) - from nomad.config import config +from nomad.datamodel.datamodel import EntryArchive from nomad.datamodel.results import Material, Results +from nomad.normalizing import Normalizer from nomad.parsing.parser import MatchingParser +from structlog.stdlib import BoundLogger configuration = config.get_plugin_entry_point( 'nomad_{{cookiecutter.module_name}}.parsers:myparser' @@ -23,8 +14,8 @@ class MyParser(MatchingParser): def parse( self, mainfile: str, - archive: 'EntryArchive', - logger: 'BoundLogger', + archive: EntryArchive, + logger: BoundLogger, child_archives: dict[str, 'EntryArchive'] = None, ) -> None: logger.info('MyParser.parse', parameter=configuration.parameter) diff --git a/nomad-{{cookiecutter.plugin_name}}/py_sources/src/schema_packages/mypackage.py b/nomad-{{cookiecutter.plugin_name}}/py_sources/src/schema_packages/mypackage.py index 4e5e91a..50be23e 100644 --- a/nomad-{{cookiecutter.plugin_name}}/py_sources/src/schema_packages/mypackage.py +++ b/nomad-{{cookiecutter.plugin_name}}/py_sources/src/schema_packages/mypackage.py @@ -1,19 +1,9 @@ -from typing import ( - TYPE_CHECKING, -) - -if TYPE_CHECKING: - from nomad.datamodel.datamodel import ( - EntryArchive, - ) - from structlog.stdlib import ( - BoundLogger, - ) - from nomad.config import config from nomad.datamodel.data import Schema +from nomad.datamodel.datamodel import EntryArchive from nomad.datamodel.metainfo.annotations import ELNAnnotation, ELNComponentEnum from nomad.metainfo import Quantity, SchemaPackage +from structlog.stdlib import BoundLogger configuration = config.get_plugin_entry_point( 'nomad_{{cookiecutter.module_name}}.schema_packages:mypackage' @@ -28,7 +18,7 @@ class MySchema(Schema): ) message = Quantity(type=str) - def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: + def normalize(self, archive: EntryArchive, logger: BoundLogger) -> None: super().normalize(archive, logger) logger.info('MySchema.normalize', parameter=configuration.parameter) diff --git a/nomad-{{cookiecutter.plugin_name}}/pyproject.toml b/nomad-{{cookiecutter.plugin_name}}/pyproject.toml index ba4cc27..ecf1859 100644 --- a/nomad-{{cookiecutter.plugin_name}}/pyproject.toml +++ b/nomad-{{cookiecutter.plugin_name}}/pyproject.toml @@ -35,13 +35,13 @@ maintainers = [ { name = "{{cookiecutter.full_name}}", email = "{{cookiecutter.email}}" }, ] license = { file = "LICENSE" } -dependencies = ["nomad-lab>=1.2.2dev578"] +dependencies = ["nomad-lab>=1.2.2dev578", "structlog"] [project.urls] Repository = "https://github.com/{{cookiecutter.github_username}}/nomad-{{cookiecutter.plugin_name}}" [project.optional-dependencies] -dev = ["ruff", "pytest", "structlog"] +dev = ["ruff", "pytest"] [tool.ruff] # Exclude a variety of commonly ignored directories.