Skip to content

Commit d70eff6

Browse files
committed
Build limited API 3.11+, closes #2033
1 parent bae50fa commit d70eff6

File tree

4 files changed

+18
-10
lines changed

4 files changed

+18
-10
lines changed

.github/workflows/smoke.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,9 @@ jobs:
3535
fail-fast: false
3636
matrix:
3737
config:
38-
- {os: ubuntu-24.04, python: "3.14t", ffmpeg: "8.0.1", extras: true}
3938
- {os: ubuntu-24.04, python: "3.12", ffmpeg: "8.0.1", extras: true}
40-
- {os: ubuntu-24.04, python: "pypy3.10", ffmpeg: "8.0.1"}
41-
- {os: macos-14, python: "3.10", ffmpeg: "8.0.1"}
39+
- {os: ubuntu-24.04, python: "pypy3.11", ffmpeg: "8.0.1"}
40+
- {os: macos-14, python: "3.11", ffmpeg: "8.0.1"}
4241

4342
env:
4443
PYAV_PYTHON: python${{ matrix.config.python }}
@@ -122,7 +121,7 @@ jobs:
122121
fail-fast: false
123122
matrix:
124123
config:
125-
- {os: windows-latest, python: "3.10", ffmpeg: "latest"}
124+
- {os: windows-latest, python: "3.11", ffmpeg: "latest"}
126125

127126
steps:
128127
- name: Checkout

.github/workflows/tests.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ jobs:
4040
arch: AMD64
4141
steps:
4242
- uses: actions/checkout@v6
43-
- uses: actions/setup-python@v5
43+
- uses: actions/setup-python@v6
4444
with:
45-
python-version: "3.13"
45+
python-version: "3.14"
4646
- name: Set Minimum MacOS Target
4747
if: runner.os == 'macOS'
4848
run: |
@@ -61,10 +61,9 @@ jobs:
6161
CIBW_ENVIRONMENT_MACOS: PKG_CONFIG_PATH=/tmp/vendor/lib/pkgconfig LDFLAGS=-headerpad_max_install_names
6262
CIBW_ENVIRONMENT_WINDOWS: INCLUDE=C:\\cibw\\vendor\\include LIB=C:\\cibw\\vendor\\lib PYAV_SKIP_TESTS=unicode_filename
6363
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: delvewheel repair --add-path C:\cibw\vendor\bin -w {dest_dir} {wheel}
64-
CIBW_SKIP: "pp*"
64+
CIBW_SKIP: "pp* cp312* cp313* cp314*"
6565
CIBW_TEST_COMMAND: mv {project}/av {project}/av.disabled && python -m pytest {package}/tests && mv {project}/av.disabled {project}/av
6666
CIBW_TEST_REQUIRES: pytest numpy
67-
CIBW_ENABLE: cpython-freethreading
6867
run: |
6968
pip install cibuildwheel delvewheel
7069
cibuildwheel --output-dir dist

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ authors = [
1010
{name = "WyattBlue", email = "[email protected]"},
1111
{name = "Jeremy Lainé", email = "[email protected]"},
1212
]
13-
requires-python = ">=3.10"
13+
requires-python = ">=3.11"
1414
classifiers = [
1515
"Development Status :: 5 - Production/Stable",
1616
"Intended Audience :: Developers",
@@ -20,7 +20,6 @@ classifiers = [
2020
"Operating System :: Unix",
2121
"Operating System :: Microsoft :: Windows",
2222
"Programming Language :: Cython",
23-
"Programming Language :: Python :: 3.10",
2423
"Programming Language :: Python :: 3.11",
2524
"Programming Language :: Python :: 3.12",
2625
"Programming Language :: Python :: 3.13",

setup.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@
2121
"swresample",
2222
]
2323

24+
if sys.implementation.name == "cpython":
25+
is_cpython = True
26+
options = {"bdist_wheel": {"py_limited_api": "cp311"}}
27+
else:
28+
is_cpython = False
29+
options = {}
2430

2531
# Monkey-patch Cython to not overwrite embedded signatures.
2632
old_embed_signature = EmbedSignature._embed_signature
@@ -142,6 +148,8 @@ def parse_cflags(raw_flags):
142148
include_dirs=[f"{IMPORT_NAME}/filter"] + extension_extra["include_dirs"],
143149
libraries=extension_extra["libraries"],
144150
library_dirs=extension_extra["library_dirs"],
151+
define_macros=[("Py_LIMITED_API", 0x030B0000)],
152+
py_limited_api=is_cpython,
145153
)
146154

147155
compiler_directives = {
@@ -186,6 +194,8 @@ def parse_cflags(raw_flags):
186194
libraries=extension_extra["libraries"],
187195
library_dirs=extension_extra["library_dirs"],
188196
sources=[pyx_path],
197+
define_macros=[("Py_LIMITED_API", 0x030B0000)],
198+
py_limited_api=is_cpython,
189199
),
190200
compiler_directives=compiler_directives,
191201
build_dir="src",
@@ -202,4 +212,5 @@ def parse_cflags(raw_flags):
202212
packages=find_packages(include=[f"{IMPORT_NAME}*"]),
203213
package_data=package_data,
204214
ext_modules=ext_modules,
215+
options=options,
205216
)

0 commit comments

Comments
 (0)