Skip to content

Commit eedeb51

Browse files
Merge pull request #26 from easyscience/develop
Release: merge develop into master
2 parents 2d4f4a8 + 82bf41f commit eedeb51

8 files changed

Lines changed: 54 additions & 67 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.3.1
3+
_commit: v0.4.1-1-gd3a985d
44
_src_path: gh:easyscience/templates
55
app_docs_url: https://easyscience.github.io/peasy-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 easypeasy"
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/easypeasy/settings/publishing/
39+
# Use the following data:
40+
# Owner: easyscience
41+
# Repository name: peasy-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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jobs:
8080
shell: bash
8181
run: pixi run nonpy-format-check
8282
# Check formatting of Jupyter Notebooks in the tutorials folder
83-
- name: Convert tutorial scripts to notebooks and check formatting
83+
- name: Prepare notebooks and check formatting
8484
id: check_notebooks_formatting
8585
continue-on-error: true
8686
shell: bash

.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

.pre-commit-config.yaml

Lines changed: 25 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +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

1414
- id: pixi-py-lint-check
15-
name: pixi run py-lint-check-pre STAGED_FILES
16-
entry: pixi run py-lint-check-pre
15+
name: pixi run py-lint-check
16+
entry: pixi run py-lint-check
1717
language: system
18-
pass_filenames: true
19-
files: ^(src/|tests/|docs/docs/tutorials/).*\.py$
20-
stages: [pre-commit]
18+
pass_filenames: false
19+
stages: [manual]
2120

2221
- id: pixi-py-format-check
23-
name: pixi run py-format-check-pre STAGED_FILES
24-
entry: pixi run py-format-check-pre
22+
name: pixi run py-format-check
23+
entry: pixi run py-format-check
2524
language: system
26-
pass_filenames: true
27-
files: ^(src/|tests/|docs/docs/tutorials/).*\.py$
28-
stages: [pre-commit]
25+
pass_filenames: false
26+
stages: [manual]
2927

3028
- id: pixi-nonpy-format-check
31-
name: pixi run nonpy-format-check-pre STAGED_FILES
32-
entry: pixi run nonpy-format-check-pre
29+
name: pixi run nonpy-format-check
30+
entry: pixi run nonpy-format-check
3331
language: system
34-
pass_filenames: true
35-
stages: [pre-commit]
32+
pass_filenames: false
33+
stages: [manual]
3634

3735
- id: pixi-docs-format-check
38-
name: pixi run docs-format-check-pre STAGED_FILES
39-
entry: pixi run docs-format-check-pre
36+
name: pixi run docs-format-check
37+
entry: pixi run docs-format-check
4038
language: system
41-
pass_filenames: true
42-
files: ^(src/|docs/docs/tutorials/).*\.py$
43-
stages: [pre-commit]
39+
pass_filenames: false
40+
stages: [manual]
4441

45-
# ----------------
46-
# Pre-push checks
47-
# ----------------
48-
- id: pixi-nonpy-format-check
49-
name: pixi run nonpy-format-check
50-
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
5145
language: system
5246
pass_filenames: false
53-
stages: [pre-push]
47+
stages: [manual]
5448

5549
- id: pixi-unit-tests
5650
name: pixi run unit-tests
5751
entry: pixi run unit-tests
5852
language: system
5953
pass_filenames: false
60-
stages: [pre-push]
54+
stages: [manual]

pixi.toml

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,7 @@ py-format-check = "ruff format --check src/ tests/ docs/docs/tutorials/"
9999
nonpy-format-check = "npx prettier --list-different --config=prettierrc.toml --ignore-unknown ."
100100
nonpy-format-check-modified = "python tools/nonpy_prettier_modified.py"
101101

102-
check = { depends-on = [
103-
'py-format-check',
104-
'docs-format-check',
105-
'py-lint-check',
106-
'nonpy-format-check-modified',
107-
] }
102+
check = 'pre-commit run --hook-stage manual --all-files'
108103

109104
##########
110105
# 🛠️ Fixes
@@ -122,7 +117,8 @@ fix = { depends-on = [
122117
'py-format-fix',
123118
'docs-format-fix',
124119
'py-lint-fix',
125-
'nonpy-format-fix-modified',
120+
'nonpy-format-fix',
121+
'notebook-format-fix',
126122
'success-message-fix',
127123
] }
128124

@@ -194,19 +190,6 @@ copier-update = "copier update --data-file ../peasy/.copier-answers.yml --data t
194190
# 🪝 Pre-commit Hooks
195191
#####################
196192

197-
# Pre-commit hook commands (to be used in .pre-commit-config.yaml)
198-
py-lint-check-pre = 'ruff check'
199-
py-format-check-pre = "ruff format --check"
200-
nonpy-format-check-pre = "npx prettier --list-different --config=prettierrc.toml --ignore-unknown"
201-
docs-format-check-pre = 'docformatter --check'
202-
203-
# Run like a real commit: staged files only (almost)
204-
pre-commit-check = 'pre-commit run --hook-stage pre-commit'
205-
# CI check: lint/format everything
206-
pre-commit-check-all = 'pre-commit run --all-files --hook-stage pre-commit'
207-
# Pre-push check: lint/format everything
208-
pre-push-check = 'pre-commit run --all-files --hook-stage pre-push'
209-
210193
pre-commit-clean = 'pre-commit clean'
211194
pre-commit-install = 'pre-commit install --hook-type pre-commit --hook-type pre-push --overwrite'
212195
pre-commit-uninstall = 'pre-commit uninstall --hook-type pre-commit --hook-type pre-push'
@@ -234,7 +217,7 @@ spdx-update = 'python tools/update_spdx.py'
234217
post-install = { depends-on = [
235218
'npm-config',
236219
'prettier-install',
237-
'pre-commit-setup',
220+
#'pre-commit-setup',
238221
] }
239222

240223
##########################

0 commit comments

Comments
 (0)