Skip to content
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

feat: Include abiflags in version dectection (enabling 3.13t) #199

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

effigies
Copy link

@effigies effigies commented Dec 8, 2024

Description

Currently, you can install free-threaded Python in GitHub actions (with deadsnakes or uv), and have tox.ini contain:

[gh-actions]
python =
  3.9: py39
  3.10: py310
  3.11: py311
  3.12: py312
  3.13: py313
  3.13t: py313t

But the version is detected as 3.13, since only the version information is considered, not the abiflags. This enables abiflags, which in turn enables this use case.

This is important for setting conditions in tox that only apply to free-threading builds, such as setting PYTHONGIL=0 or limiting dependencies to those with py3 or cp313t wheels.

You can see it in action in https://github.com/nipy/nibabel/actions/runs/12217554525/job/34081969908:

ROOT: 226 I running tox-gh-actions [tox_gh_actions/plugin.py:28]
ROOT: 227 D original envlist: ['py39-none', 'py310-none', 'py311-none', 'py312-none', 'py313-none', 'py313t-none', 'py39-min', 'py39-full', 'py39-full-x86', 'py39-full-x64', 'py39-pre-x86', 'py39-pre-x64', 'py310-full-x86', 'py310-full-x64', 'py310-pre-x86', 'py310-pre-x64', 'py311-full-x86', 'py311-full-x64', 'py311-pre-x86', 'py311-pre-x64', 'py312-full-x64', 'py312-pre-x64', 'py313-full-x64', 'py313-pre-x64', 'py313t-full-x64', 'py313t-pre-x64', 'py313-dev-x64', 'install', 'doctest', 'style', 'typecheck'] [tox_gh_actions/plugin.py:42]
ROOT: 227 D Python versions: ['3.13t', '3.13', '3'] [tox_gh_actions/plugin.py:45]
ROOT: 228 D tox-gh-actions config: {'python': {'3.9': ['py39'], '3.10': ['py310'], '3.11': ['py311'], '3.12': ['py312'], '3.13': ['py313'], '3.13t': ['py313t']}, 'env': {'ARCH': {'x64': ['x64'], 'x86': ['x86'], 'arm64': ['arm64']}, 'DEPENDS': {'none': ['none', 'install'], 'pre': ['pre'], 'dev': ['dev'], 'full': ['full', 'install'], 'min': ['min']}}} [tox_gh_actions/plugin.py:48]
ROOT: 228 D got factors for Python version: 3.13t [tox_gh_actions/plugin.py:137]
ROOT: 228 D using the following factors to decide envlist: ['py313t-x64-full', 'py313t-x64-install'] [tox_gh_actions/plugin.py:51]
ROOT: 228 D expiring envlist cache to override [tox_gh_actions/plugin.py:121]

Expected Behavior

When detecting a matching Python, 3.13t will be tried before falling back to 3.13 and 3.

@effigies
Copy link
Author

effigies commented Dec 8, 2024

This will break Windows, which doesn't have this attribute, unfortunately. It looks like it can be recovered from EXT_SUFFIX, which would be a pretty ugly hack, but I can do it...

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.

1 participant