Skip to content

Commit

Permalink
Install Cython alpha and disable build isolation under free-threaded
Browse files Browse the repository at this point in the history
  • Loading branch information
lysnikolaou committed Feb 17, 2025
1 parent d1e22ca commit 78f84fd
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ graft docs
graft CHANGES
graft requirements
graft tests
graft scripts
global-exclude *.pyc
global-exclude *.cache
exclude yarl/*.c
Expand Down
8 changes: 1 addition & 7 deletions packaging/pep517_backend/_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from __future__ import annotations

import os
import sysconfig
import typing as t
from contextlib import contextmanager, nullcontext, suppress
from functools import partial
Expand Down Expand Up @@ -372,12 +371,7 @@ def get_requires_for_build_wheel(
stacklevel=999,
)

if is_pure_python_build:
c_ext_build_deps = []
elif sysconfig.get_config_var("Py_GIL_DISABLED"):
c_ext_build_deps = ['Cython == 3.1.0a1']
else:
c_ext_build_deps = ['Cython ~= 3.0.0']
c_ext_build_deps = [] if is_pure_python_build else ['Cython ~= 3.0.11']

return _setuptools_get_requires_for_build_wheel(
config_settings=config_settings,
Expand Down
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ test-command = 'pytest -v -m "not hypothesis" --no-cov {project}/tests'
# don't build PyPy wheels, install from source instead
skip = "pp*"

# TODO: Remove this when there's a Cython 3.1 final release
[[tool.cibuildwheel.overrides]]
select = "cp313t-*"
build-frontend = "build; args: --no-isolation"
before-build = "bash {package}/scripts/cibw_before_build.sh"
# Remove PIP_CONSTRAINT from the environment
environment = {COLOR="yes", FORCE_COLOR="1", MYPY_FORCE_COLOR="1", PRE_COMMIT_COLOR="always", PY_COLORS="1"}

[tool.cibuildwheel.environment]
COLOR = "yes"
FORCE_COLOR = "1"
Expand Down
3 changes: 1 addition & 2 deletions requirements/cython.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
cython==3.1.0a1; python_version >= '3.13'
cython==3.0.11; python_version <= '3.12'
cython~=3.0.11
2 changes: 1 addition & 1 deletion scripts/cibw_before_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
FREE_THREADED_BUILD="$(python -c"import sysconfig; print(bool(sysconfig.get_config_var('Py_GIL_DISABLED')))")"
if [[ $FREE_THREADED_BUILD == "True" ]]; then
python -m pip install -U pip
python -m pip install -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple cython
python -m pip install --pre cython==3.1.0a1
python -m pip install setuptools expandvars
fi

0 comments on commit 78f84fd

Please sign in to comment.