nomad-nmr-schema 0.1.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. nomad_nmr_schema-0.1.8/.cruft.json +27 -0
  2. nomad_nmr_schema-0.1.8/.github/dependabot.yml +16 -0
  3. nomad_nmr_schema-0.1.8/.github/workflows/actions.yml +34 -0
  4. nomad_nmr_schema-0.1.8/.github/workflows/mkdocs-deploy.yml +24 -0
  5. nomad_nmr_schema-0.1.8/.github/workflows/publish.yml +119 -0
  6. nomad_nmr_schema-0.1.8/.gitignore +130 -0
  7. nomad_nmr_schema-0.1.8/.vscode/launch.json +17 -0
  8. nomad_nmr_schema-0.1.8/.vscode/settings.json +21 -0
  9. nomad_nmr_schema-0.1.8/LICENSE +22 -0
  10. nomad_nmr_schema-0.1.8/MANIFEST.in +2 -0
  11. nomad_nmr_schema-0.1.8/PKG-INFO +232 -0
  12. nomad_nmr_schema-0.1.8/README.md +176 -0
  13. nomad_nmr_schema-0.1.8/docs/assets/.gitignore +1 -0
  14. nomad_nmr_schema-0.1.8/docs/assets/favicon.png +0 -0
  15. nomad_nmr_schema-0.1.8/docs/assets/nomad-plugin-logo.png +0 -0
  16. nomad_nmr_schema-0.1.8/docs/explanation/explanation.md +4 -0
  17. nomad_nmr_schema-0.1.8/docs/how_to/contribute_to_the_documentation.md +4 -0
  18. nomad_nmr_schema-0.1.8/docs/how_to/contribute_to_this_plugin.md +24 -0
  19. nomad_nmr_schema-0.1.8/docs/how_to/install_this_plugin.md +4 -0
  20. nomad_nmr_schema-0.1.8/docs/how_to/use_this_plugin.md +10 -0
  21. nomad_nmr_schema-0.1.8/docs/index.md +48 -0
  22. nomad_nmr_schema-0.1.8/docs/reference/references.md +4 -0
  23. nomad_nmr_schema-0.1.8/docs/stylesheets/extra.css +69 -0
  24. nomad_nmr_schema-0.1.8/docs/theme/partials/header.html +86 -0
  25. nomad_nmr_schema-0.1.8/docs/tutorial/tutorial.md +4 -0
  26. nomad_nmr_schema-0.1.8/mkdocs.yml +59 -0
  27. nomad_nmr_schema-0.1.8/move_template_files.sh +9 -0
  28. nomad_nmr_schema-0.1.8/pyproject.toml +141 -0
  29. nomad_nmr_schema-0.1.8/requirements_docs.txt +5 -0
  30. nomad_nmr_schema-0.1.8/setup.cfg +4 -0
  31. nomad_nmr_schema-0.1.8/src/nomad_nmr_schema/__init__.py +0 -0
  32. nomad_nmr_schema-0.1.8/src/nomad_nmr_schema/schema_packages/__init__.py +17 -0
  33. nomad_nmr_schema-0.1.8/src/nomad_nmr_schema/schema_packages/schema_package.py +802 -0
  34. nomad_nmr_schema-0.1.8/src/nomad_nmr_schema/schema_packages/tensor_utils.py +368 -0
  35. nomad_nmr_schema-0.1.8/src/nomad_nmr_schema.egg-info/PKG-INFO +232 -0
  36. nomad_nmr_schema-0.1.8/src/nomad_nmr_schema.egg-info/SOURCES.txt +61 -0
  37. nomad_nmr_schema-0.1.8/src/nomad_nmr_schema.egg-info/dependency_links.txt +1 -0
  38. nomad_nmr_schema-0.1.8/src/nomad_nmr_schema.egg-info/entry_points.txt +2 -0
  39. nomad_nmr_schema-0.1.8/src/nomad_nmr_schema.egg-info/requires.txt +17 -0
  40. nomad_nmr_schema-0.1.8/src/nomad_nmr_schema.egg-info/scm_file_list.json +57 -0
  41. nomad_nmr_schema-0.1.8/src/nomad_nmr_schema.egg-info/scm_version.json +8 -0
  42. nomad_nmr_schema-0.1.8/src/nomad_nmr_schema.egg-info/top_level.txt +1 -0
  43. nomad_nmr_schema-0.1.8/tests/__init__.py +0 -0
  44. nomad_nmr_schema-0.1.8/tests/conftest.py +0 -0
  45. nomad_nmr_schema-0.1.8/tests/data/.gitkeep +0 -0
  46. nomad_nmr_schema-0.1.8/tests/data/test_delta_g.archive.yaml +10 -0
  47. nomad_nmr_schema-0.1.8/tests/data/test_delta_g_paratec.archive.yaml +10 -0
  48. nomad_nmr_schema-0.1.8/tests/data/test_electric_field_gradient.archive.yaml +6 -0
  49. nomad_nmr_schema-0.1.8/tests/data/test_hyperfine_dipolar.archive.yaml +9 -0
  50. nomad_nmr_schema-0.1.8/tests/data/test_hyperfine_fermi_contact.archive.yaml +7 -0
  51. nomad_nmr_schema-0.1.8/tests/data/test_indirect_spin_spin_coupling.archive.yaml +6 -0
  52. nomad_nmr_schema-0.1.8/tests/data/test_indirect_spin_spin_coupling_fermicontact.archive.yaml +6 -0
  53. nomad_nmr_schema-0.1.8/tests/data/test_indirect_spin_spin_coupling_orbitald.archive.yaml +6 -0
  54. nomad_nmr_schema-0.1.8/tests/data/test_indirect_spin_spin_coupling_orbitalp.archive.yaml +6 -0
  55. nomad_nmr_schema-0.1.8/tests/data/test_indirect_spin_spin_coupling_spindipolar.archive.yaml +6 -0
  56. nomad_nmr_schema-0.1.8/tests/data/test_magnetic_shielding.archive.yaml +9 -0
  57. nomad_nmr_schema-0.1.8/tests/data/test_magnetic_susceptibility.archive.yaml +6 -0
  58. nomad_nmr_schema-0.1.8/tests/data/test_unpaired_spins.archive.yaml +4 -0
  59. nomad_nmr_schema-0.1.8/tests/schema_packages/__init__.py +0 -0
  60. nomad_nmr_schema-0.1.8/tests/schema_packages/expected_values.py +74 -0
  61. nomad_nmr_schema-0.1.8/tests/schema_packages/sample_magres_data.py +34 -0
  62. nomad_nmr_schema-0.1.8/tests/schema_packages/test_schema_package.py +321 -0
  63. nomad_nmr_schema-0.1.8/tests/schema_packages/test_tensor_utils.py +190 -0
