Skip to content

Commit

Permalink
Release PyPI Package (#37)
Browse files Browse the repository at this point in the history
* Updated pyproject.toml

* Deleted Old XRayDiffraction YAML Schema

* Updated README.md

* Added GitHub Actions Workflow
  • Loading branch information
hampusnasstrom authored Nov 29, 2023
1 parent 70f093d commit b535d8a
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 69 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -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 }}
65 changes: 28 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 [email protected]: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
```
```
### Development
This code is currently under development and for installing and contributing you should clone the repository:
```sh
git clone [email protected]:FAIRmat-NFDI/nomad-measurements.git
cd nomad-measurements
```

And install the package in editable mode:
```sh
pip install -e .
```
25 changes: 0 additions & 25 deletions XRayDiffraction/xrd.schema.archive.yaml

This file was deleted.

35 changes: 28 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 = '[email protected]' },
{ name = "Andrea Albino", email = '[email protected]' },
{ name = "Sebastian Brückner", email = '[email protected]' },
{ name = "Sarthak Kapoor", email = '[email protected]' },
]
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]

0 comments on commit b535d8a

Please sign in to comment.