Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Python 3.11 is ready to enter PYTHON_COMPAT (and other Python news)
Date: Fri, 13 May 2022 15:51:53
Message-Id: 36e183b6e5cd4ebcfcf51bf8c7212a129f21f7de.camel@gentoo.org
1 Hi, everyone.
2
3 TL;DR:
4
5 1. Gentoo eclasses now support Python 3.11 in ~arch. Please start
6 testing your packages. (It's going to be stabilized once it leaves
7 beta, i.e. sometime Nov-Dec.)
8
9 2. We're switching to Python 3.10 in the beginning of June, so if you
10 haven't ported your packages yet, please hurry.
11
12 3. While updating your packages, please switch to DISTUTILS_USE_PEP517
13 build.
14
15 For help, please consult our docs:
16 https://projects.gentoo.org/python/guide/
17
18
19 ===================================
20 Python 3.11 now supported in Gentoo
21 ===================================
22 Python 3.11.0b1 has been released recently. This means upstream feature
23 freeze (i.e. technically no breaking changes, unless they do some last-
24 minute reverts like with 3.10.0 final). This in turn we can start
25 testing packages and marking them as 3.11 happy.
26
27 We've already have ported some initial packages (which nowadays means
28 tons of packages). My experience so far is that Python 3.11 is rather
29 painless, compared to previous releases. What usually breaks are gross
30 hacks or deprecations ignored for years (both common in Python ecosystem
31 but not that common).
32
33 Bad news is that for one useful package, you may end up having to deal
34 with half a dozen unmaintained, broken NIH dependencies. Good news is
35 that we're not alone with this, and neither we're the first ones to
36 fight Python 3.11. So if something's broken, then there's a good chance
37 that either it's already fixed in the upstream VCS repository or someone
38 has made a pull request/patch for it.
39
40 My usual recommendation is to prefer fixing problems over skipping
41 tests. However, if something is important enough and the test failures
42 are minor compared to the package's functionality, you can use
43 EPYTEST_IGNORE and EPYTEST_DESELECT to skip broken tests conditionally
44 to Python version. Sometimes it also makes sense to skip some
45 dependency (python_gen_cond_dep) and possibly tests depending on it
46 (using has_version). You can find some examples in the Guide, as well
47 as by grepping the existing ebuilds.
48
49 One package we haven't ported yet (and that we would really prefer not
50 to port) is dev-python/nose. It's unmaintained for years, we're already
51 carrying a ton of patches to keep it working and with Python 3.11, it's
52 once again a mess. Plus, the code itself is a mess full of hacks. Good
53 news is: 3.11 broke it completely, so upstreams can't just ignore
54 the problem ("it works in my virtualenv"), so there's some hope they
55 will be for switching to another test runner. That is, unless you're
56 dealing with yet another unmaintained NIH dependency of an unmaintained
57 NIH dependency. But there's some chance that you should be able to get
58 it running with pytest easily or with a reasonably small patch.
59
60 I'd also like to ask you to update your packages to EAPI 8 (if possible)
61 and DISTUTILS_USE_PEP517 while touching them. Setuptools has deprecated
62 `setup.py install` that the legacy builds are using long time ago. It
63 doesn't look like it's going to stop working anytime soon but it's
64 better to avoid running into last minute porting.
65
66 The new flags are currently stable-masked on all profiles. Python
67 3.11.0 final release is planned for October 2022. We're probably going
68 to stabilize it sometime after, then work on unmasking the flags.
69
70
71 =============================================
72 Python 3.10 coming as the default interpreter
73 =============================================
74 As announced before, we're going to be switching to Python 3.10
75 in the beginning of June 2022. There shouldn't be any unplanned delay,
76 and all the most important packages are ready.
77
78 If you haven't ported your packages, please do so ASAP.
79
80 If something isn't suitable for Python 3.10, it's probably a good idea
81 to give the users an early warning that it's likely to be lastrited
82 at some point.
83
84 If you need help, please don't hesitate to ask on #gentoo-python.
85 We can help, point you at the right docs or good examples of ebuilds.
86
87
88 TIA for all you help and have fun with new Pythons!
89
90 --
91 Best regards,
92 Michał Górny