Skip to content

Commit 81b5daf

Browse files
authored
feat(cython): ABI3 Compatibility Update (#71)
1 parent b816dab commit 81b5daf

File tree

4 files changed

+28
-9
lines changed

4 files changed

+28
-9
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ env:
66
CIBW_TEST_REQUIRES: "pytest torch"
77
CIBW_TEST_COMMAND: "pytest -svv --durations=20 {project}/tests/python/"
88
CIBW_ENVIRONMENT: "MLC_SHOW_CPP_STACKTRACES=1"
9+
CIBW_REPAIR_WHEEL_COMMAND_LINUX: >
10+
auditwheel repair -w {dest_dir} {wheel} &&
11+
pipx run abi3audit --strict --report {wheel}
12+
CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
13+
delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel} &&
14+
pipx run abi3audit --strict --report {wheel}
15+
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >
16+
pipx run delvewheel repair -w {dest_dir} {wheel} &&
17+
pipx run abi3audit --strict --report {wheel}
918
MLC_CIBW_VERSION: "2.22.0"
1019
MLC_PYTHON_VERSION: "3.9"
1120
MLC_CIBW_WIN_BUILD: "cp39-win_amd64"

.github/workflows/release.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,22 @@ env:
88
CIBW_BUILD_VERBOSITY: 3
99
CIBW_TEST_COMMAND: "python -c \"import mlc\""
1010
CIBW_ENVIRONMENT: "MLC_RELEASE=1"
11+
CIBW_REPAIR_WHEEL_COMMAND_LINUX: >
12+
auditwheel repair -w {dest_dir} {wheel} &&
13+
pipx run abi3audit --strict --report {wheel}
14+
CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
15+
delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel} &&
16+
pipx run abi3audit --strict --report {wheel}
17+
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >
18+
pipx run delvewheel repair -w {dest_dir} {wheel} &&
19+
pipx run abi3audit --strict --report {wheel}
1120
MLC_CIBW_VERSION: "2.22.0"
1221
MLC_PYTHON_VERSION: "3.9"
13-
MLC_CIBW_WIN_BUILD: "cp3*-win_amd64"
14-
MLC_CIBW_MAC_BUILD: "cp3*-macosx_arm64"
15-
MLC_CIBW_MAC_X86_BUILD: "cp3*-macosx_x86_64"
16-
MLC_CIBW_LINUX_X86_BUILD: "cp3*-manylinux_x86_64"
17-
MLC_CIBW_LINUX_ARM_BUILD: "cp3*-manylinux_aarch64"
22+
MLC_CIBW_WIN_BUILD: "cp39-win_amd64"
23+
MLC_CIBW_MAC_BUILD: "cp39-macosx_arm64"
24+
MLC_CIBW_MAC_X86_BUILD: "cp39-macosx_x86_64"
25+
MLC_CIBW_LINUX_X86_BUILD: "cp39-manylinux_x86_64"
26+
MLC_CIBW_LINUX_ARM_BUILD: "cp39-manylinux_aarch64"
1827

1928
jobs:
2029
windows:

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ add_dependencies(mlc mlc-shared)
151151
########## Target: `mlc_py` ##########
152152

153153
if(MLC_BUILD_PY)
154-
find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)
154+
find_package(Python COMPONENTS Interpreter Development.SABIModule REQUIRED)
155155
file(GLOB _cython_sources CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/python/mlc/_cython/*.pyx")
156156
set(_cython_outputs "")
157157
foreach(_in IN LISTS _cython_sources)
@@ -166,7 +166,7 @@ if(MLC_BUILD_PY)
166166
)
167167
list(APPEND _cython_outputs "${_out}")
168168
endforeach()
169-
Python_add_library(mlc_py MODULE ${_cython_outputs} WITH_SOABI)
169+
Python_add_library(mlc_py MODULE ${_cython_outputs} USE_SABI 3.7)
170170
set_target_properties(mlc_py PROPERTIES OUTPUT_NAME "core")
171171
target_include_directories(mlc_py PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include")
172172
target_include_directories(mlc_py PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/dlpack/include")

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ authors = [{ name = "MLC Authors", email = "[email protected]" }]
2727
[project.optional-dependencies]
2828
tests = ['pytest', 'torch']
2929
dev = [
30-
"cython>=3",
30+
"cython>=3.1",
3131
"pre-commit",
3232
"pytest",
3333
"pipx",
@@ -38,7 +38,7 @@ dev = [
3838
]
3939

4040
[build-system]
41-
requires = ["scikit-build-core>=0.9.8", "cython", "setuptools-scm"]
41+
requires = ["scikit-build-core>=0.9.8", "cython>=3.1", "setuptools-scm"]
4242
build-backend = "scikit_build_core.build"
4343

4444
[tool.setuptools_scm]
@@ -53,6 +53,7 @@ cmake.build-type = "RelWithDebInfo"
5353
logging.level = "DEBUG"
5454
wheel.license-files = []
5555
wheel.install-dir = "mlc"
56+
wheel.py-api = "cp39"
5657
install.strip = false
5758
build-dir = "build-wheels/{wheel_tag}-{build_type}"
5859
sdist.include = ["python/mlc/_version.py"]

0 commit comments

Comments
 (0)