Skip to content
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# WARNING: Do not edit this file manually.
# Any changes will be overwritten by Copier.
_commit: v0.10.1-33-g0f85abf
_commit: v0.10.1-40-g29e2ccf
_src_path: gh:easyscience/templates
app_docs_url: https://easyscience.github.io/diffraction-app
app_doi: 10.5281/zenodo.18163581
app_package_name: easydiffraction_app
app_python: '3.13'
app_python: '3.14'
app_repo_name: diffraction-app
home_page_url: https://easyscience.github.io/diffraction
home_repo_name: diffraction
lib_docs_url: https://easyscience.github.io/diffraction-lib
lib_doi: 10.5281/zenodo.18163581
lib_package_name: easydiffraction
lib_python_max: '3.14'
lib_python_min: '3.11'
lib_python_min: '3.12'
lib_repo_name: diffraction-lib
project_contact_email: support@easydiffraction.org
project_copyright_years: 2021-2026
Expand Down
38 changes: 37 additions & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
and UPPER_SNAKE_CASE for constants.
- Use `from __future__ import annotations` in every module.
- Type-annotate all public function signatures.
- Docstrings on all public classes and methods (numpy style).
- Docstrings on all public classes and methods (numpy style). These must
include sections Parameters, Returns and Raises, where applicable.
- Prefer flat over nested, explicit over clever.
- Write straightforward code; do not add defensive checks for unlikely
edge cases.
Expand All @@ -59,6 +60,19 @@
with both getter and setter) or **read-only** (property with getter
only). If internal code needs to mutate a read-only property, add a
private `_set_<name>` method instead of exposing a public setter.
- Lint complexity thresholds (`max-args`, `max-branches`,
`max-statements`, `max-locals`, `max-nested-blocks`, etc. in
`pyproject.toml`) are intentional code-quality guardrails. They are
not arbitrary numbers — the project uses ruff's defaults (with
`max-args` and `max-positional-args` set to 6 instead of 5 to account
for ruff counting `self`/`cls`). When code violates a threshold, it is
a signal that the function or class needs refactoring — not that the
threshold needs raising. Do not raise thresholds, add `# noqa`
comments, or use any other mechanism to silence complexity violations.
Instead, refactor the code (extract helpers, introduce parameter
objects, flatten nesting, etc.). For complex refactors that touch many
lines or change public API, propose a refactoring plan and wait for
approval before proceeding.

## Architecture

Expand Down Expand Up @@ -107,6 +121,26 @@
`*.py` script, then run `pixi run notebook-prepare` to regenerate the
notebook.

## Testing

- Every new module, class, or bug fix must ship with tests. See
`docs/architecture/architecture.md` §10 for the full test strategy.
- **Unit tests mirror the source tree:**
`src/easydiffraction/<pkg>/<mod>.py` →
`tests/unit/easydiffraction/<pkg>/test_<mod>.py`. Run
`pixi run test-structure-check` to verify.
- Category packages with only `default.py`/`factory.py` may use a single
parent-level `test_<package>.py` instead of per-file tests.
- Supplementary test files use the pattern `test_<mod>_coverage.py`.
- Tests that expect `log.error()` to raise must `monkeypatch` Logger to
RAISE mode (another test may have leaked WARN mode).
- `@typechecked` setters raise `typeguard.TypeCheckError`, not
`TypeError`.
- No test-ordering dependence, no network, no sleeping, no real
calculation engines in unit tests.
- After adding or modifying tests, run `pixi run unit-tests` and confirm
all tests pass.

## Changes

