tox-gh-actions
tox-gh-actions copied to clipboard
Specific Python patch versions (vX.Y.Z) are not respected?
Describe the bug
If you have a config like this...
[gh-actions]
python =
3.10.8: py3108
3.10: py310
...and your GitHub Actions configuration installs 3.10.8, this plugin will select the py310
environment instead of the py3108
environment.
To Reproduce
GitHub Action snippet:
- uses: actions/setup-python@v5
with:
python-version: 3.10.8
tox.ini snippet:
[testenv: py3108]
basepython = python3.10.8
[gh-actions]
python =
3.8: py38
3.9: py39
3.10.8: py3108
3.10: py310
3.11: py311
3.12: py312
The PR where I noticed this, showing the full configurations: https://github.com/pytest-dev/pytest-asyncio/pull/817
And the specific job where I noticed this: https://github.com/pytest-dev/pytest-asyncio/actions/runs/8732675787/job/23960070899?pr=817
Expected behavior
I expect to be able to write major.minor.patch
versions like 3.10.8
in my tox.ini's [gh-actions]
section. If I write 3.10.8
, I expect that to match a runner version of 3.10.8 but not 3.10.9. If I write just 3.10
, I expect that to match a runner version of 3.10.8 or 3.10.9. If multiple entries in my tox.ini config match the runner version, I guess I expect the lexicographically first one to be used.
Additional context
N/A
Hello @SyntaxColoring. Thanks for filing a ticket!
The problem should be caused by the fact that tox-gh-actions doesn't expect major.minor.patch
as a key of gh-actions.python
at this point. Here's the relevant code:
https://github.com/ymyzk/tox-gh-actions/blob/a6451af39e2f62f2b180cd7ae842aea7b177859e/src/tox_gh_actions/plugin.py#L182-L184
I think it makes sense to add the patch version support to tox-gh-actions. If you're open to create a MR for this change, feel free to do so. I might not be able to find time to implement this improvement by myself right now.
Yep, I'm happy to give it a shot. It'll probably be a while before I get around to it, too.