-
Notifications
You must be signed in to change notification settings - Fork 17
add script to retrieve supported Python versions, optionally from package source metadata #326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
add script to retrieve supported Python versions, optionally from package source metadata #326
Conversation
11af006 to
35089ae
Compare
|
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
e824962 to
602c646
Compare
38b630b to
7917cab
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
7917cab to
a608cd1
Compare
|
tested in spacetelescope/jwst#10003 and spacetelescope/romancal#2048: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a better way to do this one part?
| platforms = platforms.split(",") | ||
|
|
||
| toxenvs = supported_python_toxenvs(source, factors, no_eoas) | ||
| envs_block = "\\n".join( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here's where the aforementioned \\ns are unpacked


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