Skip to content

Commit 717408f

Browse files
committed
Template is recooked.
1 parent 2e379e8 commit 717408f

17 files changed

Lines changed: 532 additions & 38 deletions

.cruft.json

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"template": "git@github.com:FAIRmat-NFDI/pynxtools-plugin-template.git",
3-
"commit": "519f503945368a21d0c44125c0f34cf0d5f46e10",
3+
"commit": "616d3dc6584cb0f19e85310a083c7a87857c6b8d",
44
"checkout": null,
55
"context": {
66
"cookiecutter": {
@@ -11,18 +11,25 @@
1111
"reader_class": "SPMReader",
1212
"author_name": "The NOMAD authors",
1313
"author_email": "fairmat@physik.hu-berlin.de",
14+
"github_username": "",
15+
"organization_name": "fairmat-nfdi",
1416
"license": "Apache Software License 2.0",
1517
"zenodo_record": "17390485",
1618
"vscode_settings": true,
1719
"include_nomad_app": true,
1820
"include_nomad_example_upload": true,
21+
"include_north_tools": true,
22+
"north_tool_name": "spm",
1923
"__package_name": "pynxtools-spm",
2024
"__module_name": "pynxtools_spm",
2125
"__nomad_example": "spm_example_upload_entry_point",
22-
"__nomad_app": "",
23-
"_copy_without_render": ["*.html"],
26+
"__nomad_app": "spm_app_entry_point",
27+
"__north_tool_EP_name": "north_tool",
28+
"_copy_without_render": [
29+
"*.html"
30+
],
2431
"_template": "git@github.com:FAIRmat-NFDI/pynxtools-plugin-template.git",
25-
"_commit": "519f503945368a21d0c44125c0f34cf0d5f46e10"
32+
"_commit": "616d3dc6584cb0f19e85310a083c7a87857c6b8d"
2633
}
2734
},
2835
"directory": null

.dockerignore

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Git
2+
.gitignore
3+
.gitattributes
4+
5+
# Python
6+
__pycache__
7+
*.py[cod]
8+
*$py.class
9+
*.so
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+
.pytest_cache/
30+
31+
# Virtual Environments
32+
.venv
33+
venv/
34+
ENV/
35+
env/
36+
.venv/
37+
38+
# IDE
39+
.vscode/
40+
.idea/
41+
*.swp
42+
*.swo
43+
*~
44+
.DS_Store
45+
.project
46+
.pydevproject
47+
.settings/
48+
*.sublime-project
49+
*.sublime-workspace
50+
51+
# CI/CD
52+
.github/
53+
.gitlab-ci.yml
54+
.travis.yml
55+
.circleci/
56+
57+
# Testing
58+
.coverage
59+
.coverage.*
60+
htmlcov/
61+
.tox/
62+
.hypothesis/
63+
pytest.ini
64+
.pytest_cache/
65+
66+
# Documentation
67+
docs/_build/
68+
site/
69+
.mkdocs.yml
70+
mkdocs.yml
71+
72+
# Docker
73+
Dockerfile*
74+
.dockerignore
75+
docker/
76+
77+
# Node (if used)
78+
node_modules/
79+
npm-debug.log
80+
package-lock.json
81+
82+
# Misc
83+
*.md
84+
LICENSE
85+
MANIFEST.in
86+
*.tar.gz
87+
*.zip
88+
.tmp/
89+
.cache/
90+
91+
# IDE configuration files
92+
.editorconfig
93+
.env
94+
.env.local

.github/workflows/cruft_update.yml

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,7 @@ env:
1515
jobs:
1616
update:
1717
runs-on: ubuntu-latest
18-
strategy:
19-
fail-fast: true
20-
matrix:
21-
include:
22-
- add-paths: .
23-
body: Use this to merge the changes to this repository.
24-
branch: cruft/update
25-
commit-message: "chore: accept new Cruft update"
26-
title: New updates detected with Cruft
27-
- add-paths: .cruft.json
28-
body: Use this to reject the changes in this repository.
29-
branch: cruft/reject
30-
commit-message: "chore: reject new Cruft update"
31-
title: Reject new updates detected with Cruft
18+
3219
steps:
3320
- uses: actions/checkout@v4
3421

