repomatic.metadata.matrix module¶
Job-matrix construction of Metadata.
Builds the Nuitka build matrix and the test matrices from the other
concerns’ facts, and applies the repository’s [tool.repomatic]
test-matrix configuration to them.
- repomatic.metadata.matrix.NUITKA_CACHE_KEY: Final[str] = 'nuitka_cache'¶
Job key of
MatrixMetadata.nuitka_matrixgating the compile cache.truewhen the compile job restores and saves the target’s cache,falseotherwise. The release workflow compares it to the string'true': a matrix value is a string, and the stringfalseis truthy in a GitHub expression.
- repomatic.metadata.matrix.PLAIN_RELEASE_RE: Final = re.compile('[0-9]+(?:\\.[0-9]+)+')¶
A
python-versionaxis value naming a plain CPython release, like3.15.A build flavor (
3.15t) or another interpreter (pypy3.11) does not match.
- class repomatic.metadata.matrix.MatrixMetadata[source]¶
Bases:
objectThe Nuitka build matrix and the test matrices.
A concern mixin of
Metadata: never instantiated on its own, and reads sibling concerns throughself.- property nuitka_entry_points: list[str][source]¶
Entry points selected for Nuitka binary compilation.
Reads
[tool.repomatic].nuitka.entry-pointsfrompyproject.toml. When empty (the default), deduplicates by callable target: keeps the first entry point for each uniquemodule:callablepair, so alias entry points (like bothmpmandmeta-package-managerpointing to the same function) don’t produce duplicate binaries. Unrecognized CLI IDs are logged as warnings and discarded.
- property dev_targets: set[str][source]¶
Nuitka build targets compiled on ordinary (non-release) pushes.
Reads
[tool.repomatic].nuitka.dev-targetsfrompyproject.toml. An empty list disables dev builds entirely. Seenuitka_dev_targetsfor the default and the canary rationale.Unrecognized target names are logged as warnings and discarded.
- property unstable_targets: set[str][source]¶
Nuitka build targets allowed to fail without blocking the release.
Reads
[tool.repomatic].nuitka.unstable-targetsfrompyproject.toml. Defaults to an empty set.Unrecognized target names are logged as warnings and discarded.
- property nuitka_matrix: Matrix | None[source]¶
Pre-compute a matrix for Nuitka compilation workflows.
Crosses three axes:
one commit per release commit (during a release) or per new commit (otherwise)
every
[project.scripts]entry pointevery build target of
NUITKA_BUILD_TARGETS(runner, platform, architecture, binary extension, and the glibc floor or minimum-OS version that target enforces), narrowed to the[tool.repomatic] nuitka.dev-targetscanary subset on an ordinary push (seedev_targets); release commits,scheduleandworkflow_dispatchruns keep the full roster
Each axis contributes an
includeentry carrying the extra parameters the compile job needs, keyed on the axis value that selects it: the target’s runner and floors, the entry point’s module and callable, and the commit’s short SHA and version. A final pass adds oneincludeentry per(os, entry_point, commit)triple naming thebin_namethe compiled artifact takes, since that name depends on all three at once.Each target entry also carries
nuitka_cache, telling the compile job whether to restore and save the target’s compile cache. Release commits build cold, on purpose: a cache entry is writable by any code running in any workflow of the default branch (the cache API is not gated bypermissions:), and its restore is a tar extraction into the workspace, so a poisoned entry could reach a signed, published, immutable binary. A target with no use for a cache skips it too: seecompile_cache.The matrix closes with
{"state": "stable"}, which the release workflow reads to decide whether a failing job blocks the release.Nonewhenskip_binary_buildholds, so one key tells the release workflow whether to compile.Note
Every value comes from
NUITKA_BUILD_TARGETSand the project’s ownpyproject.toml, so no literal is repeated here: runrepomatic show-metadata nuitka_matrixagainst a project to see the matrix it computes, orrepomatic show-test-matrixfor the test one.Note
Each entry point compiles through Nuitka’s
--main-entry-point, which needs Nuitka4.3. Earlier releases crashed on the option (Nuitka#3879), or built a binary that failed at startup when the entry point carried the name of its package (Nuitka#4024).
- property test_matrix: Matrix[source]¶
Full test matrix for non-PR events.
Combines all runner OS images and Python versions. Marks development Python versions as unstable so CI can use
continue-on-error, and adds released build flavors (free-threaded) as stable single-runner smoke tests. Per-project config from[tool.repomatic.test-matrix]is applied last.When
[tool.repomatic.test-matrix] full-includerows are configured, the matrix is emitted as a flat job list ({"include": [...]}) so each row is a standalone combination GitHub runs verbatim, rather than one that augments a base combo sharing itsosandpython-version.
- property test_matrix_pr: Matrix[source]¶
Reduced test matrix for pull requests.
Skips experimental Python versions and redundant architecture variants to reduce CI load on PRs. Per-project config excludes and includes from
[tool.repomatic.test-matrix]are applied, but variations are not (to keep the PR matrix small).
- property latest_stable_python: str | None[source]¶
The newest released Python on the full test matrix, like
3.15.For a job that wants one Python to run on rather than a matrix of them. Read from the
python-versionaxis once the project’s[tool.repomatic.test-matrix]has replaced or removed values, so a project that dropped a version never gets it here. The in-development versions (UNSTABLE_PYTHON_VERSIONS) and the build flavors (like the free-threaded3.15t) do not count: a plain release is what every user installs.- Returns:
The version, or
Nonewhen the axis holds no plain release.
- test_matrix_named(name)[source]¶
The test matrix name designates.
- Parameters:
name (
MatrixName) – Which of the two matrices.- Return type:
- Returns:
- property runner_arch: dict[str, str][source]¶
Architecture of every runner image the full test matrix can land on.
A repository whose suite asserts on the architecture it detects needs to know which of its cells are ARM. Reading it from here rather than restating it locally is what keeps that knowledge from going stale when
TEST_RUNNERS_FULLmoves to a newer image: a hard-coded runner list keeps matching the images it was written for, and the new one quietly takes whichever branch the test left as its default.Covers the
includedirectives as well as theosaxis, so the single-runner build-flavor cells (seeSINGLE_RUNNER_PYTHON_VERSIONS) are described too, and the per-projectvariations.osimages along with them. Architectures are emitted as Extra Platforms ids (aarch64,x86_64), matching thearchfield ofFLAT_BUILD_TARGETS.- Returns:
Runner label to architecture id, sorted by label.
- property stale_test_matrix_excludes: list[tuple[dict[str, str], dict[str, str]]][source]¶
User
test-matrix.excludeentries matching no full-matrix axis value.An exclude naming a value absent from every axis (like a renamed runner) can never match a combination, so
Matrix.prune()drops it silently and its exclusion intent is lost. This drift is common after an upstream runner rename (such asmacos-15-intelbecomingmacos-26-intel). Thelint-repocheck surfaces these so the drift fails loudly instead of silently.The axes come from
_test_matrix_base, never from the emittedtest_matrix: afull-includematrix emits as a flat job list whoseall_variations()is empty, which would misreport every key of an entry as stale. Carrying the absent values in the result is what keeps the lint check from re-deriving them against the wrong matrix.- Returns:
(entry, absent_values)pairs in config order: each offending exclude with the key/value pairs no axis carries.