• [gentoo-dev] [PATCH 0/9] Python 3.13 freethreading support

    From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Wed Oct 9 14:00:01 2024
    Hello,

    Here's a patchset that adds support for Python 3.13 freethreading
    version.

    Originally, this was dev-lang/python:3.13[-gil]. However, since it is ABI-incompatible at extension level with the regular build of CPython,
    upstream decided to split it into a separate /usr/lib/python3.13t
    install tree, with its own .so suffix, wheel tag and so on. All things considered, it seems to make most sense to treat it separately in Gentoo
    as well.

    So for this, we do:

    1. Introduce dev-lang/python-freethreading that installs
    the freethreading version of CPython (:3.13t).

    2. Introduce 'python3_13t' Python target for it.

    Note that at this point freethreading support is limited. Some packages
    do support it, others may work incidentally. Right now, the stable ABI
    is not supported at all. Hopefully, this will be improved
    in the future (and I really do hope we won't have to repeat this split
    for Python 3.14). In any case, the extra advantage of splitting it
    right now is that it permits us to test freethreading support separately
    and explicitly mark packages that work with that.

    Freethreading is considered experimental upstream. Unlike python3_13
    target, python3_13t is not intended to be unmasked on stable. We are
    also using a separate package name to avoid having to hack PV into
    something like 3.13.0 + 3.13.0-r100, and to avoid having Portage insist
    on installing the freethreading version, as it loves to proactively
    upgrade stuff. In fact, perhaps we should consider splitting all slots
    of Python into separate packages in the future.

    That said, the current implementation is not nice for PYTHON_COMPAT:

    PYTHON_COMPAT=( pypy3 python3_{10..13} python3_13t )

    I'm still considering our options here, but I don't think there's any
    really clean way of avoiding this.


    Michał Górny (9):
    dev-lang/python: Remove old
    dev-lang/python: Remove freethreading support
    profiles: Copy dev-lang/python entries for python-freethreading
    dev-lang/python-freethreading: New package, 3.13.0
    profiles: Add python3_13t (freethreading) target
    install-qa-check.d: Support dev-lang/python-freethreading
    python-utils-r1.eclass: Support python3_13t (freethreading) target
    app-portage/gpyutils: Add python3.13t
    distutils-r1.eclass: Do not use stable ABI wheels in freethreading

    .../gpyutils/files/implementations.txt | 1 +
    dev-lang/python-freethreading/Manifest | 3 ++
    .../python-freethreading/files/pydoc.conf | 6 +++
    .../python-freethreading/files/pydoc.init | 24 ++++++++++
    dev-lang/python-freethreading/metadata.xml | 39 +++++++++++++++
    .../python-freethreading-3.13.0.ebuild} | 47 +++++++------------
    dev-lang/python/Manifest | 3 --
    dev-lang/python/metadata.xml | 4 --
    dev-lang/python/python-3.13.0.ebuild | 15 +++---
    eclass/distutils-r1.eclass | 13 +++--
    eclass/python-utils-r1.eclass | 10 ++--
    eclass/tests/python-utils-r1.sh | 8 ++--
    metadata/install-qa-check.d/60python-site | 2 +-
    profiles/arch/alpha/package.use.mask | 1 +
    profiles/arch/hppa/package.use.mask | 1 +
    profiles/arch/loong/package.use.mask | 1 +
    profiles/arch/m68k/package.mask | 1 +
    profiles/arch/m68k/package.use.mask | 1 +
    profiles/arch/mips/package.use.mask | 1 +
    profiles/arch/s390/package.use.mask | 1 +
    profiles/base/make.defaults | 3 +-
    profiles/base/package.use.force | 7 +--
    profiles/base/package.use.mask | 2 +
    profiles/base/use.stable.mask | 2 +
    profiles/desc/python_single_target.desc | 1 +
    profiles/desc/python_targets.desc | 1 +
    profiles/features/hardened/package.use | 1 +
    profiles/features/musl/package.use.mask | 1 +
    profiles/features/prefix/package.use.mask | 1 +
    profiles/features/selinux/package.use.force | 1 +
    profiles/targets/desktop/gnome/package.use | 1 +
    profiles/targets/desktop/package.use | 2 +
    32 files changed, 143 insertions(+), 62 deletions(-)
    create mode 100644 dev-lang/python-freethreading/Manifest
    create mode 100644 dev-lang/python-freethreading/files/pydoc.conf
    create mode 100644 dev-lang/python-freethreading/files/pydoc.init
    create mode 100644 dev-lang/python-freethreading/metadata.xml
    rename dev-lang/{python/python-3.13.0_rc3.ebuild => python-freethreading/python-freethreading-3.13.0.ebuild} (92%)

    --
    2.47.0

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Wed Oct 9 14:00:01 2024
    Remove freethreading support from dev-lang/python in favor of a separate package. These two variations of Python are not ABI compatible and use separate installation trees.

    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    dev-lang/python/metadata.xml | 4 ----
    dev-lang/python/python-3.13.0.ebuild | 15 ++++++++-------
    profiles/base/make.defaults | 3 +--
    profiles/base/package.use.force | 6 ------
    4 files changed, 9 insertions(+), 19 deletions(-)

    diff --git a/dev-lang/python/metadata.xml b/dev-lang/python/metadata.xml
    index 97c6bd965b9f..22ce986e0676 100644
    --- a/dev-lang/python/metadata.xml
    +++ b/dev-lang/python/metadata.xml
    @@ -14,10 +14,6 @@
    to bootstrap pip and setuptools (if disabled, it will
    be only possible to use venv `--without-pip`)
    </flag>
    - <flag name="gil">
    - Build with Global Interpreter Lock. Disable to use
    - the experimental freethreading mode.
    - </flag>
    <flag name="jit">
    Enable experimental Just-In-Time compilation support.
    </flag>
    diff --git a/dev-lang/python/python-3.13.0.ebuild b/dev-lang/python/python-3.13.0.ebuild
    index 1f61895afb04..46dc39bae618 100644
    --- a/dev-lang/python/python-3.13.0.ebuild
    +++ b/dev-lang/python/pytho
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Wed Oct 9 14:00:01 2024
    A separate package installing the freethreading version
    of dev-lang/python.

    Closes: https://bugs.gentoo.org/940507
    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    dev-lang/python-freethreading/Manifest | 3 +
    .../python-freethreading/files/pydoc.conf | 6 +
    .../python-freethreading/files/pydoc.init | 24 +
    dev-lang/python-freethreading/metadata.xml | 39 ++
    .../python-freethreading-3.13.0.ebuild | 654 ++++++++++++++++++
    5 files changed, 726 insertions(+)
    create mode 100644 dev-lang/python-freethreading/Manifest
    create mode 100644 dev-lang/python-freethreading/files/pydoc.conf
    create mode 100644 dev-lang/python-freethreading/files/pydoc.init
    create mode 100644 dev-lang/python-freethreading/metadata.xml
    create mode 100644 dev-lang/python-freethreading/python-freethreading-3.13.0.ebuild

    diff --git a/dev-lang/python-freethreading/Manifest b/dev-lang/python-freethreading/Manifest
    new file mode 100644
    index 000000000000..733309cd531a
    --- /dev/null
    +++ b/dev-lang/python-freethreading/Manifest
    @@ -0,0 +1,3 @@
    +DIST Python-3.13.0.tar.xz 22532980 BLAKE2B 4a4e397199402de8c9fe8e4d63443ed972cbe8a4f541743908d699c7987127d1