Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "git@github.com:FAIRmat-NFDI/pynxtools-plugin-template.git",
"commit": "519f503945368a21d0c44125c0f34cf0d5f46e10",
"commit": "616d3dc6584cb0f19e85310a083c7a87857c6b8d",
"checkout": null,
"context": {
"cookiecutter": {
Expand All @@ -11,18 +11,25 @@
"reader_class": "SPMReader",
"author_name": "The NOMAD authors",
"author_email": "fairmat@physik.hu-berlin.de",
"github_username": "",
"organization_name": "fairmat-nfdi",
"license": "Apache Software License 2.0",
"zenodo_record": "17390485",
"vscode_settings": false,
"vscode_settings": true,
"include_nomad_app": true,
"include_nomad_example_upload": true,
"include_north_tools": true,
"north_tool_name": "spm",
"__package_name": "pynxtools-spm",
"__module_name": "pynxtools_spm",
"__nomad_example": "spm_example_upload_entry_point",
"__nomad_app": "",
"_copy_without_render": ["*.html"],
"__nomad_app": "spm_app_entry_point",
"__north_tool_EP_name": "north_tool",
"_copy_without_render": [
"*.html"
],
"_template": "git@github.com:FAIRmat-NFDI/pynxtools-plugin-template.git",
"_commit": "519f503945368a21d0c44125c0f34cf0d5f46e10"
"_commit": "616d3dc6584cb0f19e85310a083c7a87857c6b8d"
}
},
"directory": null
Expand Down
4 changes: 4 additions & 0 deletions .cspell/custom-dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,7 @@ ureg
valinit
valtext
Yichen
FAIRmat
fairmat
jovyan
ipynb
94 changes: 94 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Git
.gitignore
.gitattributes

# Python
__pycache__
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
.pytest_cache/

# Virtual Environments
.venv
venv/
ENV/
env/
.venv/

# IDE
.vscode/
.idea/
*.swp
*.swo
*~
.DS_Store
.project
.pydevproject
.settings/
*.sublime-project
*.sublime-workspace

# CI/CD
.github/
.gitlab-ci.yml
.travis.yml
.circleci/

# Testing
.coverage
.coverage.*
htmlcov/
.tox/
.hypothesis/
pytest.ini
.pytest_cache/

# Documentation
docs/_build/
site/
.mkdocs.yml
mkdocs.yml

# Docker
Dockerfile*
.dockerignore
docker/

# Node (if used)
node_modules/
npm-debug.log
package-lock.json

# Misc
*.md
LICENSE
MANIFEST.in
*.tar.gz
*.zip
.tmp/
.cache/

# IDE configuration files
.editorconfig
.env
.env.local
39 changes: 17 additions & 22 deletions .github/workflows/cruft_update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,7 @@ env:
jobs:
update:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
include:
- add-paths: .
body: Use this to merge the changes to this repository.
branch: cruft/update
commit-message: "chore: accept new Cruft update"
title: New updates detected with Cruft
- add-paths: .cruft.json
body: Use this to reject the changes in this repository.
branch: cruft/reject
commit-message: "chore: reject new Cruft update"
title: Reject new updates detected with Cruft

steps:
- uses: actions/checkout@v4

Expand All @@ -52,7 +39,6 @@ jobs:
else
echo "No .cruft.json file"
fi

echo "has_changes=$CHANGES" >> "$GITHUB_OUTPUT"

- name: Run update if available
Expand All @@ -62,20 +48,29 @@ jobs:
git config --global user.name "GitHub"

cruft update --skip-apply-ask --refresh-private-variables
# git restore --staged .

# --------------------------------------------------------
# HARD BLOCK: never allow workflow updates from Cruft
# --------------------------------------------------------
git restore --staged .github/workflows || true
git restore .github/workflows || true

- name: Create pull request
if: steps.check.outputs.has_changes == '1'
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
add-paths: ${{ matrix.add-paths }}
commit-message: ${{ matrix.commit-message }}
branch: ${{ matrix.branch }}
add-paths: .
commit-message: "chore: accept new Cruft update"
branch: cruft/update
delete-branch: true
branch-suffix: timestamp
title: ${{ matrix.title }}
title: New updates detected with Cruft
body: |
This is an autogenerated PR. ${{ matrix.body }}
This is an autogenerated PR.

[Cruft](https://cruft.github.io/cruft/) has detected updates from the
Cookiecutter repository.

[Cruft](https://cruft.github.io/cruft/) has detected updates from the Cookiecutter repository.
Changes to `.github/workflows` are intentionally excluded
from automated updates and must be applied manually.
4 changes: 2 additions & 2 deletions .github/workflows/nomad-requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ jobs:
- name: Generate (dev-)requirements.txt from modified pyproject.toml
working-directory: ./nomad
run: |
uv pip compile --universal -p ${{ env.python-version }} --annotation-style=line --extra=infrastructure --extra=parsing --output-file=requirements.txt pyproject.toml
uv pip compile --universal -p ${{ env.python-version }} --annotation-style=line --extra=dev --extra=infrastructure --extra=parsing --output-file=requirements-dev.txt requirements.txt pyproject.toml
uv pip compile --universal -p ${{ env.python-version }} --annotation-style=line --extra=infrastructure --output-file=requirements.txt pyproject.toml
uv pip compile --universal -p ${{ env.python-version }} --annotation-style=line --extra=dev --extra=infrastructure --output-file=requirements-dev.txt requirements.txt pyproject.toml
uv pip compile --universal -p ${{ env.python-version }} --annotation-style=line --output-file=requirements-plugins.txt --unsafe-package nomad-lab -c requirements-dev.txt test_plugins.txt
- name: Install NOMAD dependencies with pynxtools from current branch
working-directory: ./nomad
Expand Down
125 changes: 125 additions & 0 deletions .github/workflows/publish-north.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
name: Build and publish docker images
on:
push:
branches:
- main
tags:
- "v*.*.*"
pull_request:
branches:
- main

env:
REGISTRY: ghcr.io
UV_VERSION: 0.9
PYTHON_VERSION: 3.12
JUPYTER_VERSION: 2025-12-31
NORTH_TOOL_DIR: src/pynxtools_spm/nomad/north_tools/spm
TEST_DATA_DIR: tests/data/north_tools/spm
TEST_NOTEBOOKS: CommandLine.ipynb

permissions:
packages: write
contents: read
attestations: write
id-token: write

jobs:
build:
name: Build Jupyter Image
runs-on: ubuntu-latest
outputs:
tags: ${{ steps.meta.outputs.tags }} # list
labels: ${{ steps.meta.outputs.labels }} # list
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref || github.ref_name }}
fetch-depth: 0
show-progress: true
submodules: true

# Replace driver `Docker' by `Docker-container` to support cache export/import
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}
# set latest tag for main branch and tags
# https://github.com/docker/metadata-action?tab=readme-ov-file#image-name-and-tag-sanitization
tags: |
type=ref,event=tag
type=ref,event=pr,prefix=pr-
type=raw,value=main,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
flavor: |
latest=auto

# https://docs.docker.com/build/ci/github-actions/share-image-jobs/
# https://github.com/docker/build-push-action
- name: Build and export to Jupyter image
uses: docker/build-push-action@v6
with:
context: .
file: ${{ env.NORTH_TOOL_DIR }}/Dockerfile
build-args: |
UV_VERSION=${{ env.UV_VERSION }}
JUPYTER_TAG=${{ env.JUPYTER_VERSION }}
cache-from: type=gha
cache-to: type=gha,mode=max
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=docker,dest=${{ runner.temp }}/jupyter.tar.gz
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: jupyter-image
path: ${{ runner.temp }}/jupyter.tar.gz
test_and_push_image:
name: Test Jupyter Image
needs: build
runs-on: ubuntu-latest
# https://docs.docker.com/build/ci/github-actions/share-image-jobs/
steps:
- name: Setup Repository
uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: jupyter-image
path: ${{ runner.temp }}
pattern: "!*.dockerbuild" # warning at https://github.com/docker/build-push-action?tab=readme-ov-file

- name: Load and test in Jupyter container
run: |
docker load -i ${{ runner.temp }}/jupyter.tar.gz

RAW_TAGS="${{ needs.build.outputs.tags }}"
echo "Raw tags: $RAW_TAGS"
FIRST_TAG=$(echo "$RAW_TAGS" | tr -s '[:space:]' '\n' | grep -v '^$' | head -n 1)
echo "Using tag: $FIRST_TAG"

for nb in ${{ env.TEST_NOTEBOOKS }}; do
echo "Running notebook: $nb"
docker run \
--mount type=bind,src=./${{ env.TEST_DATA_DIR }},dst="/home/jovyan/north_test" \
--rm "$FIRST_TAG" \
/bin/bash -c "jupyter execute \$HOME/north_test/$nb"
done

- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push Jupyter Image
run: |
RAW_TAGS="${{ needs.build.outputs.tags }}"
for TAG in $RAW_TAGS; do
echo "Pushing tag: $TAG"
docker push "$TAG"
done
26 changes: 25 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,28 @@ repos:
# Run the linter.
- id: ruff
# Run the formatter.
- id: ruff-format
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.7.1
hooks:
- id: mypy # static type checking

- repo: https://github.com/asottile/pyupgrade
rev: v2.37.3
hooks:
- id: pyupgrade
args: [--py36-plus] # modernizes syntax for Python 3.6+

- repo: https://github.com/kynan/nbstripout
rev: 0.6.0
hooks:
- id: nbstripout # removes notebook outputs before committing

- repo: https://github.com/streetsidesoftware/cspell-cli
rev: v6.31.1
hooks:
- id: cspell # spellchecking
pass_filenames: false
args:
- --config
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

.

This `pynxtools` plugin was generated with [`cookiecutter`](https://github.com/cookiecutter/cookiecutter) using the [`pynxtools-plugin-template`](https://github.com/FAIRmat-NFDI/`pynxtools-plugin-template) template.
This `pynxtools` plugin was generated with [`cookiecutter`](https://github.com/cookiecutter/cookiecutter) using the [`pynxtools-plugin-template`](https://github.com/FAIRmat-NFDI/pynxtools-plugin-template) template.

## Installation

Expand Down
Loading
Loading