Skip to content

ci: matrix Python 3.12+all-extras and 3.13+core (closes #11)#15

Merged
gerchowl merged 2 commits intodevfrom
chore/python-matrix-ci
Apr 15, 2026
Merged

ci: matrix Python 3.12+all-extras and 3.13+core (closes #11)#15
gerchowl merged 2 commits intodevfrom
chore/python-matrix-ci

Conversation

@gerchowl
Copy link
Copy Markdown
Contributor

Summary

Closes #11. Decouples Python version from the narrowest optional extra.

py-materials's only hard dep is pint; build123d is optional and pulls cadquery-ocp + vtk, both of which have wheels only for cp311/cp312 as of 2026-04. Previously CI ran uv sync --all-extras on a single Python, so that narrow window became the whole project's effective Python support — .python-version pinned to 3.12 everywhere.

What changed

Environment markers on pyproject.toml extras. build123d = ["build123d>=0.7.0; python_version<'3.13'"] (and same on dev, all). On 3.13+, installers silently drop the dep instead of erroring with an unresolved wheel. requires-python = ">=3.11" is now honest for the core.

Matrix CI with a roll-up gate. ci.yml's test job is split into test-matrix (two cells) + a thin test roll-up that preserves the Tests status-check context:

cell Python extras
py3.12, all 3.12 --all-extras (full build123d integration)
py3.13, core 3.13 --extra periodictable --extra matproj

The roll-up pattern means existing branch rulesets (which require Tests) don't need to change — the test job still reports as Tests, just now depending on the matrix. Individual cells appear alongside as Tests (py3.12, all) and Tests (py3.13, core) for visibility.

setup-env/action.yml gains two inputs:

  • python-version (overrides .python-version when set — matrix cells pass this in)
  • uv-sync-args (default --all-extras, matrix cells override)

Why this keeps build123d regressions visible

The user's concern on #11 was: "if we don't run build123d tests, we won't notice when we break the integration." Addressed: the py3.12, all cell runs the full integration suite on every PR. A build123d regression fails that cell immediately, and the roll-up Tests fails with it. No change to ruleset enforcement, no change to visibility.

What didn't change

  • Ruleset required status checks — the Tests name is preserved by the roll-up, so no admin edit needed.
  • .python-version stays at 3.12 — it's the local-dev default where --all-extras just works.

Verified locally

  • py3.12, all: 133 passed, 11 skipped
  • py3.13, core: 107 passed, 26 skipped (the 26 are build123d-gated tests, correctly skipped when the dep is absent)

Test plan

  • CI shows two visible matrix cells: Tests (py3.12, all), Tests (py3.13, core)
  • Roll-up Tests check reports as success
  • Rust (mat-rs), Lint & Format, Security Scan, Dependency Review, CodeQL Analysis (python) all green
  • Container CI still green

🤖 Generated with Claude Code

gerchowl and others added 2 commits April 15, 2026 13:06
Fixes #11.

The root cause of the 3.12 pin was that CI ran `uv sync --all-extras`
on a single Python, so the narrowest optional-extra's Python support
(`vtk` and `cadquery-ocp`, both cp311/cp312-only, pulled in via
`build123d`) became the project's effective Python support.
`py-materials`'s only hard dependency is `pint`; the build123d
integration is optional, and the core library works on 3.13+.

Changes:

- **pyproject.toml**: environment markers on `build123d`,
  `dev`, and `all` extras — `build123d>=0.7.0; python_version<'3.13'`.
  Installers silently drop the dep on 3.13+ instead of erroring on a
  missing wheel. Also add `Python :: 3.13` classifier.

- **uv.lock**: regenerated to reflect the markers.

- **ci.yml**: new `test-matrix` job with two cells:
  - `py3.12, all` — full integration including build123d
  - `py3.13, core` — `--extra periodictable --extra matproj`, skips
    build123d-dependent tests
  A `test` roll-up job with `needs: [test-matrix]` keeps the `Tests`
  context name stable, so branch rulesets don't need updating. Matrix
  cells appear under `Tests (py3.12, all)` / `Tests (py3.13, core)`.

- **setup-env/action.yml**: new `python-version` input (overrides
  `.python-version` when set) and `uv-sync-args` input (lets matrix
  cells pass `--extra ...` instead of the fixed `--all-extras`).

- **.python-version**: left at `3.12` for local dev convenience
  (covers all-extras out of the box). Users who want 3.13 for core
  work can override via `UV_PYTHON`.

Verified locally: 133 pass / 11 skip on 3.12 all-extras; 107 pass /
26 skip on 3.13 core (the 26 skips are build123d-gated tests, which
correctly skip when the dep is absent).

A build123d regression stays loud because the 3.12 cell still runs
the full integration suite — the original concern about "break
build123d and not notice immediately" is preserved.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
On 3.13, --all-extras correctly skips build123d (via env marker) and
still installs pytest, periodictable, matproj. No need to enumerate
--extra ... explicitly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@gerchowl gerchowl merged commit 78d2fec into dev Apr 15, 2026
14 checks passed
@gerchowl gerchowl deleted the chore/python-matrix-ci branch April 15, 2026 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant