diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100644 index 00000000..bdaab28a --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,39 @@ +# This workflow will upload a Python Package using Twine when a release is created +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Upload Python Package + +on: + release: + types: [published] + +permissions: + contents: read + +jobs: + deploy: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build + - name: Build package + run: python -m build + - name: Publish package + uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/README.md b/README.md index 92cd1263..4f14889f 100644 --- a/README.md +++ b/README.md @@ -1,49 +1,40 @@ -# nomad-measurements -A NOMAD plugin containing base sections for measurements. +![](https://github.com/FAIRmat-NFDI/nomad-measurements/actions/workflows/publish.yml/badge.svg) +![](https://img.shields.io/pypi/pyversions/nomad-measurements) +![](https://img.shields.io/pypi/l/nomad-measurements) +![](https://img.shields.io/pypi/v/nomad-measurements) -## Getting started -This code is currently under development and can be installed by cloning the repository: -```sh -git clone git@github.com:FAIRmat-NFDI/nomad-measurements.git -cd nomad-measurements -``` +# NOMAD's Measurements Plugin +This is a plugin for [NOMAD](https://nomad-lab.eu) which contains base sections for +material processing. -And installing the package in editable mode: +## Getting started +`nomad-measurements` can be installed from PyPI using `pip`: ```sh -pip install -e . --index-url https://gitlab.mpcdf.mpg.de/api/v4/projects/2187/packages/pypi/simple -``` - -**Note!** -Until we have an official pypi NOMAD release with the plugins functionality. Make -sure to include NOMAD's internal package registry (via `--index-url`). - - -This plugin is work in progress and an initial test. At the moment is only supporting `.xrdml` files. - -There are conflicting dependencies with the current NOMAD `develop` branch. -To test it in dev mode, you need to do the following in your NOMAD installation: - -```python -pip install xrayutilities -pip install numpy==1.24.3 -pip install numba --upgrade +pip install nomad-measurements ``` -You might get some complains saying that `scipy` needs to be upgraded too, but this should get the plugin working. - +### Setting up your OASIS Read the [NOMAD plugin documentation](https://nomad-lab.eu/prod/v1/staging/docs/plugins/plugins.html#add-a-plugin-to-your-nomad) for all details on how to deploy the plugin on your NOMAD instance. -You need to modify the ```nomad.yaml``` configuration file of your NOMAD instance. Add the following lines: . +You need to modify the ```nomad.yaml``` configuration file of your NOMAD instance. +To include, for example, the XRD plugin you need to add the following lines: . ```yaml -keycloak: - realm_name: fairdi_nomad_test plugins: - # We only include our schema here. Without the explicit include, all plugins will be - # loaded. Many build in plugins require more dependencies. Install nomad-lab[parsing] - # to make all default plugins work. include: - - 'schemas/nomad_measurements/xrd' + - 'parsers/nomad_measurements/xrd' options: - schemas/nomad_measurements/xrd: + parsers/nomad_measurements/xrd: python_package: nomad_measurements.xrd - ``` \ No newline at end of file + ``` + +### Development +This code is currently under development and for installing and contributing you should clone the repository: +```sh +git clone git@github.com:FAIRmat-NFDI/nomad-measurements.git +cd nomad-measurements +``` + +And install the package in editable mode: +```sh +pip install -e . +``` \ No newline at end of file diff --git a/XRayDiffraction/xrd.schema.archive.yaml b/XRayDiffraction/xrd.schema.archive.yaml deleted file mode 100644 index a1087eaf..00000000 --- a/XRayDiffraction/xrd.schema.archive.yaml +++ /dev/null @@ -1,25 +0,0 @@ -definitions: - name: nomad-measurements - sections: - XRDResult: - base_sections: - - nomad.datamodel.metainfo.basesections.MeasurementResult - quantities: - two_theta: - type: float - shape: ['*'] - description: | - The set 2 theta angle. - intensity: - type: float - shape: ['*'] - description: | - The measured intensity. - XRayDiffraction: - base_sections: - - nomad.datamodel.metainfo.basesections.Measurement - quantities: - method: - type: str - default: X-Ray Diffraction (XRD) - \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 392b9d58..9251025d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,23 +1,44 @@ [build-system] -requires = [ "setuptools>=61.0.0",] +requires = [ + "setuptools>=61.0.0", + "setuptools-scm>=8.0", +] build-backend = "setuptools.build_meta" [project] -name = "nomad_measurements" -version = "0.0.1" -description = "A plugin for NOMAD" +name = "nomad-measurements" +dynamic = ["version"] +description = "A plugin for NOMAD containing base sections for material processing." readme = "README.md" +authors = [ + { name = "Hampus Näsström", email = 'hampus.naesstroem@physik.hu-berlin.de' }, + { name = "Andrea Albino", email = 'andrea.albino@physik.hu-berlin.de' }, + { name = "Sebastian Brückner", email = 'sebastian.brueckner@ikz-berlin.de' }, + { name = "Sarthak Kapoor", email = 'sarthak.kapoor@physik.hu-berlin.de' }, +] requires-python = ">=3.9" -classifiers = [ "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3.9",] +classifiers = [ + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.9", + "License :: OSI Approved :: Apache Software License", +] dependencies = [ "nomad-lab>=1.2.1.dev,<1.2.2", "pytest", "structlog==22.3.0", - "xrayutilities>=1.7.4", ] [project.license] file = "LICENSE" +[project.urls] +"Homepage" = "https://github.com/FAIRmat-NFDI/nomad-measurements" +"Bug Tracker" = "https://github.com/FAIRmat-NFDI/nomad-measurements/issues" + [tool.setuptools.packages.find] -where = [ "src",] +where = [ + "src", +] + +[tool.setuptools_scm]