Skip to content

Update setuptools testing#2

Merged
mgorny merged 13 commits intoQuansight-Labs:mainfrom
ngoldbaum:fix-setuptools
Feb 26, 2026
Merged

Update setuptools testing#2
mgorny merged 13 commits intoQuansight-Labs:mainfrom
ngoldbaum:fix-setuptools

Conversation

@ngoldbaum
Copy link
Contributor

@ngoldbaum ngoldbaum commented Feb 20, 2026

Uses a patched setuptools and packaging. Also updates the tests to account for the behavior I've added to my setuptools fork: build abi3 on GIL-enabled cp315 but build abi3.abi3t on free-threaded by default.

Adding setup.cfg files forces the wheel build to actually use the limited API. Currently the setuptools tests build version-specific wheels, which is why they don't need a patched setuptools.

@ngoldbaum ngoldbaum requested a review from mgorny February 20, 2026 21:14
@ngoldbaum

This comment was marked as outdated.

@ngoldbaum ngoldbaum changed the title Work around setuptools static configuration limitations Update setuptools testing Feb 24, 2026
):
assert "abi3.abi3t" in Path(dist_path).name
with subtests.test(msg="wheel has correct ABI tag"):
if IS_FREETHREADING or build_system == "meson_python":
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Condition goes as first argument to subxfail, so just extend that.

@@ -0,0 +1,2 @@
[bdist_wheel]
py_limited_api = cp315 No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline.

Comment on lines +12 to +14
dependencies = [
"setuptools@git+https://github.com/ngoldbaum/setuptools@abi3.abi3t"
]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused here. Why does it need setuptools at runtime?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out this was unnecessary, I deleted it.

@@ -0,0 +1,2 @@
[bdist_wheel]
py_limited_api = cp315 No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline here too.

):
assert "abi3.abi3t" in Path(dist_path).name
with subtests.test(msg="wheel has correct ABI tag"):
with subxfail(((IS_FREETHREADING or build_system == "meson_python") and
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(IS_FREETHREADING or build_system == "meson_python") is never true (it's meson-python).

Also, to be honest, I'm lost at what is happening here. Do I understand correctly that:

  • meson-python always produces abi3.abi3t
  • setuptools produce abi3.abi3t when building on freethreading, but abi3 otherwise?

Is that really the expected behavior or bug of setuptools?

Right now you're treating the different output of setuptools as a valid condition, but different output from any other build backend as XFAIL (while randomly selecting abi3 branch to test them against). If anything, I'd dare say special-casing setuptools may be better than special-casing abi3.abi3t case.

Copy link
Contributor Author

@ngoldbaum ngoldbaum Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(IS_FREETHREADING or build_system == "meson_python")

Ouch, thanks for spotting.

meson-python always produces abi3.abi3t
setuptools produce abi3.abi3t when building on freethreading, but abi3 otherwise?
Is that really the expected behavior or bug of setuptools?

You could imagine adding a new setuptools bdist_wheel argument that forces an abi3t build to opt into setting Py_TARGET_ABI3T. However, Py_TARGET_ABI3T doesn't exist yet in CPython so it seemed pointless to me until PEP 803 is actually accepted and there is some support for it in CPython.

The abi.abi3t ABI implies that both Py_LIMITED_API and Py_GIL_DISABLED are set in python's headers, so IMO it's the correct default behavior for a free-threaded build using setuptools with py_limited_api = True to produce an abi3.abi3t wheel and a GIL-enabled build to produce an abi3 wheel.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made it so the tests special-case setuptools.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see that the PEP changed quite a bit since I've last looked.

@ngoldbaum
Copy link
Contributor Author

I think I addressed all your comments.

Copy link
Collaborator

@mgorny mgorny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, and sorry it took this many iterations.

@mgorny mgorny merged commit 98182e2 into Quansight-Labs:main Feb 26, 2026
6 checks passed
@ngoldbaum ngoldbaum mentioned this pull request Feb 27, 2026
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.

2 participants