Skip to content
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ backends = [
"maturin",
"meson-python @ git+https://github.com/mgorny/meson-python@freethreading-limited-api",
"scikit-build-core",
"setuptools",
"setuptools @ git+https://github.com/ngoldbaum/setuptools@abi3.abi3t",
"packaging @ git+https://github.com/ngoldbaum/packaging@abi3.abi3t",
]
build-tools = [
"cython @ git+https://github.com/cython/cython@freethreading-limited-api-preview",
Expand Down
5 changes: 4 additions & 1 deletion setuptools/c/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[build-system]
build-backend = "setuptools.build_meta"
requires = ["setuptools"]
requires = [
"setuptools@git+https://github.com/ngoldbaum/setuptools@abi3.abi3t",
"packaging@git+https://github.com/ngoldbaum/packaging@abi3.abi3t",
]

[project]
name = "limited-api"
Expand Down
2 changes: 2 additions & 0 deletions setuptools/c/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[bdist_wheel]
py_limited_api = cp315
Copy link
Collaborator

Choose a reason for hiding this comment

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

Newline.

6 changes: 5 additions & 1 deletion setuptools/cython/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
[build-system]
build-backend = "setuptools.build_meta"
requires = [
"setuptools",
"setuptools@git+https://github.com/ngoldbaum/setuptools@abi3.abi3t",
"packaging@git+https://github.com/ngoldbaum/packaging@abi3.abi3t",
"cython@git+https://github.com/cython/cython@freethreading-limited-api-preview",
]

[project]
name = "limited-api"
version = "1.2.3"
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.


[[tool.setuptools.ext-modules]]
name = "limited"
Expand Down
2 changes: 2 additions & 0 deletions setuptools/cython/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[bdist_wheel]
py_limited_api = cp315
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.

22 changes: 15 additions & 7 deletions tests/test_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from build import ProjectBuilder
import pytest

from contextlib import contextmanager
from contextlib import contextmanager, nullcontext
from pathlib import Path
import os
import subprocess
Expand Down Expand Up @@ -75,12 +75,20 @@ def test_install(test_case: str, tmp_path: Path, subtests) -> None:
):
dist_path = builder.build("wheel", tmp_path)

with subtests.test(msg="wheel has 'abi3.abi3t' tag"):
with subxfail(
build_system != "meson-python",
reason="Only meson-python fork builds abi3.abi3t",
):
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.

context = subxfail(
build_system not in ("meson-python", "setuptools"),
reason="Only meson-python and setuptools forks build abi3.abi3t",
)
else:
context = nullcontext()
with context:
if ((build_system == "setuptools" and IS_FREETHREADING) or
build_system == "meson_python"):
assert "abi3.abi3t" in Path(dist_path).name
else:
assert "abi3" in Path(dist_path).name

subprocess.run([sys.executable, "-m", "venv", tmp_path / "venv"], check=True)
python_exe = "python.exe" if os.name == "nt" else "python"
Expand Down
Loading