Skip to content

Support dynamic Python build matrices - #3541

Open
threexc wants to merge 5 commits into
mainfrom
tgamblin/dynamic-python-matrix
Open

threexc wants to merge 5 commits into
mainfrom
tgamblin/dynamic-python-matrix

Conversation

@threexc

@threexc threexc commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

Instead of hard-coding our target versions, change our code in ci_scripts/, .github/workflows, skills/, and docs/development.md to support dynamically deriving a target Python build matrix for each package, which can be rolled out gradually as updates are performed (instead of having to bulk rewrite and trigger all existing workflows). Now, when a workflow sets the python-matrix parameter to true, use ci_scripts/pending_versions.py to derive the list based on what the release targets upstream. Also allow us to extend/exclude the lists on a per-package basis by setting the python-extend and python-exclude inputs.

Modify build-falcon.yml as a test change. The skills files indicate that the rollout should be gradual, so our existing automation can convert workflows over time as new releases are built.

@threexc
threexc requested review from justeph and luhenry October 20, 2026 16:16
@threexc threexc changed the title Support dynamic Python versions Support dynamic Python build matrices Oct 20, 2026
@threexc
threexc force-pushed the tgamblin/dynamic-python-matrix branch from 1ca9f20 to f7c4321 Compare October 21, 2026 13:10
@luhenry

luhenry commented Oct 22, 2026

Copy link
Copy Markdown
Member

Can't we get the list of python configuration we should build in check_versions.py and store that information in the docs/packages/<pkg>.yml per-version, like:

- version: 1.2.3
  python-versions: [3.10, 3.11, 3.14, 3.14t] // the versions that upstream builds for that package

Then in .github/workflows/_setup.yml we still only have docs/packages/<pkg>.yml to check. I like the idea of python-exclude to make sure we can still only have a subset for things that don't work. I don't get the need for python-extend: though as there shouldn't be anything we build that upstream doesn't build already.

@justeph

justeph commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

Can't we get the list of python configuration we should build in check_versions.py and store that information in the docs/packages/<pkg>.yml per-version, like:

- version: 1.2.3
  python-versions: [3.10, 3.11, 3.14, 3.14t] // the versions that upstream builds for that package

Then in .github/workflows/_setup.yml we still only have docs/packages/<pkg>.yml to check. I like the idea of python-exclude to make sure we can still only have a subset for things that don't work. I don't get the need for python-extend: though as there shouldn't be anything we build that upstream doesn't build already.

I really like the idea of having that info in docs/packages/<pkg>.yml.

python-matrix:
description: Also compute the matrix output, querying PyPI for the interpreters upstream builds each version for.
required: false
default: false

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why false by default?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea was to set it to false by default as part of a gradual rollout to our workflows - the skills/ directory gives the LLM instructions for converting workflows to use a dynamic matrix as it updates them to build new versions. That way existing workflows keep working as expected until there's a reason to trigger them again.

Comment thread .github/workflows/_setup.yml Outdated
python-exclude:
description: Space-separated interpreter tag globs (e.g. "cp39 cp315*") never to build.
required: false
default: ''

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

python-exclude is actually important. And I guess the default value should be "cp39 cp310 cp311" at least since we decided to follow numpy convention to build only for 3.12+. I noticed a lot of packages still build for 3.9 3.10 and 3.11 so it is actually important to have this as a default

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still want to follow numpy, or should we let the dynamic matrix follow each project from now on, excluding versions only when they don't build for riscv64 (or for another related reason)?

@threexc

threexc commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator Author

Can't we get the list of python configuration we should build in check_versions.py and store that information in the docs/packages/<pkg>.yml per-version, like:

- version: 1.2.3
  python-versions: [3.10, 3.11, 3.14, 3.14t] // the versions that upstream builds for that package

I like that idea. I'll work on a change to do that instead.

Then in .github/workflows/_setup.yml we still only have docs/packages/<pkg>.yml to check. I like the idea of python-exclude to make sure we can still only have a subset for things that don't work. I don't get the need for python-extend: though as there shouldn't be anything we build that upstream doesn't build already.

python-extend was meant as an opposite to python-exclude, e.g. for if we wanted to build free-threaded wheels for a project which doesn't, or something like that. It's unnecessary future-proofing at this point though, so I'll remove it.

python-wheels currently has a narrow, manually-set list of Python
versions to build for, but this is often at odds with upstream projects.
Instead, rework check_versions.py to check and define a list of
upstream's targeted Python versions in each package's docs/packages/
file, then adjust pending_versions.py to pull directly from the data
populated by check_versions.py.

We may still want to exclude certain versions for a given package (for
example, to omit an older wheel that won't build on riscv64), so allow
passing flags to the script to indicate these versions.

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Add support for taking a dynamic list of Python versions as an input
when a new workflow parameter, 'python-matrix', is set true, based on
the output of scripts in the ci_scripts/ directory. Default to an empty
list if nothing is provided. Also support 'python-exclude' for cases
when we want to omit versions for various reasons.

Modify build-falcon.yml as a sample case.

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
…trix logic

Provide better instructions based on the changes in ci_scripts/ and
.github/workflows, to support dynamic Python matrix generation and
situational excludes. Make sure that any automated rework to existing
workflows is gradual, i.e. it occurs when a workflow is modified during
meaningful work, instead of bulk editing all workflows now.

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
@threexc
threexc force-pushed the tgamblin/dynamic-python-matrix branch from f7c4321 to 4e76952 Compare October 22, 2026 16:44
@threexc
threexc marked this pull request as ready for review October 22, 2026 16:44
@threexc

threexc commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator Author

Updated to address most feedback. Still left the questions about default versions to exclude and default python-matrix state.

This branch has not been deployed

No deployments
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.

3 participants