@@ -3,31 +3,34 @@ Title: ABI features as environment markers
33Author: Klaus Zimmermann <klaus_zimmermann@gmx.de>,
44 Ralf Gommers <ralf.gommers@gmail.com>
55Sponsor: Lysandros Nikolaou <lisandrosnik@gmail.com>
6- Discussions-To: https://discuss.python.org/t/60007
76Status: Draft
87Type: Standards Track
98Topic: Packaging
109Created: 21-Mar-2025
1110Python-Version: 3.14
11+ Post-History:
12+ `5 Aug 2024 <https://discuss.python.org/t/60007 >`__,
1213
1314..
14- If adopted , the contents of this pep should be integrated into the
15+ If accepted , the contents of this PEP should be integrated into the
1516 canonical documentation in the Python Packaging User Guide and the
1617 following directive should be added here:
1718 .. canonical-pypa-spec:: :ref:`packaging:dependency-specifiers`
1819
1920Abstract
2021========
2122
22- This PEP defines new environment markers for project dependencies.
23+ This PEP defines using ABI features as environment markers for project
24+ dependencies, through a new ``sys_abi_features `` environment marker and
25+ :data: `!sys.abi_features ` attribute in the :mod: `sys ` module.
2326:pep: `508 ` (later moved to :ref: `packaging:dependency-specifiers `) introduced
2427environment markers to specify dependencies based on rules that describe
2528when the dependency should be used.
2629This PEP extends the environment markers to allow specifying dependencies
2730based on specific ABI features of the Python interpreter.
2831For this, it defines a set of `ABI Features `_ and specifies how they are made
2932available via an `Addition to the Python Standard Library `_ in the form of a
30- new attribute `` sys.abi_features ` `, as well as for `Environment Markers `_ as a
33+ new attribute :data: ` ! sys.abi_features `, as well as for `Environment Markers `_ as a
3134new marker variable, ``sys_abi_features ``.
3235
3336Motivation
@@ -55,7 +58,7 @@ marker for free-threading`_ Discourse thread:
5558- Cython has (experimental) support for free-threading only in its master
5659 branch, and is used by a lot of projects that already publish ``cp313t ``
5760 wheels. Picking up the wrong Cython version is causing a lot of obscure build
58- failures and runtime crashes. It would be quite beneficial if the metadata
61+ failures and runtime crashes. It would be beneficial if the metadata
5962 could express that (c.f. `Require Cython Pre-release for Free-Threaded
6063 Python `_).
6164- CFFI has no support for free-threading yet, and `Armin Rigo, one of the
@@ -73,23 +76,21 @@ marker for free-threading`_ Discourse thread:
7376While these concrete examples may be addressed later this year by Cython and
7477CFFI making compatible releases, the same issue is going to repeat further up
7578the stack. The free-threading rollout is expected to take several years, and an
76- environment marker for free-threading will make that rollout significantly less
77- bumpy.
79+ environment marker for free-threading will make that rollout significantly easier.
7880
7981Another important ABI feature that is not yet covered by environment markers is
8082the bitness of the interpreter. In most cases, the ``sys_platform `` or
8183``platform_system `` markers are enough, because there's only a single bitness
8284in use per platform. This is not the case on Windows however: both 32-bit and
838564-bit Python interpreters are widely used on x86-64 Windows. Not being able to
84- distinguish between the two may be relevant for packages that provide C
86+ distinguish between the two may be relevant for packages that provide compiled
8587extensions. For example, SciPy does not provide ``win32 `` wheels (it isn't able
8688to due to the lack of a suitable 32-bit compiler toolchain with Fortran
8789support). Those wheels lacking can be awkward especially for projects where
8890SciPy is an optional dependency only. In that case, it would be useful to be
8991able to specify that SciPy is required *unless * the interpreter is a 32-bit one
90- on Windows (c.f. `Require SciPy Unless on 32-bit win32 `_) - it avoids users who
91- install such packages to get failed from-source installs because of the missing
92- wheels.
92+ on Windows (c.f. `Require SciPy Unless on 32-bit win32 `_), to avoid failed
93+ from-source installations due to the missing wheels.
9394
9495
9596Rationale
@@ -122,7 +123,7 @@ more clarity.
122123A Forward Looking View on Free-Threaded Python
123124----------------------------------------------
124125
125- :pep: `703 `, which is the accepted proposal for free threading, states that the
126+ :pep: `703 `, the accepted proposal for free threading, states that the
126127rollout of free-threaded Python should be gradual, which has been clarified
127128by the Python Steering Council in `the PEP 703 acceptance post `_ to mean a
128129three stage process over multiple releases. It is therefore important to make
@@ -193,7 +194,7 @@ ABI features are intrinsic properties of the Python interpreter, expressed as
193194simple, understandable strings.
194195However, not all features are equally applicable to all Python interpreters or
195196Python versions. For example, the distinction between free-threaded and
196- GIL-enabled interpreters is only relevant for CPython >= 3.13, but the bitness
197+ GIL-enabled interpreters is only relevant for CPython 3.13 onwards , but the bitness
197198of the interpreter is relevant for all interpreters.
198199
199200All interpreters MUST handle the following ABI features as stated.
0 commit comments