Skip to content

Commit 809e3a7

Browse files
AndrewSazonovhenrikjacobsenfys
authored andcommitted
Reapply updated Copier templates and streamline developer workflow (#97)
* Update pixi.lock * Reapply templates from v0.4.0 * pixi run fix-all * Switch to manual pre-commit and simplify tasks * Enable PyPI Trusted Publishing via OIDC * Reorder imports and widget magic in notebooks * Normalize notebook cell IDs
1 parent 78698be commit 809e3a7

19 files changed

Lines changed: 437 additions & 154 deletions

File tree

.copier-answers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# WARNING: Do not edit this file manually.
22
# Any changes will be overwritten by Copier.
3-
_commit: v0.0.5
3+
_commit: v0.4.2
44
_src_path: gh:easyscience/templates
55
app_docs_url: https://easyscience.github.io/dynamics-app
66
app_doi: 10.5281/zenodo.18163581
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
name: 'Publish to PyPI'
2-
description: 'Publish a built distribution to PyPI using pypa/gh-action-pypi-publish'
2+
description: 'Publish dist/ to PyPI via Trusted Publishing (OIDC)'
33
inputs:
4-
password:
5-
description: 'PyPI API token (or password) for authentication'
6-
required: true
4+
packages_dir:
5+
description: 'Directory containing the built packages to upload'
6+
required: false
7+
default: 'dist'
78

89
runs:
910
using: 'composite'
1011
steps:
1112
- uses: pypa/gh-action-pypi-publish@release/v1
1213
with:
13-
password: ${{ inputs.password }}
14+
packages-dir: ${{ inputs.packages_dir }}

.github/workflows/docs.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,8 @@ jobs:
107107
- name: Pre-build site step
108108
run: pixi run python -c "import easydynamics"
109109

110-
# Convert Python scripts in the docs/docs/tutorials/ directory to Jupyter
111-
# notebooks.
112-
# This step also strips any existing output from the notebooks and
113-
# prepares them for documentation.
114-
- name: Convert tutorial scripts to notebooks
110+
# Prepare the Jupyter notebooks for documentation (strip output, etc.).
111+
- name: Prepare notebooks
115112
run: pixi run notebook-prepare
116113

117114
# Execute all Jupyter notebooks to generate output cells (plots, tables, etc.).

.github/workflows/pypi-publish.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ jobs:
1414
pypi-publish:
1515
runs-on: ubuntu-latest
1616

17+
permissions:
18+
contents: read
19+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
20+
1721
steps:
1822
- name: Check-out repository
1923
uses: actions/checkout@v5
@@ -23,10 +27,18 @@ jobs:
2327
- name: Set up pixi
2428
uses: ./.github/actions/setup-pixi
2529

30+
# Build the Python package (to dist/ folder)
2631
- name: Create Python package
2732
run: pixi run default-build
2833

34+
# Publish the package to PyPI (from dist/ folder)
35+
# Instead of publishing with personal access token, we use
36+
# GitHub Actions OIDC to get a short-lived token from PyPI.
37+
# New publisher must be previously configured in PyPI at
38+
# https://pypi.org/manage/project/easydynamics/settings/publishing/
39+
# Use the following data:
40+
# Owner: easyscience
41+
# Repository name: dynamics-lib
42+
# Workflow name: pypi-publish.yml
2943
- name: Publish to PyPI
3044
uses: ./.github/actions/publish-to-pypi
31-
with:
32-
password: ${{ secrets.PYPI_PASSWORD }}

.github/workflows/quality.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,14 @@ jobs:
7979
continue-on-error: true
8080
shell: bash
8181
run: pixi run nonpy-format-check
82+
# Check formatting of Jupyter Notebooks in the tutorials folder
83+
- name: Prepare notebooks and check formatting
84+
id: check_notebooks_formatting
85+
continue-on-error: true
86+
shell: bash
87+
run: |
88+
pixi run notebook-prepare
89+
pixi run notebook-format-check
8290
8391
# Add summary
8492
- name: Add quality checks summary

.github/workflows/tutorial-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
shell: bash
4747
run: pixi run script-tests
4848

49-
- name: Convert tutorial scripts to notebooks
49+
- name: Prepare notebooks
5050
shell: bash
5151
run: pixi run notebook-prepare
5252

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ __pycache__/
33
.venv/
44
.coverage
55

6+
# PyInstaller
7+
dist/
8+
build/
9+
*.spec
10+
611
# MkDocs
712
docs/site/
813

.pre-commit-config.yaml

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,54 @@
11
repos:
22
- repo: local
33
hooks:
4-
# -----------------
5-
# Pre-commit checks
6-
# -----------------
4+
# -------------
5+
# Manual checks
6+
# -------------
77
- id: pixi-pyproject-check
88
name: pixi run pyproject-check
99
entry: pixi run pyproject-check
1010
language: system
1111
pass_filenames: false
12-
stages: [pre-commit]
12+
stages: [manual]
1313

14-
- id: pixi-py-lint-check-staged
15-
name: pixi run py-lint-check-staged
16-
entry: pixi run py-lint-check-pre
14+
- id: pixi-py-lint-check
15+
name: pixi run py-lint-check
16+
entry: pixi run py-lint-check
1717
language: system
1818
pass_filenames: false
19-
stages: [pre-commit]
19+
stages: [manual]
2020

21-
- id: pixi-py-format-check-staged
22-
name: pixi run py-format-check-staged
23-
entry: pixi run py-format-check-pre
21+
- id: pixi-py-format-check
22+
name: pixi run py-format-check
23+
entry: pixi run py-format-check
2424
language: system
2525
pass_filenames: false
26-
stages: [pre-commit]
26+
stages: [manual]
2727

28-
- id: pixi-nonpy-format-check-modified
29-
name: pixi run nonpy-format-check-modified
30-
entry: pixi run nonpy-format-check-modified
28+
- id: pixi-nonpy-format-check
29+
name: pixi run nonpy-format-check
30+
entry: pixi run nonpy-format-check
3131
language: system
3232
pass_filenames: false
33-
stages: [pre-commit]
33+
stages: [manual]
3434

3535
- id: pixi-docs-format-check
3636
name: pixi run docs-format-check
3737
entry: pixi run docs-format-check
3838
language: system
3939
pass_filenames: false
40-
stages: [pre-commit]
40+
stages: [manual]
4141

42-
# ----------------
43-
# Pre-push checks
44-
# ----------------
45-
- id: pixi-nonpy-format-check
46-
name: pixi run nonpy-format-check
47-
entry: pixi run nonpy-format-check
42+
- id: pixi-notebook-format-check
43+
name: pixi run notebook-format-check
44+
entry: pixi run notebook-format-check
4845
language: system
4946
pass_filenames: false
50-
stages: [pre-push]
47+
stages: [manual]
5148

5249
- id: pixi-unit-tests
5350
name: pixi run unit-tests
5451
entry: pixi run unit-tests
5552
language: system
5653
pass_filenames: false
57-
stages: [pre-push]
54+
stages: [manual]

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
<p>
22
<picture>
33
<!-- light mode logo -->
4-
<source media='(prefers-color-scheme: light)' srcset='https://raw.githubusercontent.com/easyscience/dynamics-lib/refs/heads/master/docs/docs/assets/images/logo_light.svg'>
4+
<source media='(prefers-color-scheme: light)' srcset='https://raw.githubusercontent.com/easyscience/assets-branding/refs/heads/master/easydynamics/logos/light.svg'>
55
<!-- dark mode logo -->
6-
<source media='(prefers-color-scheme: dark)' srcset='https://raw.githubusercontent.com/easyscience/dynamics-lib/refs/heads/master/docs/docs/assets/images/logo_dark.svg'>
6+
<source media='(prefers-color-scheme: dark)' srcset='https://raw.githubusercontent.com/easyscience/assets-branding/refs/heads/master/easydynamics/logos/dark.svg'>
77
<!-- default logo == light mode logo -->
8-
<img src='https://raw.githubusercontent.com/easyscience/dynamics-lib/refs/heads/master/docs/docs/assets/images/logo_light.svg' alt='EasyDynamics'>
8+
<img src='https://raw.githubusercontent.com/easyscience/assets-branding/refs/heads/master/easydynamics/logos/light.svg' alt='EasyDynamics'>
99
</picture>
1010
</p>
1111

12-
**EasyDynamics** is a scientific software for plotting and fitting qens
13-
and ins powder data.
12+
**EasyDynamics** is a scientific software for plotting and fitting QENS
13+
and INS powder data.
14+
15+
<!-- HOME REPOSITORY SECTION -->
1416

1517
**EasyDynamics** is available both as a Python library and as a
1618
cross-platform desktop application.

docs/docs/assets/stylesheets/extra.css

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,27 @@ Adjust the margins and paddings to fit the defaults in MkDocs Material and do no
222222
width: 100% !important;
223223
display: flex !important;
224224
}
225+
225226
.jp-Notebook {
226227
padding: 0 !important;
227228
margin-top: -3em !important;
229+
230+
/* Ensure notebook content stretches across the page */
231+
width: 100% !important;
232+
max-width: 100% !important;
233+
234+
/* mkdocs-material + some notebook HTML end up as flex */
235+
align-items: stretch !important;
236+
}
237+
238+
.jp-Notebook .jp-Cell {
239+
/* Key: flex children often need min-width: 0 to prevent weird shrink */
240+
width: 100% !important;
241+
max-width: 100% !important;
242+
min-width: 0 !important;
243+
244+
/* Removes jupyter cell paddings */
245+
padding-left: 0 !important;
228246
}
229247

230248
/* Removes jupyter cell prefixes, like In[123]: */
@@ -234,11 +252,6 @@ Adjust the margins and paddings to fit the defaults in MkDocs Material and do no
234252
display: none !important;
235253
}
236254

237-
/* Removes jupyter cell paddings */
238-
.jp-Cell {
239-
padding-left: 0 !important;
240-
}
241-
242255
/* Removes jupyter output cell padding to align with input cell text */
243256
.jp-RenderedText {
244257
padding-left: 0.85em !important;

0 commit comments

Comments
 (0)