Skip to content

Support dynamic Python build matrices - #3541

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

threexc wants to merge 4 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
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, define a RISCV64_PYTHONS variable in pending_versions.py with a
wide range of versions, and allow matching against upstream projects to
dynamically determine the Python versions to build wheels for. This
includes abi3 wheels

We may still want to include or exclude certain versions for a given
package (for example, to build a free-threaded wheel when upstream
doesn't), so allow passing flags to the script to indicate these
versions.

Note that RISCV64_PYTHONS (in pending_versions.py) becomes the place to
update our list when new Python versions release.

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-extend' and
'python-exclude' for cases when we want to include versions beyond
what's detected upstream, and/or 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 includes/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>
@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.

required: false
default: false
type: boolean
python-extend:

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.

same question as @luhenry: why would we need this one? if our goal is to mimic upstream?

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.

Working on removing it.

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

@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.

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