Skip to content

Commit 9fb9383

Browse files
Merge pull request #179 from easyscience/develop
Release: merge develop into master
2 parents 051fe8f + 57f00e1 commit 9fb9383

351 files changed

Lines changed: 48573 additions & 16781 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.codecov.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Codecov configuration
2+
# https://docs.codecov.com/docs/codecov-yaml
3+
4+
github_checks:
5+
annotations: true
6+
7+
comment:
8+
layout: 'reach, diff, flags, files'
9+
behavior: default
10+
require_changes: false
11+
require_base: false
12+
require_head: true
13+
14+
coverage:
15+
status:
16+
project:
17+
default:
18+
target: auto
19+
threshold: 1%
20+
# Make project coverage informational (won't block PR)
21+
informational: true
22+
patch:
23+
default:
24+
target: auto
25+
# Require patch coverage but with threshold
26+
threshold: 1%

.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.11.0-7-gb5113cf
3+
_commit: v0.11.4
44
_src_path: gh:easyscience/templates
55
app_docs_url: https://easyscience.github.io/diffraction-app
66
app_doi: 10.5281/zenodo.18163581

.github/actions/setup-pixi/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ inputs:
3333
runs:
3434
using: 'composite'
3535
steps:
36-
- uses: prefix-dev/setup-pixi@v0.9.4
36+
- uses: prefix-dev/setup-pixi@v0.9.5
3737
with:
3838
environments: ${{ inputs.environments }}
3939
activate-environment: ${{ inputs.activate-environment }}

.github/copilot-instructions.md

Lines changed: 49 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@
3434
- One class per file when substantial; group small related classes.
3535
- No `**kwargs` — use explicit keyword arguments.
3636
- No string-based dispatch (e.g. `getattr(self, f'_{name}')`); write
37-
named methods (`_set_sample_form`, `_set_beam_mode`).
37+
named methods (`_set_sample_form`, `_set_beam_mode`). Narrow framework
38+
metadata lookups are allowed when the attribute name is a class-level
39+
declaration, is not user input, and is validated in one central place;
40+
for example, `CategoryItem._category_entry_name`.
3841
- Public attrs are either editable (getter+setter property) or read-only
3942
(getter only). For internal mutation of read-only props, use a private
4043
`_set_<name>` method, not a public setter.
@@ -77,7 +80,7 @@
7780
## Testing
7881

7982
- Every new module, class, or bug fix ships with tests. See
80-
`docs/architecture/architecture.md` §10 for the full strategy.
83+
`docs/dev/adrs/accepted/test-strategy.md` for the full strategy.
8184
- Unit tests mirror the source tree:
8285
`src/easydiffraction/<pkg>/<mod>.py`
8386
`tests/unit/easydiffraction/<pkg>/test_<mod>.py`. Verify with
@@ -102,8 +105,11 @@
102105

103106
- Before any structural/design change (new categories, factories,
104107
switchable-category wiring, datablocks, CIF serialisation), read
105-
`docs/architecture/architecture.md` and follow documented patterns.
106-
Localised bug fixes or test updates need only this file.
108+
`docs/dev/adrs/index.md` and the relevant accepted ADRs. Localised bug
109+
fixes or test updates need only this file.
110+
- Development documentation lives under `docs/dev/`. Use
111+
`docs/dev/adrs/index.md` as the architecture and decision navigation
112+
surface; there is no separate `architecture.md` source of truth.
107113
- Project is in beta: no legacy shims, no deprecation warnings — update
108114
tests and tutorials to the current API.
109115
- Minimal diffs; don't reformat working code. Fix only what's asked;
@@ -112,7 +118,10 @@
112118
resolves them.
113119
- Never remove or replace existing functionality without explicit
114120
confirmation — highlight every removal and wait for approval.
115-
- When renaming, grep the entire project (code, tests, tutorials, docs).
121+
- When renaming or auditing usages, search the entire project (code,
122+
tests, tutorials, docs). Use `git grep -n` because all contributors
123+
have Git; do not assume `rg` is installed. If `git grep` is
124+
unavailable, fall back to `find ... -type f` plus `grep -n`.
116125
- Each change is atomic and single-commit-sized: make one change,
117126
suggest the commit message, then stop and wait for confirmation.
118127
- When in doubt, ask.
@@ -137,35 +146,51 @@
137146

138147
Non-trivial changes use a two-phase workflow:
139148

