Skip to content

Commit f2b09c7

Browse files
Increase minimum Cython version to 3.1 everywhere (#211)
* Initial plan * Increase minimum Cython version to 3.1 everywhere Co-authored-by: timosachsenberg <5803621+timosachsenberg@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: timosachsenberg <5803621+timosachsenberg@users.noreply.github.com>
1 parent d8dc6a0 commit f2b09c7

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

.github/workflows/ci-autowrap.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@ jobs:
1515
fail-fast: false
1616
matrix:
1717
include:
18-
- CYTHON: "==3.0.0"
19-
python-version: "3.10"
20-
- CYTHON: "==3.0.0"
21-
python-version: "3.11"
22-
- CYTHON: "==3.0.0"
23-
python-version: "3.12"
2418
- CYTHON: "==3.1.0"
2519
python-version: "3.10"
2620
- CYTHON: "==3.1.0"

autowrap/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,12 @@
4646
_cython_version = "0"
4747
else:
4848
try:
49-
_major_str = str(_cython_version).split(".")[0]
50-
if int(_major_str) < 3:
49+
_version_parts = str(_cython_version).split(".")
50+
_major = int(_version_parts[0])
51+
_minor = int(_version_parts[1]) if len(_version_parts) > 1 else 0
52+
if _major < 3 or (_major == 3 and _minor < 1):
5153
raise RuntimeError(
52-
"autowrap requires Cython >= 3.0; found Cython %s" % _cython_version
54+
"autowrap requires Cython >= 3.1; found Cython %s" % _cython_version
5355
)
5456
except Exception:
5557
# If parsing the version fails for some reason, do not block import here.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ classifiers = [
2929
]
3030
requires-python = ">=3.9"
3131
dependencies = [
32-
"Cython>=3.0",
32+
"Cython>=3.1",
3333
"setuptools",
3434
]
3535

tests/test_cython_version.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
from Cython.Compiler.Version import version as cython_version
22

33

4-
def test_cython_major_version_at_least_3() -> None:
5-
major_str = str(cython_version).split(".")[0]
6-
assert int(major_str) >= 3
4+
def test_cython_version_at_least_3_1() -> None:
5+
version_parts = str(cython_version).split(".")
6+
major = int(version_parts[0])
7+
minor = int(version_parts[1]) if len(version_parts) > 1 else 0
8+
assert major > 3 or (major == 3 and minor >= 1), (
9+
f"Expected Cython >= 3.1, but found {cython_version}"
10+
)
711

tests/test_files/inherited.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Generated with autowrap 0.23.0 and Cython (Parser) 3.2.0
1+
#Generated with autowrap 0.23.0 and Cython (Parser) 3.2.1
22
#cython: c_string_encoding=ascii
33
#cython: embedsignature=False
44
from enum import Enum as _PyEnum

0 commit comments

Comments
 (0)