Skip to content

Commit

Permalink
Merge pull request nomad-coe#1 from nomad-coe/actions
Browse files Browse the repository at this point in the history
Fixed nomad-lab version and readme.
  • Loading branch information
markus1978 authored Jul 10, 2023
2 parents f4afe97 + a7f5250 commit 7dd3038
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 2 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/actions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: install-and-test-workflow
on: [push]
jobs:
install-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements.txt --index-url https://gitlab.mpcdf.mpg.de/api/v4/projects/2187/packages/pypi/simple
- name: Test with pytest
run: |
python -m pytest -sv tests
- name: Test with nomad
run: |
python -m nomad.cli parse tests/data/test.example-format.txt
build-and-install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Build the package
run: |
pip install --upgrade pip
pip install build
python -m build --sdist
- name: Install the package
run: |
pip install dist/*.tar.gz --index-url https://gitlab.mpcdf.mpg.de/api/v4/projects/2187/packages/pypi/simple
- name: Test with nomad
run: |
python -m nomad.cli parse tests/data/test.example-format.txt
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,28 @@ You can now start to develop you schema. Here are a few things that you might wa
- The name of the example parser `ExampleParser` and the schema definitions it might define.
- When you change module and class names, make sure to update the `nomad_plugin.yaml` accordingly.


## Build the python package

The `pyproject.toml` file contains everything that is necessary to turn the project
into a pip installable python package. Run the python build tool to create a package distribution:

```
pip install build
python -m build --sdist
```

You can install the package with pip:

```
pip install dist/nomad-schema-plugin-example-1.0.tar.gz
```

Read more about python packages, `pyproject.toml`, and how to upload packages to PyPI
on the [PyPI documentation](https://packaging.python.org/en/latest/tutorials/packaging-projects/).


## Next steps

To learn more about plugins, how to add them to an Oasis, how to publish them, read our
documentation on plugins: https://nomad-lab/prod/v1/staging/docs/plugins.html
documentation on plugins: https://nomad-lab.eu/docs/plugins/plugins.html.
28 changes: 28 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = 'nomad-parser-plugin-example'
version = '1.0'
description = 'An example parser plugin for NOMAD.'
readme = "README.md"
authors = [{ name = "The NOMAD Authors" }]
license = { text = "Apache-2.0" }
dependencies = [
"nomad-lab>=1.2.0"
]

[project.urls]
homepage = "https://github.com/nomad-coe/nomad-parser-example-plugin"

[project.optional-dependencies]
tests = [
'pytest'
]

[tool.setuptools.packages.find]
include = ["nomadparserexample*"]

[tool.setuptools.package-data]
nomadschemaexample = ['*/nomad_plugin.yaml']
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This is not an official pypi release. You need to add our gitlab package registry
# when running pip install:
# pip install -r requirements.txt --index-url https://gitlab.mpcdf.mpg.de/api/v4/projects/2187/packages/pypi/simple
nomad-lab==1.2.0-pre
nomad-lab>=1.2.0
# To build a nomad-lab package from a regular clone of nomad-fair
# run "python -m build --sdist". Point to the resulting file here, e.g.:
# ../../../dist/nomad-lab-1.2.0.dev98+g5b6b0745a.d20230330.tar.gz
Expand Down

0 comments on commit 7dd3038

Please sign in to comment.