140-
- **Phase 1 — Implementation.** Code, docs, and architecture updates
141-
only. Do not create or run tests unless the user explicitly asks. When
142-
done, present for review and iterate until approved.
149+
- **Phase 1 — Implementation.** Code and docs updates only. Update ADRs
150+
when the change affects architecture or documented decisions. Do not
151+
create or run tests unless the user explicitly asks. When done,
152+
present for review and iterate until approved.
143153
- **Phase 2 — Verification.** Add/update tests, then run `pixi run fix`,
144154
`pixi run check`, `pixi run unit-tests`, `pixi run integration-tests`,
145155
`pixi run script-tests`.
146156

147157
Notes:
148158

149-
- `pixi run fix` regenerates `docs/architecture/package-structure-*.md`
150-
automatically — never edit those by hand. Don't review auto-fixes;
151-
accept and move on. Then `pixi run check` until clean.
159+
- `pixi run fix` regenerates `docs/dev/package-structure/full.md` and
160+
`docs/dev/package-structure/short.md` automatically — never edit those
161+
by hand. Don't review auto-fixes; accept and move on. Then
162+
`pixi run check` until clean.
163+
- When a check command needs saved output for analysis, capture the log
164+
and preserve the command exit code with a zsh-safe variable name:
165+
`pixi run check > /tmp/easydiffraction-check.log 2>&1; check_exit_code=$?; tail -n 200 /tmp/easydiffraction-check.log; exit $check_exit_code`.
166+
Never assign to `status` in zsh; it is readonly. Use task-specific
167+
names such as `check_exit_code`, `unit_tests_exit_code`, or
168+
`script_tests_exit_code`.
152169
- Open issues / design questions / planned improvements live in
153-
`docs/architecture/issues_open.md` (priority-ordered). On resolution,
154-
move to `docs/architecture/issues_closed.md` and update
155-
`architecture.md` if affected.
170+
`docs/dev/issues/open.md` (priority-ordered). On resolution, move to
171+
`docs/dev/issues/closed.md` and update the relevant ADR or
172+
`docs/dev/adrs/index.md` if affected.
156173

157174
### Planning
158175

159176
When asked to create a plan:
160177

