Skip to content

Use sysconfig data for wheel tags and stable-ABI validation - #5362

Merged
jaraco merged 1 commit into
pypa:mainfrom
jameshilliard:fix/abi3t-target-config
Oct 20, 2026
Merged

jaraco merged 1 commit into
pypa:mainfrom
jameshilliard:fix/abi3t-target-config

Conversation

@jameshilliard

Copy link
Copy Markdown
Contributor

Summary of changes

Wheel tags and limited-API validation currently combine sysconfig values with information from the running interpreter. When cross-compiling, this can produce host-specific tags or reject stable-ABI wheels supported by the target.

Use sysconfig data for the Python version, implementation, pointer size and debug status, retaining best-effort fallbacks when configuration data is unavailable. Fall back to SOABI when VERSION is missing or invalid, and use EXT_SUFFIX for Windows debug builds when Py_DEBUG is unavailable.

Validate wheel tags against the configured interpreter's version and ABI instead of tags.sys_tags(), preserving platform overrides and compressed ABI3/ABI3T tags. Add regression coverage for differing host and target configurations, missing metadata, and native limited-API wheels, including --skip-build and importing the extension. Also add Python 3.15t to CI.

Follow-up to #5193 and #5352.

Closes #5360

Testing

  • Wheel, extension, wheel installation, metadata, build-backend and editable-install regression tests on CPython 3.14: 503 passed.
  • Focused test_bdist_wheel.py and test_build_ext.py tests on CPython 3.14 and 3.15t: 188 passed each; CPython 3.14t and PyPy 3.11: 186 passed and 2 skipped each.
  • Ruff, formatting, mypy and whitespace checks passed.

Pull Request Checklist

@jameshilliard
jameshilliard force-pushed the fix/abi3t-target-config branch 2 times, most recently from 047b272 to d0b137a Compare October 19, 2026 22:38
Comment thread setuptools/tests/test_bdist_wheel.py Resolved
@jameshilliard
jameshilliard force-pushed the fix/abi3t-target-config branch from d0b137a to c7cdf44 Compare October 20, 2026 16:25
@jaraco

jaraco commented Oct 20, 2026

Copy link
Copy Markdown
Member

I'm working in jaraco/skeleton#224 to add 3.15t to the build matrix (for skeleton projects).

Comment thread .github/workflows/main.yml Resolved
@jameshilliard
jameshilliard force-pushed the fix/abi3t-target-config branch from c7cdf44 to 2382f7e Compare October 20, 2026 16:41
@jaraco

jaraco commented Oct 20, 2026

Copy link
Copy Markdown
Member

One nit, not a blocker: after this change _python_version() describes the target everywhere except dist_files, which still records the host version:

# Add to 'Distribution.dist_files' so that the "upload" command works
getattr(self.distribution, "dist_files", []).append((
"bdist_wheel",
f"{sys.version_info.major}.{sys.version_info.minor}",
wheel_path,
))

When cross-compiling, that entry gets the building interpreter's version rather than the configured target's, which is inconsistent with the rest of the PR. ".".join(map(str, _python_version())) would keep it aligned. Fine by me to leave it for a follow-up if you'd rather keep this diff tight.

@jameshilliard
jameshilliard force-pushed the fix/abi3t-target-config branch 2 times, most recently from a4c7b5c to 3c3e71b Compare October 20, 2026 17:28
Wheel tags and limited-API validation currently mix sysconfig values
with the running interpreter's version, implementation and pointer size.
Cross builds can therefore emit host-specific tags or reject stable-ABI
wheels supported by the target.

Derive interpreter details from sysconfig, retaining best-effort
fallbacks when configuration data is unavailable. Fall back to SOABI
when VERSION is missing or invalid, and use EXT_SUFFIX for Windows
debug builds when Py_DEBUG is unavailable.

Validate tags against the configured interpreter's version and ABI
instead of tags.sys_tags(), preserving platform overrides and compressed
ABI3/ABI3T tags.

Cover differing host and target configurations, missing metadata, and
native limited-API wheel builds, including --skip-build and importing
the extension. Add Python 3.15t to CI.
@jameshilliard
jameshilliard force-pushed the fix/abi3t-target-config branch from 3c3e71b to 00595bf Compare October 20, 2026 17:52
@jameshilliard

Copy link
Copy Markdown
Contributor Author

When cross-compiling, that entry gets the building interpreter's version rather than the configured target's, which is inconsistent with the rest of the PR. ".".join(map(str, _python_version())) would keep it aligned. Fine by me to leave it for a follow-up if you'd rather keep this diff tight.

Should be fixed now.

@jaraco
jaraco merged commit 7c5cb7a into pypa:main Oct 20, 2026
24 of 26 checks passed
@jameshilliard
jameshilliard deleted the fix/abi3t-target-config branch October 20, 2026 18:26
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.

[BUG] Wheel tagging uses the build interpreter rather than the target when cross-compiling

3 participants