@@ -52,7 +39,6 @@ jobs:
5239
else
5340
echo "No .cruft.json file"
5441
fi
55-
5642
echo "has_changes=$CHANGES" >> "$GITHUB_OUTPUT"
5743
5844
- name: Run update if available
@@ -62,20 +48,29 @@ jobs:
6248
git config --global user.name "GitHub"
6349
6450
cruft update --skip-apply-ask --refresh-private-variables
65-
# git restore --staged .
51+
52+
# --------------------------------------------------------
53+
# HARD BLOCK: never allow workflow updates from Cruft
54+
# --------------------------------------------------------
55+
git restore --staged .github/workflows || true
56+
git restore .github/workflows || true
6657
6758
- name: Create pull request
6859
if: steps.check.outputs.has_changes == '1'
6960
uses: peter-evans/create-pull-request@v4
7061
with:
7162
token: ${{ secrets.GITHUB_TOKEN }}
72-
add-paths: ${{ matrix.add-paths }}
73-
commit-message: ${{ matrix.commit-message }}
74-
branch: ${{ matrix.branch }}
63+
add-paths: .
64+
commit-message: "chore: accept new Cruft update"
65+
branch: cruft/update
7566
delete-branch: true
7667
branch-suffix: timestamp
77-
title: ${{ matrix.title }}
68+
title: New updates detected with Cruft
7869
body: |
79-
This is an autogenerated PR. ${{ matrix.body }}
70+
This is an autogenerated PR.
71+
72+
[Cruft](https://cruft.github.io/cruft/) has detected updates from the
73+
Cookiecutter repository.
8074
81-
[Cruft](https://cruft.github.io/cruft/) has detected updates from the Cookiecutter repository.
75+
Changes to `.github/workflows` are intentionally excluded
76+
from automated updates and must be applied manually.

.github/workflows/nomad-requirements.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ jobs:
3939
- name: Generate (dev-)requirements.txt from modified pyproject.toml
4040
working-directory: ./nomad
4141
run: |
42-
uv pip compile --universal -p ${{ env.python-version }} --annotation-style=line --extra=infrastructure --extra=parsing --output-file=requirements.txt pyproject.toml
43-
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
42+
uv pip compile --universal -p ${{ env.python-version }} --annotation-style=line --extra=infrastructure --output-file=requirements.txt pyproject.toml
43+
uv pip compile --universal -p ${{ env.python-version }} --annotation-style=line --extra=dev --extra=infrastructure --output-file=requirements-dev.txt requirements.txt pyproject.toml
4444
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
4545
- name: Install NOMAD dependencies with pynxtools from current branch
4646
working-directory: ./nomad
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
name: Build and publish docker images
2+
on:
3+
push:
4+
branches:
5+
- main
6+
tags:
7+
- "v*.*.*"
8+
pull_request:
9+
branches:
10+
- main
11+
12+
env:
13+
REGISTRY: ghcr.io
14+
UV_VERSION: 0.9
15+
PYTHON_VERSION: 3.12
16+
JUPYTER_VERSION: 2025-12-31
17+
NORTH_TOOL_DIR: src/pynxtools_spm/nomad/north_tools/spm
18+
TEST_DATA_DIR: tests/data/north_tools/spm
19+
TEST_NOTEBOOKS: CommandLine.ipynb
20+
21+
permissions:
22+
packages: write
23+
contents: read
24+
attestations: write
25+
id-token: write
26+
27+
jobs:
28+
build:
29+
name: Build Jupyter Image
30+
runs-on: ubuntu-latest
31+
outputs:
32+
tags: ${{ steps.meta.outputs.tags }} # list
33+
labels: ${{ steps.meta.outputs.labels }} # list
34+
steps:
35+
- uses: actions/checkout@v4
36+
with:
37+
ref: ${{ github.head_ref || github.ref_name }}
38+
fetch-depth: 0
39+
show-progress: true
40+
submodules: true
41+
42+
# Replace driver `Docker' by `Docker-container` to support cache export/import
43+
- name: Set up Docker Buildx
44+
uses: docker/setup-buildx-action@v3
45+
46+
# https://github.com/docker/metadata-action
47+
- name: Extract Docker metadata
48+
id: meta
49+
uses: docker/metadata-action@v5
50+
with:
51+
images: ${{ env.REGISTRY }}/${{ github.repository }}
52+
# set latest tag for main branch and tags
53+
# https://github.com/docker/metadata-action?tab=readme-ov-file#image-name-and-tag-sanitization
54+
tags: |
55+
type=ref,event=tag
56+
type=ref,event=pr,prefix=pr-
57+
type=raw,value=main,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
58+
flavor: |
59+
latest=auto
60+
61+
# https://docs.docker.com/build/ci/github-actions/share-image-jobs/
62+
# https://github.com/docker/build-push-action
63+
- name: Build and export to Jupyter image
64+
uses: docker/build-push-action@v6
65+
with:
66+
context: .
67+
file: ${{ env.NORTH_TOOL_DIR }}/Dockerfile
68+
build-args: |
69+
UV_VERSION=${{ env.UV_VERSION }}
70+
JUPYTER_TAG=${{ env.JUPYTER_VERSION }}
71+
cache-from: type=gha
72+
cache-to: type=gha,mode=max
73+
push: false
74+
tags: ${{ steps.meta.outputs.tags }}
75+
labels: ${{ steps.meta.outputs.labels }}
76+
outputs: type=docker,dest=${{ runner.temp }}/jupyter.tar.gz
77+
- name: Upload artifact
78+
uses: actions/upload-artifact@v4
79+
with:
80+
name: jupyter-image
81+
path: ${{ runner.temp }}/jupyter.tar.gz
82+
test_and_push_image:
83+
name: Test Jupyter Image
84+
needs: build
85+
runs-on: ubuntu-latest
86+
# https://docs.docker.com/build/ci/github-actions/share-image-jobs/
87+
steps:
88+
- name: Setup Repository
89+
uses: actions/checkout@v4
90+
- name: Download artifact
91+
uses: actions/download-artifact@v4
92+
with:
93+
name: jupyter-image
94+
path: ${{ runner.temp }}
95+
pattern: "!*.dockerbuild" # warning at https://github.com/docker/build-push-action?tab=readme-ov-file
96+
97+
- name: Load and test in Jupyter container
98+
run: |
99+
docker load -i ${{ runner.temp }}/jupyter.tar.gz
100+
101+
RAW_TAGS="${{ needs.build.outputs.tags }}"
102+
echo "Raw tags: $RAW_TAGS"
103+
FIRST_TAG=$(echo "$RAW_TAGS" | tr -s '[:space:]' '\n' | grep -v '^$' | head -n 1)
104+
echo "Using tag: $FIRST_TAG"
105+
106+
for nb in ${{ env.TEST_NOTEBOOKS }}; do
107+
echo "Running notebook: $nb"
108+
docker run \
109+
--mount type=bind,src=./${{ env.TEST_DATA_DIR }},dst="/home/jovyan/north_test" \
110+
--rm "$FIRST_TAG" \
111+
/bin/bash -c "jupyter execute \$HOME/north_test/$nb"
112+
done
113+
114+
- uses: docker/login-action@v3
115+
with:
116+
registry: ${{ env.REGISTRY }}
117+
username: ${{ github.actor }}
118+
password: ${{ secrets.GITHUB_TOKEN }}
119+
- name: Push Jupyter Image
120+
run: |
121+
RAW_TAGS="${{ needs.build.outputs.tags }}"
122+
for TAG in $RAW_TAGS; do
123+
echo "Pushing tag: $TAG"
124+
docker push "$TAG"
125+
done

.pre-commit-config.yaml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,28 @@ repos:
66
# Run the linter.
77
- id: ruff
88
# Run the formatter.
9-
- id: ruff-format
9+
- id: ruff-format
10+
11+
- repo: https://github.com/pre-commit/mirrors-mypy
12+
rev: v1.7.1
13+
hooks:
14+
- id: mypy # static type checking
15+
16+
- repo: https://github.com/asottile/pyupgrade
17+
rev: v2.37.3
18+
hooks:
19+
- id: pyupgrade
20+
args: [--py36-plus] # modernizes syntax for Python 3.6+
21+
22+
- repo: https://github.com/kynan/nbstripout
23+
rev: 0.6.0
24+
hooks:
25+
- id: nbstripout # removes notebook outputs before committing
26+
27+
- repo: https://github.com/streetsidesoftware/cspell-cli
28+
rev: v6.31.1
29+
hooks:
30+
- id: cspell # spellchecking
31+
pass_filenames: false
32+
args:
33+
- --config

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
.
1414

15-
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.
15+
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.
1616

1717
## Installation
1818

0 commit comments

Comments
 (0)