178+
- Start the plan by referencing this file:
179+
`.github/copilot-instructions.md`. State any deliberate exception to
180+
these instructions in the plan itself.
161181
- First gather enough repository context to make the plan concrete. Ask
162182
all ambiguous or unclear questions in one concise batch; record
163183
unresolved questions in the plan if the user wants it saved before
164184
answering them.
165-
- Save plans as `docs/dev/plan_<feature-name>.md` (lowercase,
166-
dash-separated, e.g. `plan_background-refactor.md`). Use the same
167-
`<feature-name>` for the implementation branch
168-
(`feature/<feature-name>`). Do not push the branch unless asked.
185+
- Save plans as `docs/dev/plans/<feature-name>.md` (lowercase,
186+
dash-separated, e.g. `docs/dev/plans/background-refactor.md`). When a
187+
plan implements one ADR, use the same slug as the ADR file; for
188+
example, `docs/dev/adrs/suggestions/foo.md` maps to
189+
`docs/dev/plans/foo.md`. If a plan has no corresponding ADR or spans
190+
multiple ADRs, choose a concise feature slug and list all related ADRs
191+
in the plan. Use the same `<feature-name>` for the implementation
192+
branch (`feature/<feature-name>`). Do not push the branch unless
193+
asked.
169194
- Include a status checklist with `[ ]` items; mark `[x]` as completed
170195
during implementation.
171196
- Apply the two-phase workflow (Phase 1 implementation, Phase 2
@@ -185,6 +210,12 @@ When asked to create a plan:
185210
files likely to change, decisions already made, open questions,
186211
verification commands for Phase 2, and a short suggested commit
187212
message or branch name when useful.
213+
- Verification commands in plans must include the zsh-safe log-capture
214+
pattern from **Workflow** whenever saved output is needed for later
215+
analysis.
216+
- Before saving a plan, verify that referenced files, directories,
217+
scripts, and task names exist locally when that is practical. If a
218+
referenced tool is optional or missing, include an available fallback.
188219
- End every plan with a "Suggested Pull Request" section containing a
189220
short PR title and a brief end-user-oriented description. Keep this
190221
section non-technical enough for scientists and other users to

.github/workflows/coverage.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ on:
55
push:
66
branches:
77
- develop
8-
# Do not run on version tags (those are handled by other workflows)
9-
tags-ignore: ['v*']
108
# Trigger the workflow on pull request
119
pull_request:
1210
# Allows you to run this workflow manually from the Actions tab

.github/workflows/dashboard.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,13 @@ jobs:
3232
- name: Set up pixi
3333
uses: ./.github/actions/setup-pixi
3434

35+
# Install badgery into the active Pixi environment without modifying
36+
# pixi.toml/pixi.lock. Using `pixi add` here re-solves the whole project
37+
# and rebuilds the local editable package, which can cause intermittent
38+
# Linux CI failures (`Text file busy`, os error 26).
3539
- name: Install badgery
3640
shell: bash
37-
run: pixi add --pypi --git https://github.com/enhantica/badgery badgery
41+
run: pixi run python -m pip install git+https://github.com/enhantica/badgery
3842

3943
- name: Run docstring coverage and code complexity/maintainability checks
4044
run: |

.github/workflows/docs.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,16 @@ on:
2727
# Allows you to run this workflow manually from the Actions tab
2828
workflow_dispatch:
2929

30-
# Allow only one concurrent deployment to gh-pages at a time.
31-
# All docs workflows share the same concurrency group to prevent race conditions
32-
# when multiple branches/tags trigger simultaneous deployments.
30+
# - Non-tagged pushes and pull requests all use `docs-dev` group, so
31+
# they cancel each other.
32+
# - Tagged pushes use their own group like docs-v1.2.3, so they do not
33+
# cancel non-tagged runs, and non-tagged runs do not cancel them.
3334
concurrency:
34-
group: docs-gh-pages-deploy
35-
cancel-in-progress: false
35+
group: >-
36+
${{ startsWith(github.ref, 'refs/tags/v')
37+
&& format('docs-{0}', github.ref_name)
38+
|| 'docs-dev' }}
39+
cancel-in-progress: true
3640

3741
# Set the environment variables to be used in all jobs defined in this workflow
3842
env:
@@ -115,7 +119,7 @@ jobs:
115119
# Uses multiple cores for parallel execution to speed up the process.
116120
- name: Run notebooks
117121
# if: false # Temporarily disabled to speed up the docs build
118-
run: pixi run notebook-exec
122+
run: pixi run notebook-exec-ci
119123

120124
# Build the static files for the documentation site for local inspection
121125
# Input: docs/ directory containing the Markdown files
Lines changed: 19 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
# Verifies if an issue has at least one of the `[scope]` and one of the
2-
# `[priority]` labels. If not, the bot adds labels with a warning emoji
3-
# to indicate that those labels need to be added.
1+
# Verifies if the current issue has at least one `[scope]` label and one
2+
# `[priority]` label. If either is missing, the workflow adds a reminder label.
43

54
name: Issue labels check
65

@@ -13,39 +12,29 @@ permissions:
1312

1413
jobs:
1514
check-labels:
16-
if: github.actor != 'easyscience[bot]'
17-
1815
runs-on: ubuntu-latest
1916

2017
concurrency:
2118
group: issue-labels-${{ github.event.issue.number }}
2219
cancel-in-progress: true
2320

2421
steps:
25-
- name: Checkout repository
26-
uses: actions/checkout@v6
27-
28-
- name: Setup easyscience[bot]
29-
id: bot
30-
uses: ./.github/actions/setup-easyscience-bot
22+
- name: Ensure [scope] label
23+
uses: Rindrics/expect-label-prefix@v1.2.1
3124
with:
32-
app-id: ${{ vars.EASYSCIENCE_APP_ID }}
33-
private-key: ${{ secrets.EASYSCIENCE_APP_KEY }}
34-
35-
- name: Check for required [scope] label
36-
uses: trstringer/require-label-prefix@v1
37-
with:
38-
secret: ${{ steps.bot.outputs.token }}
39-
prefix: '[scope]'
40-
labelSeparator: ' '
41-
addLabel: true
42-
defaultLabel: '[scope] ⚠️ label needed'
43-
44-
- name: Check for required [priority] label
45-
uses: trstringer/require-label-prefix@v1
25+
repository_full_name: ${{ github.repository }}
26+
token: ${{ github.token }}
27+
label_prefix: '[scope]'
28+
label_separator: ' '
29+
add_label: 'true'
30+
default_label: '[scope] ⚠️ label needed'
31+
32+
- name: Ensure [priority] label
33+
uses: Rindrics/expect-label-prefix@v1.2.1
4634
with:
47-
secret: ${{ steps.bot.outputs.token }}
48-
prefix: '[priority]'
49-
labelSeparator: ' '
50-
addLabel: true
51-
defaultLabel: '[priority] ⚠️ label needed'
35+
repository_full_name: ${{ github.repository }}
36+
token: ${{ github.token }}
37+
label_prefix: '[priority]'
38+
label_separator: ' '
39+
add_label: 'true'
40+
default_label: '[priority] ⚠️ label needed'

.github/workflows/pr-labels.yml

Lines changed: 28 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
# Verifies if a pull request has at least one label from a set of valid
22
# labels before it can be merged.
33
#
4-
# NOTE:
5-
# This workflow may be triggered twice in quick succession when a PR is
6-
# created:
7-
# 1) `opened` — when the pull request is initially created
8-
# 2) `labeled` — if labels are added immediately after creation
9-
# (e.g. by manual labeling, another workflow, or GitHub App).
10-
#
11-
# These are separate GitHub events, so two workflow runs can be started.
4+
# The label validation is delegated to `mheap/github-action-required-labels`,
5+
# which checks the current PR labels via the GitHub API and can add or update a
6+
# PR comment when the required label set is missing.
127

138
name: PR labels check
149

@@ -17,40 +12,34 @@ on:
1712
types: [opened, labeled, unlabeled, synchronize]
1813

1914
permissions:
20-
pull-requests: read
15+
issues: write
16+
pull-requests: write
2117

2218
jobs:
2319
check-labels:
2420
runs-on: ubuntu-latest
2521

2622
steps:
27-
- name: Check for valid labels
28-
run: |
29-
PR_LABELS=$(echo '${{ toJson(github.event.pull_request.labels.*.name) }}' | jq -r '.[]')
30-
31-
echo "Current PR labels: $PR_LABELS"
32-
VALID_LABELS=(
33-
"[bot] release"
34-
"[scope] bug"
35-
"[scope] documentation"
36-
"[scope] enhancement"
37-
"[scope] maintenance"
38-
"[scope] significant"
39-
)
40-
41-
found=false
42-
for label in "${VALID_LABELS[@]}"; do
43-
if echo "$PR_LABELS" | grep -Fxq "$label"; then
44-
echo "✅ Found valid label: $label"
45-
found=true
46-
break
47-
fi
48-
done
49-
50-
if [ "$found" = false ]; then
51-
echo "ERROR: PR must have at least one of the following labels:"
52-
for label in "${VALID_LABELS[@]}"; do
53-
echo " - $label"
54-
done
55-
exit 1
56-
fi
23+
- name: Checkout repository
24+
uses: actions/checkout@v6
25+
26+
- name: Setup easyscience[bot]
27+
id: bot
28+
uses: ./.github/actions/setup-easyscience-bot
29+
with:
30+
app-id: ${{ vars.EASYSCIENCE_APP_ID }}
31+
private-key: ${{ secrets.EASYSCIENCE_APP_KEY }}
32+
33+
- uses: mheap/github-action-required-labels@v5
34+
with:
35+
token: ${{ steps.bot.outputs.token }}
36+
add_comment: true
37+
mode: minimum
38+
count: 1
39+
labels: |
40+
[bot] release
41+
[scope] bug
42+
[scope] documentation
43+
[scope] enhancement
44+
[scope] maintenance
45+
[scope] significant

.github/workflows/release-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
gh pr create \
4949
--base ${{ env.DEFAULT_BRANCH }} \
5050
--head ${{ env.SOURCE_BRANCH }} \
51-
--title "Release: merge ${{ env.SOURCE_BRANCH }} into ${{ env.DEFAULT_BRANCH }}" \
51+
--title "🎉 Release: merge ${{ env.SOURCE_BRANCH }} into ${{ env.DEFAULT_BRANCH }}" \
5252
--label "[bot] release" \
5353
--body "This PR is created automatically to trigger the release pipeline. It merges the accumulated changes from \`${{ env.SOURCE_BRANCH }}\` into \`${{ env.DEFAULT_BRANCH }}\`.
5454

0 commit comments

Comments
 (0)