File tree Expand file tree Collapse file tree 3 files changed +24
-1
lines changed
src/scikit_build_core/builder Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,21 @@ configuration, with the variables:
6767- ` ${SKBUILD_NULL_DIR} ` : Anything installed here will not be placed in the
6868 wheel.
6969
70+ ## Limited API / Stable ABI
71+
72+ You can activate the limited ABI by setting When you do that,
73+ ` ${SKBUILD_SABI_COMPONENT} ` will be set to ` Development.SABIModule ` if you can
74+ target this (new enough CPython), and will remain an empty string otherwise
75+ (PyPy). This allows the following idiom:
76+
77+ ``` cmake
78+ find_package(Python REQUIRED COMPONENTS Interpreter Development.Module ${SKBUILD_SABI_COMPONENT})
79+ ```
80+
81+ This will add this only if scikit-build-core is driving the compilation and is
82+ targeting ABI3. If you want to support limited ABI from outside
83+ scikit-build-core, look into the ` OPTIONAL_COMPONENTS ` flag for ` find_package ` .
84+
7085## Future additions
7186
7287Scikit-build-core does not include helpers for F2Py or Cython like scikit-build
Original file line number Diff line number Diff line change @@ -198,6 +198,10 @@ the wheel tags for the version you support:
198198wheel.py-api = " cp37"
199199```
200200
201+ Scikit-build-core will only target ABI3 if the version of Python is equal to or
202+ newer than the one you set. ` ${SKBUILD_SABI_COMPONENT} ` is set to
203+ ` Development.SABIModule ` when targeting ABI3, and is an empty string otherwise.
204+
201205If you are not using CPython at all, you can specify any version of Python is
202206fine:
203207
Original file line number Diff line number Diff line change @@ -127,7 +127,11 @@ def configure(
127127 cache_config ["SKBUILD_PROJECT_VERSION" ] = str (version )
128128
129129 if limited_abi is None :
130- limited_abi = self .settings .wheel .py_api .startswith ("cp3" )
130+ if self .settings .wheel .py_api .startswith ("cp3" ):
131+ target_minor_version = int (self .settings .wheel .py_api [3 :])
132+ limited_abi = target_minor_version >= sys .version_info .minor
133+ else :
134+ limited_abi = False
131135
132136 python_library = get_python_library (self .config .env , abi3 = limited_abi )
133137 python_include_dir = get_python_include_dir ()
You can’t perform that action at this time.
0 commit comments