@@ -0,0 +1,27 @@
1
+ {
2
+ "template": "https://github.com/FAIRmat-NFDI/cookiecutter-nomad-plugin",
3
+ "commit": "5f38479d519664f77a5ea3b7790efb31253b7cc9",
4
+ "checkout": null,
5
+ "context": {
6
+ "cookiecutter": {
7
+ "full_name": "Andrea Albino",
8
+ "email": "andrea.albino@physik.hu-berlin.de",
9
+ "github_username": "FAIRmat-NFDI",
10
+ "plugin_name": "nomad_nmr_schema",
11
+ "module_name": "nomad_nmr_schema",
12
+ "short_description": "Schema plugin containing shared classes for NMR metadata",
13
+ "version": "0.1.0",
14
+ "license": "MIT",
15
+ "include_schema_package": true,
16
+ "include_normalizer": false,
17
+ "include_parser": false,
18
+ "include_app": true,
19
+ "include_example_uploads": false,
20
+ "_copy_without_render": [
21
+ "*.html"
22
+ ],
23
+ "_template": "https://github.com/FAIRmat-NFDI/cookiecutter-nomad-plugin"
24
+ }
25
+ },
26
+ "directory": null
27
+ }
@@ -0,0 +1,16 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for more information:
4
+ # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
+ # https://containers.dev/guide/dependabot
6
+
7
+ version: 2
8
+ updates:
9
+ - package-ecosystem: "github-actions"
10
+ directory: "/"
11
+ schedule:
12
+ interval: weekly
13
+ - package-ecosystem: "devcontainers"
14
+ directory: "/"
15
+ schedule:
16
+ interval: weekly
@@ -0,0 +1,34 @@
1
+ name: install-and-test-workflow
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ install-and-test:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v4
10
+ - name: Install uv and set the python version
11
+ uses: astral-sh/setup-uv@v5
12
+ with:
13
+ python-version: 3.12
14
+ - name: Install dependencies
15
+ run: |
16
+ uv sync --all-extras
17
+ - name: Test with pytest
18
+ run: |
19
+ uv run --with coverage coverage run -m pytest -sv
20
+ - name: Submit to coveralls
21
+ continue-on-error: true
22
+ env:
23
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24
+ run: |
25
+ uv run --with coveralls coveralls --service=github
26
+
27
+ ruff-linting:
28
+ runs-on: ubuntu-latest
29
+ steps:
30
+ - uses: actions/checkout@v4
31
+ - uses: astral-sh/ruff-action@v3
32
+ - run: ruff check .
33
+ # Uncomment the following line to enable format check
34
+ # - run: ruff format --check .
@@ -0,0 +1,24 @@
1
+ name: Deploy MkDocs Site
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main # Triggers deployment on push to the main branch
7
+
8
+ permissions:
9
+ contents: write
10
+
11
+ jobs:
12
+ deploy:
13
+ runs-on: ubuntu-latest
14
+
15
+ steps:
16
+ - name: Checkout Repository
17
+ uses: actions/checkout@v4
18
+
19
+ - name: Deploy docs
20
+ uses: mhausenblas/mkdocs-deploy-gh-pages@master
21
+ env:
22
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23
+ CONFIG_FILE: mkdocs.yml
24
+ REQUIREMENTS: requirements_docs.txt
@@ -0,0 +1,119 @@
1
+ name: Build and Publish Python Package
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
16
+ with:
17
+ fetch-depth: 0 # setuptools-scm needs the release tag and history
18
+ persist-credentials: false
19
+ - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
20
+ with:
21
+ python-version: '3.11'
22
+ - name: Install build tools
23
+ run: python -m pip install build twine packaging
24
+ - name: Build sdist and wheel
25
+ run: python -m build
26
+ - name: Check distribution metadata and README
27
+ run: python -m twine check --strict dist/*
28
+ - name: Store distributions for inspection and publishing
29
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
30
+ with:
31
+ name: python-package-distributions
32
+ path: dist/
33
+ if-no-files-found: error
34
+ - name: Check PyPI dependency and release version requirements
35
+ env:
36
+ RELEASE_TAG: ${{ github.event.release.tag_name }}
37
+ run: |
38
+ python - <<'PY'
39
+ import os
40
+ from email.parser import BytesParser
41
+ from pathlib import Path
42
+ from zipfile import ZipFile
43
+
44
+ from packaging.requirements import Requirement
45
+ from packaging.version import Version
46
+
47
+ wheel, = Path('dist').glob('*.whl')
48
+ with ZipFile(wheel) as archive:
49
+ metadata_path, = (
50
+ name for name in archive.namelist()
51
+ if name.endswith('.dist-info/METADATA')
52
+ )
53
+ metadata = BytesParser().parsebytes(archive.read(metadata_path))
54
+ direct_urls = [
55
+ requirement for requirement in metadata.get_all('Requires-Dist', [])
56
+ if Requirement(requirement).url
57
+ ]
58
+ if direct_urls:
59
+ raise SystemExit(
60
+ 'PyPI rejects direct URL dependencies, including extras:\n'
61
+ + '\n'.join(direct_urls)
62
+ )
63
+ tag = os.environ.get('RELEASE_TAG')
64
+ if tag:
65
+ version = Version(metadata['Version'])
66
+ if version.local or version != Version(tag):
67
+ raise SystemExit(
68
+ f'Built version {version} must match release tag {tag} '
69
+ 'and must not contain a local version suffix.'
70
+ )
71
+ print(f"Validated {metadata['Name']} {metadata['Version']}")
72
+ PY
73
+
74
+ test-install:
75
+ needs: build
76
+ runs-on: ubuntu-latest
77
+ strategy:
78
+ matrix:
79
+ distribution: [wheel, sdist]
80
+ steps:
81
+ - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
82
+ with:
83
+ python-version: '3.11'
84
+ - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
85
+ with:
86
+ name: python-package-distributions
87
+ path: dist/
88
+ # No source checkout or development registry: exercise the public package.
89
+ - name: Install wheel with dependencies from public PyPI
90
+ if: matrix.distribution == 'wheel'
91
+ run: |
92
+ wheel=(dist/*.whl)
93
+ python -m pip install --index-url https://pypi.org/simple "${wheel[0]}"
94
+ - name: Install sdist with dependencies from public PyPI
95
+ if: matrix.distribution == 'sdist'
96
+ run: |
97
+ sdist=(dist/*.tar.gz)
98
+ python -m pip install --index-url https://pypi.org/simple "${sdist[0]}"
99
+ - name: Check installed dependencies and NMR plugin
100
+ run: |
101
+ python -m pip check
102
+ python -c "from nomad_nmr_schema.schema_packages import nmr_schema; nmr_schema.load()"
103
+
104
+ publish:
105
+ if: github.event_name == 'release'
106
+ needs: [build, test-install]
107
+ runs-on: ubuntu-latest
108
+ environment:
109
+ name: pypi
110
+ url: https://pypi.org/p/nomad-nmr-schema
111
+ permissions:
112
+ id-token: write
113
+ steps:
114
+ - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
115
+ with:
116
+ name: python-package-distributions
117
+ path: dist/
118
+ - name: Publish with PyPI Trusted Publishing
119
+ uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # release/v1
@@ -0,0 +1,130 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ pip-wheel-metadata/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py,cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ target/
76
+
77
+ # Jupyter Notebook
78
+ .ipynb_checkpoints
79
+
80
+ # IPython
81
+ profile_default/
82
+ ipython_config.py
83
+
84
+ # pyenv
85
+ .python-version
86
+
87
+ # pipenv
88
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
90
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
91
+ # install all needed dependencies.
92
+ #Pipfile.lock
93
+
94
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95
+ __pypackages__/
96
+
97
+ # Celery stuff
98
+ celerybeat-schedule
99
+ celerybeat.pid
100
+
101
+ # SageMath parsed files
102
+ *.sage.py
103
+
104
+ # Environments
105
+ .env
106
+ .venv
107
+ env/
108
+ venv/
109
+ ENV/
110
+ env.bak/
111
+ venv.bak/
112
+ .pyenv
113
+
114
+ # Spyder project settings
115
+ .spyderproject
116
+ .spyproject
117
+
118
+ # Rope project settings
119
+ .ropeproject
120
+
121
+ # mkdocs documentation
122
+ /site
123
+
124
+ # mypy
125
+ .mypy_cache/
126
+ .dmypy.json
127
+ dmypy.json
128
+
129
+ # Pyre type checker
130
+ .pyre/
@@ -0,0 +1,17 @@
1
+ {
2
+ "version": "0.2.0",
3
+ "configurations": [
4
+ {
5
+ "name": "tests",
6
+ "type": "python",
7
+ "request": "launch",
8
+ "cwd": "${workspaceFolder}",
9
+ "program": "${workspaceFolder}/.venv/bin/pytest",
10
+ "justMyCode": false,
11
+ "env": {
12
+ "_PYTEST_RAISE": "1"
13
+ },
14
+ "args": ["-sv", "tests"]
15
+ }
16
+ ]
17
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "editor.rulers": [
3
+ 90
4
+ ],
5
+ "editor.renderWhitespace": "all",
6
+ "editor.tabSize": 4,
7
+ "files.trimTrailingWhitespace": true,
8
+ "[python]": {
9
+ "editor.formatOnSave": true,
10
+ "editor.codeActionsOnSave": {
11
+ "source.fixAll": "explicit",
12
+ "source.organizeImports": "explicit"
13
+ },
14
+ "editor.defaultFormatter": "charliermarsh.ruff"
15
+ },
16
+ "python.testing.pytestArgs": [
17
+ "tests"
18
+ ],
19
+ "python.testing.unittestEnabled": false,
20
+ "python.testing.pytestEnabled": true
21
+ }
@@ -0,0 +1,22 @@
1
+
2
+ The MIT License (MIT)
3
+
4
+ Copyright (c) 2025 Andrea Albino
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ THE SOFTWARE.
@@ -0,0 +1,2 @@
1
+ recursive-include * nomad_plugin.yaml
2
+ graft src/nomad_nmr_schema/example_uploads
@@ -0,0 +1,232 @@
1
+ Metadata-Version: 2.4
2
+ Name: nomad-nmr-schema
3
+ Version: 0.1.8
4
+ Summary: Schema plugin containing shared classes for NMR metadata
5
+ Author-email: Andrea Albino <andrea.albino@physik.hu-berlin.de>
6
+ Maintainer-email: Andrea Albino <andrea.albino@physik.hu-berlin.de>
7
+ License:
8
+ The MIT License (MIT)
9
+
10
+ Copyright (c) 2025 Andrea Albino
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ of this software and associated documentation files (the "Software"), to deal
14
+ in the Software without restriction, including without limitation the rights
15
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in
20
+ all copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28
+ THE SOFTWARE.
29
+
30
+ Project-URL: Repository, https://github.com/FAIRmat-NFDI/nomad-schema-plugin-nmr
31
+ Classifier: Intended Audience :: Developers
32
+ Classifier: Operating System :: OS Independent
33
+ Classifier: Programming Language :: Python
34
+ Classifier: Programming Language :: Python :: 3.10
35
+ Classifier: Programming Language :: Python :: 3.11
36
+ Classifier: Programming Language :: Python :: 3.12
37
+ Classifier: License :: OSI Approved :: MIT License
38
+ Requires-Python: >=3.10
39
+ Description-Content-Type: text/markdown
40
+ License-File: LICENSE
41
+ Requires-Dist: nomad-lab>=1.4.2
42
+ Requires-Dist: python-magic-bin; sys_platform == "win32"
43
+ Requires-Dist: nomad-simulations>=0.10.0
44
+ Provides-Extra: dev
45
+ Requires-Dist: pytest; extra == "dev"
46
+ Requires-Dist: ruff>=0.14.2; extra == "dev"
47
+ Requires-Dist: structlog; extra == "dev"
48
+ Requires-Dist: mkdocs; extra == "dev"
49
+ Requires-Dist: mkdocs-material>=9.0; extra == "dev"
50
+ Requires-Dist: pymdown-extensions; extra == "dev"
51
+ Requires-Dist: mkdocs-click; extra == "dev"
52
+ Requires-Dist: mkdocs-macros-plugin>=1.0; extra == "dev"
53
+ Requires-Dist: pydantic>=2; extra == "dev"
54
+ Requires-Dist: python-logstash; extra == "dev"
55
+ Dynamic: license-file
56
+
57
+ # nomad_nmr_schema
58
+
59
+ Schema plugin containing shared classes for NMR metadata
60
+
61
+ This `nomad` plugin was generated with `Cookiecutter` along with `@nomad`'s [`cookiecutter-nomad-plugin`](https://github.com/FAIRmat-NFDI/cookiecutter-nomad-plugin) template.
62
+
63
+
64
+ ## Development
65
+
66
+ If you want to develop locally this plugin, clone the project and in the plugin folder, create a virtual environment (you can use Python 3.10, 3.11 or 3.12):
67
+ ```sh
68
+ git clone https://github.com/FAIRmat-NFDI/nomad-schema-plugin-nmr.git
69
+ cd nomad-schema-plugin-nmr
70
+ python3.11 -m venv .pyenv
71
+ . .pyenv/bin/activate
72
+ ```
73
+
74
+ Make sure to have `pip` upgraded:
75
+ ```sh
76
+ pip install --upgrade pip
77
+ ```
78
+
79
+ We recommend installing `uv` for fast pip installation of the packages:
80
+ ```sh
81
+ pip install uv
82
+ ```
83
+
84
+ Install the `nomad-lab` package:
85
+ ```sh
86
+ uv pip install '.[dev]' --index-url https://gitlab.mpcdf.mpg.de/api/v4/projects/2187/packages/pypi/simple
87
+ ```
88
+
89
+ **Note!**
90
+ Until we have an official pypi NOMAD release with the plugins functionality make
91
+ sure to include NOMAD's internal package registry (via `--index-url` in the above command).
92
+
93
+ The plugin is still under development. If you would like to contribute, install the package in editable mode (with the added `-e` flag):
94
+ ```sh
95
+ uv pip install -e '.[dev]' --index-url https://gitlab.mpcdf.mpg.de/api/v4/projects/2187/packages/pypi/simple
96
+ ```
97
+
98
+
99
+ ### Run the tests
100
+
101
+ You can run locally the tests:
102
+ ```sh
103
+ python -m pytest -sv tests
104
+ ```
105
+
106
+ where the `-s` and `-v` options toggle the output verbosity.
107
+
108
+ Our CI/CD pipeline produces a more comprehensive test report using the `pytest-cov` package. You can generate a local coverage report:
109
+ ```sh
110
+ uv pip install pytest-cov
111
+ python -m pytest --cov=src tests
112
+ ```
113
+
114
+ ### Run linting and auto-formatting
115
+
116
+ We use [Ruff](https://docs.astral.sh/ruff/) for linting and formatting the code. Ruff auto-formatting is also a part of the GitHub workflow actions. You can run locally:
117
+ ```sh
118
+ ruff check .
119
+ ruff format . --check
120
+ ```
121
+
122
+
123
+ ### Debugging
124
+
125
+ For interactive debugging of the tests, use `pytest` with the `--pdb` flag. We recommend using an IDE for debugging, e.g., _VSCode_. If that is the case, add the following snippet to your `.vscode/launch.json`:
126
+ ```json
127
+ {
128
+ "configurations": [
129
+ {
130
+ "name": "<descriptive tag>",
131
+ "type": "debugpy",
132
+ "request": "launch",
133
+ "cwd": "${workspaceFolder}",
134
+ "program": "${workspaceFolder}/.pyenv/bin/pytest",
135
+ "justMyCode": true,
136
+ "env": {
137
+ "_PYTEST_RAISE": "1"
138
+ },
139
+ "args": [
140
+ "-sv",
141
+ "--pdb",
142
+ "<path-to-plugin-tests>",
143
+ ]
144
+ }
145
+ ]
146
+ }
147
+ ```
148
+
149
+ where `<path-to-plugin-tests>` must be changed to the local path to the test module to be debugged.
150
+
151
+ The settings configuration file `.vscode/settings.json` automatically applies the linting and formatting upon saving the modified file.
152
+
153
+
154
+ ### Documentation on Github pages
155
+
156
+ To view the documentation locally, install the related packages using:
157
+ ```sh
158
+ uv pip install -r requirements_docs.txt
159
+ ```
160
+
161
+ Run the documentation server:
162
+ ```sh
163
+ mkdocs serve
164
+ ```
165
+
166
+
167
+ ## Adding this plugin to NOMAD
168
+
169
+ Currently, NOMAD has two distinct flavors that are relevant depending on your role as an user:
170
+ 1. [A NOMAD Oasis](#adding-this-plugin-in-your-nomad-oasis): any user with a NOMAD Oasis instance.
171
+ 2. [Local NOMAD installation and the source code of NOMAD](#adding-this-plugin-in-your-local-nomad-installation-and-the-source-code-of-nomad): internal developers.
172
+
173
+ ### Adding this plugin in your NOMAD Oasis
174
+
175
+ Read the [NOMAD plugin documentation](https://nomad-lab.eu/prod/v1/staging/docs/howto/oasis/plugins_install.html) for all details on how to deploy the plugin on your NOMAD instance.
176
+
177
+ ### Adding this plugin in your local NOMAD installation and the source code of NOMAD
178
+
179
+ Modify the text file under `/nomad/default_plugins.txt` and add:
180
+ ```sh
181
+ <other-content-in-default_plugins.txt>
182
+ nomad_nmr_schema==x.y.z
183
+ ```
184
+ where `x.y.z` represents the released version of this plugin.
185
+
186
+ Then, go to your NOMAD folder, activate your NOMAD virtual environment and run:
187
+ ```sh
188
+ deactivate
189
+ cd <route-to-NOMAD-folder>/nomad
190
+ source .pyenv/bin/activate
191
+ ./scripts/setup_dev_env.sh
192
+ ```
193
+
194
+ Alternatively and only valid for your local NOMAD installation, you can modify `nomad.yaml` to include this plugin, see [NOMAD Oasis - Install plugins](https://nomad-lab.eu/prod/v1/staging/docs/howto/oasis/plugins_install.html).
195
+
196
+
197
+ ### Build the python package
198
+
199
+ The `pyproject.toml` file contains everything that is necessary to turn the project
200
+ into a pip installable python package. Run the python build tool to create a package distribution:
201
+
202
+ ```sh
203
+ pip install build
204
+ python -m build --sdist
205
+ ```
206
+
207
+ You can install the package with pip:
208
+
209
+ ```sh
210
+ pip install dist/nomad_nmr_schema-0.1.0
211
+ ```
212
+
213
+ Read more about python packages, `pyproject.toml`, and how to upload packages to PyPI
214
+ on the [PyPI documentation](https://packaging.python.org/en/latest/tutorials/packaging-projects/).
215
+
216
+
217
+ ### Publish a release
218
+
219
+ Follow the [release workflow](docs/how_to/contribute_to_this_plugin.md#release-workflow)
220
+ in the contributor guide.
221
+
222
+ ### Template update
223
+
224
+ 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.
225
+
226
+ To run the check for updates locally, follow the instructions on [`cruft` website](https://cruft.github.io/cruft/#updating-a-project).
227
+
228
+
229
+ ## Main contributors
230
+ | Name | E-mail |
231
+ |------|------------|
232
+ | Andrea Albino | [andrea.albino@physik.hu-berlin.de](mailto:andrea.albino@physik.hu-berlin.de)