add script to retrieve supported Python versions, optionally from package source metadata#326
Open
zacharyburnett wants to merge 2 commits intoOpenAstronomy:mainfrom
Open
add script to retrieve supported Python versions, optionally from package source metadata#326zacharyburnett wants to merge 2 commits intoOpenAstronomy:mainfrom
zacharyburnett wants to merge 2 commits intoOpenAstronomy:mainfrom
Conversation
11af006 to
35089ae
Compare
Contributor
Author
|
EDIT: never mind it was a dumb issue with conditionals, ignore this for now! @Cadair if you have time, could you take a look at why it's failing here: https://github.com/OpenAstronomy/github-actions-workflows/actions/runs/19116707014/job/54627509255?pr=326#step:5:13 it looks to me like it's trying to install the script as a package, though I'm not sure why |
67770c8 to
dfa841f
Compare
astrofrog
reviewed
Nov 7, 2025
e824962 to
602c646
Compare
38b630b to
7917cab
Compare
10 tasks
10 tasks
7917cab to
a608cd1
Compare
Contributor
Author
|
tested in spacetelescope/jwst#10003 and spacetelescope/romancal#2048: |
zacharyburnett
commented
Nov 7, 2025
| platforms = platforms.split(",") | ||
|
|
||
| toxenvs = supported_python_toxenvs(source, factors, no_eoas) | ||
| envs_block = "\\n".join( |
Contributor
Author
There was a problem hiding this comment.
escaping the \n was necessary to get the multi-line block to correctly insert into a single line of GITHUB_OUTPUT, but it requires unpacking the \\ns later in tox_matrix.py which feels icky
| """Script to load tox targets for GitHub Actions workflow.""" | ||
| # Load envs config | ||
| envs = yaml.load(envs, Loader=yaml.BaseLoader) | ||
| envs = yaml.load(envs.replace("\\n", "\n"), Loader=yaml.BaseLoader) |
Contributor
Author
There was a problem hiding this comment.
here's where the aforementioned \\ns are unpacked
a608cd1 to
0c4cdd1
Compare
0c4cdd1 to
f792b1f
Compare
…kage source metadata create string YAML block add test use platforms debugging print output use arguments `fill`, `fill_platforms`, `fill_factors` add more test cases
f792b1f to
c6edc3f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


closes #325
adds
fill,fill_platforms, andfill_factorsparameters to thetox.ymlworkflow call.fill: truewill append toxenvs to the existingenvs:list, namely the currently supported Python versions, with factors fromfill_factorsand repeated for each platform infill_platforms.Python versions are first drawn from the current public Python releases that are not yet end-of-life (pulled from
endoflife.dateAPI), and then filtered based on therequires-pythonpins in the package metadata, if it exists.For instance, setting
fill: trueandfill_factors: xdistforjwst(which currently specifiesrequires-python = ">=3.11,<3.14") adds the following toxenvs toenvs:To read the metadata, I imported
peppyproject, a Python project metadata abstraction library I wrote to convertsetup.cfgtopyproject.toml(but it also works well in this use case, as it will input metadata frompyproject.toml,setup.cfg, orsetup.py).