- Before implementing any structural or design change (new categories,
Expand Down Expand Up @@ -147,6 +181,8 @@
`docs/architecture/architecture.md`.
- After changes, run linting and formatting fixes with `pixi run fix`.
Do not check what was auto-fixed, just accept the fixes and move on.
Then, run linting and formatting checks with `pixi run check` and
address any remaining issues until the code is clean.
- After changes, run unit tests with `pixi run unit-tests`.
- After changes, run integration tests with
`pixi run integration-tests`.
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/backmerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ concurrency:
group: backmerge-master-into-develop
cancel-in-progress: false

# Opt into Node.js 24 for all JavaScript actions.
# Remove once all referenced actions natively target Node 24.
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

jobs:
backmerge:
runs-on: ubuntu-latest
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ on:
- 'false'
- 'true'

# Opt into Node.js 24 for all JavaScript actions.
# Remove once all referenced actions natively target Node 24.
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

jobs:
del-runs:
runs-on: ubuntu-latest
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: Coverage checks

on:
# Trigger the workflow on push
# Trigger the workflow on push to develop
push:
branches:
- develop
# Do not run on version tags (those are handled by other workflows)
tags-ignore: ['v*']
# Trigger the workflow on pull request
Expand All @@ -15,15 +17,18 @@ permissions:
actions: write
contents: read

# Allow only one concurrent workflow, skipping runs queued between the run
# in-progress and latest queued. And cancel in-progress runs.
# Allow only one concurrent workflow per PR or branch ref.
# Cancel in-progress runs only for pull requests, but let branch push runs finish.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

# Set the environment variables to be used in all jobs defined in this workflow
env:
CI_BRANCH: ${{ github.head_ref || github.ref_name }}
# Opt into Node.js 24 for all JavaScript actions.
# Remove once all referenced actions natively target Node 24.
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

jobs:
# Job 1: Run docstring coverage
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ env:
DEVELOP_BRANCH: develop
REPO_OWNER: ${{ github.repository_owner }}
REPO_NAME: ${{ github.event.repository.name }}
# Opt into Node.js 24 for all JavaScript actions.
# Remove once all referenced actions natively target Node 24.
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

jobs:
dashboard:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ env:
IS_RELEASE_TAG: ${{ startsWith(github.ref, 'refs/tags/v') }}
GITHUB_REPOSITORY: ${{ github.repository }}
NOTEBOOKS_DIR: tutorials
# Opt into Node.js 24 for all JavaScript actions.
# Remove once all referenced actions natively target Node 24.
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

jobs:
# Single job that builds and deploys documentation.
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/issues-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,21 @@ on:
permissions:
issues: write

# Opt into Node.js 24 for all JavaScript actions.
# Remove once all referenced actions natively target Node 24.
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

jobs:
check-labels:
if: github.actor != 'easyscience[bot]'

runs-on: ubuntu-latest

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

steps:
- name: Checkout repository
uses: actions/checkout@v5
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/lint-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ permissions:
# Set the environment variables to be used in all jobs defined in this workflow
env:
CI_BRANCH: ${{ github.head_ref || github.ref_name }}
# Opt into Node.js 24 for all JavaScript actions.
# Remove once all referenced actions natively target Node 24.
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

jobs:
lint-format:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Opt into Node.js 24 for all JavaScript actions.
# Remove once all referenced actions natively target Node 24.
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

jobs:
pypi-publish:
runs-on: ubuntu-latest
Expand Down
29 changes: 20 additions & 9 deletions .github/workflows/pypi-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ permissions:
env:
CI_BRANCH: ${{ github.head_ref || github.ref_name }}
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
# Opt into Node.js 24 for all JavaScript actions.
# Remove once all referenced actions natively target Node 24.
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

jobs:
# Job 1: Test installation from PyPI on multiple OS
Expand All @@ -45,30 +48,38 @@ jobs:
- name: Init pixi project
run: pixi init easydiffraction

- name: Set the minimum system requirements
run: pixi project system-requirements add macos 14.0

- name: Add Python 3.14 from Conda
working-directory: easydiffraction
run: pixi add "python=3.14"

- name: Add other Conda dependencies
working-directory: easydiffraction
run: pixi add gsl

- name: Add easydiffraction from PyPI
working-directory: easydiffraction
run: pixi add --pypi "easydiffraction"
run: |
pixi add gsl
pixi add --platform osx-arm64 libcxx

- name: Add dev dependencies from PyPI
- name: Add pycrysfml calculator from custom PyPI index
working-directory: easydiffraction
run: pixi add --pypi pytest pytest-xdist
run: |
echo '' >> pixi.toml
echo '[pypi-dependencies]' >> pixi.toml
echo 'pycrysfml = { version = ">=0.2.1", index = "https://easyscience.github.io/pypi/" }' >> pixi.toml

- name: Add Pixi task as a shortcut
- name: Add easydiffraction (with dev dependencies) from PyPI
working-directory: easydiffraction
run: pixi task add easydiffraction "python -m easydiffraction"
run: pixi add --pypi "easydiffraction[dev]"

- name: Run unit tests to verify the installation
working-directory: easydiffraction
run: pixi run python -m pytest ../tests/unit/ --color=yes -v

- name: Run functional tests to verify the installation
working-directory: easydiffraction
run: pixi run python -m pytest ../tests/functional/ --color=yes -v

- name: Run integration tests to verify the installation
working-directory: easydiffraction
run: pixi run python -m pytest ../tests/integration/ --color=yes -n auto
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/release-notes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Opt into Node.js 24 for all JavaScript actions.
# Remove once all referenced actions natively target Node 24.
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

jobs:
draft-release-notes:
permissions:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ permissions:
env:
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
SOURCE_BRANCH: ${{ inputs.source_branch || 'develop' }}
# Opt into Node.js 24 for all JavaScript actions.
# Remove once all referenced actions natively target Node 24.
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

jobs:
create-pull-request:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ permissions:
contents: read
security-events: write

# Opt into Node.js 24 for all JavaScript actions.
# Remove once all referenced actions natively target Node 24.
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

jobs:
codeql:
name: Code scanning
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/test-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ on:
permissions:
contents: read

# Opt into Node.js 24 for all JavaScript actions.
# Remove once all referenced actions natively target Node 24.
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

jobs:
code-tests-trigger:
runs-on: ubuntu-latest
Expand Down
16 changes: 13 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ concurrency:
# Set the environment variables to be used in all jobs defined in this workflow
env:
CI_BRANCH: ${{ github.head_ref || github.ref_name }}
PY_VERSIONS: '3.11 3.14'
PIXI_ENVS: 'py-311-env py-314-env'
PY_VERSIONS: '3.12 3.14'
PIXI_ENVS: 'py-312-env py-314-env'
# Opt into Node.js 24 for all JavaScript actions.
# Remove once all referenced actions natively target Node 24.
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

jobs:
# Job 1: Set up environment variables
Expand Down Expand Up @@ -214,7 +217,14 @@ jobs:
# platform-specific deps so this is a no-op on Linux/Windows.
echo "Adding libc++ for macOS (required by diffpy.pdffit2)"
pixi add --platform osx-arm64 libcxx
pixi add --platform osx-64 libcxx

# Doing this in a hacky way, as pixi does not support adding
# dependencies from a custom PyPI index with a CLI command without
# specifying full wheel name.
echo "Adding pycrysfml from custom PyPI index"
echo '' >> pixi.toml
echo '[pypi-dependencies]' >> pixi.toml
echo 'pycrysfml = { version = ">=0.2.1", index = "https://easyscience.github.io/pypi/" }' >> pixi.toml

echo "Looking for wheel in ../dist/py$py_ver/"
ls -l "../dist/py$py_ver/"
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/tutorial-tests-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ on:
permissions:
contents: read

# Opt into Node.js 24 for all JavaScript actions.
# Remove once all referenced actions natively target Node 24.
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

jobs:
tutorial-tests-trigger:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/tutorial-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ concurrency:
# Set the environment variables to be used in all jobs defined in this workflow
env:
CI_BRANCH: ${{ github.head_ref || github.ref_name }}
# Opt into Node.js 24 for all JavaScript actions.
# Remove once all referenced actions natively target Node 24.
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

jobs:
# Job 1: Test tutorials as scripts and notebooks on multiple OS
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,8 @@ CMakeLists.txt.user*
.cache/
*.log
*.zip

# ED
# Used to fetch tutorials data during their runtime. Need to have '/' at
# the beginning to avoid ignoring 'data' module in the src/.
/data/
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,23 @@ repos:
pass_filenames: false
stages: [manual]

- id: pixi-test-structure-check
name: pixi run test-structure-check
entry: pixi run test-structure-check
language: system
pass_filenames: false
stages: [manual]

- id: pixi-unit-tests
name: pixi run unit-tests
entry: pixi run unit-tests
language: system
pass_filenames: false
stages: [manual]

- id: pixi-functional-tests
name: pixi run functional-tests
entry: pixi run functional-tests
language: system
pass_filenames: false
stages: [manual]
Binary file not shown.
Binary file removed deps/pycrysfml-0.1.6-py312-none-win_amd64.whl
Binary file not shown.
Loading
Loading