Gentoo Archives: gentoo-project

From: "Michał Górny" <mgorny@g.o>
To: gentoo-project@l.g.o
Subject: Re: [gentoo-project] For next council meeting: moving Portage to python3.6+
Date: Wed, 25 Apr 2018 06:56:13
Message-Id: 1524639365.1104.16.camel@gentoo.org
In Reply to: Re: [gentoo-project] For next council meeting: moving Portage to python3.6+ by Zac Medico
1 W dniu śro, 18.04.2018 o godzinie 08∶58 -0700, użytkownik Zac Medico
2 napisał:
3 > On 02/23/2018 06:58 PM, Daniel Robbins wrote:
4 > > Hi there,
5 > >
6 > > Zac Medico and I would like to discuss the following at the next council
7 > > meeting: moving Portage to support only python3.6+. One of the primary
8 > > benefits of this change is that it will allow us to use python's native
9 > > async implementation as we look to make Portage faster at a critical
10 > > time when we are looking to improve Portage performance. As we approach
11 > > the stabilization of python3.6 in Gentoo, it seems like a good time to
12 > > discuss the process of jettisoning 2.7 support and standardizing on 3.6
13 > > for Portage.
14 > >
15 > > Right now, a custom 'asyncio-like' set of classes is used for async in
16 > > Portage. This limits interoperability with other async-friendly python
17 > > modules and produces additional maintenance overhead for the project.
18 > >
19 > > Maybe even more importantly, 3.6+ compatibility also gives us the
20 > > ability to use many other new language features and reduce the
21 > > maintenance overhead of having 2.7 compatibility for the extensive
22 > > Portage code-base. We expect that this will improve the velocity of
23 > > Portage development, provide opportunities to improve Portage
24 > > functionality and also allow us clean up a lot of unnecessarily complex
25 > > code (and eliminate code) that is there only to ensure compatibility
26 > > with 2.7.
27 > >
28 > > Best,
29 > >
30 > > Daniel
31 >
32 > In portage-2.3.30, portage's python API includes an asyncio event loop
33 > policy that is compatible with PEP 492 coroutines using async and await
34 > syntax [1]. This is possible while still maintaining backward
35 > compatibility with python2.7, though obviously you need to use a newer
36 > python if you want to use async and await syntax.
37 >
38 > I've posted a code example that is compatible with python2.7 and uses
39 > portage's event loop policy to do the same thing as emerge --regen,
40 > complete with --jobs and --load-average options [2].
41 >
42 > [1] https://www.python.org/dev/peps/pep-0492/
43 > [2]
44 > https://blogs.gentoo.org/zmedico/2018/04/17/portage-api-asyncio-event-loop/
45
46 <Council hat>
47 For the record, I still believe this is within Portage team's domain
48 to decide. Worst case, someone forks Portage and we switch to the fork
49 to provide better user experience.
50
51 If we really are supposed to vote on this, I would suggest a non-binding
52 wording alike:
53
54 Keeping Python<3.6 supported by Portage is recommended.
55
56 i.e. where 'abstain' votes would not result in implicit 'no' to your
57 request.
58 </Council hat>
59
60
61 As a developer, I am opposed to this. I am yet to see any evidence
62 of claimed performance improvements, improved interoperability (with
63 what?) and the reduced maintenance overhead. So far, the effort built
64 around asyncio seems to do the exact opposite of that, with
65 the refactoring adding a lot of extra code and a number of new bugs.
66
67 So please understand that I have serious doubts whether removing support
68 for older versions of Python would suddenly significantly reduce
69 the code size or complexity below the state before the refactoring
70 started. This really feels like 'switching to the new cool API' more
71 than actually working for any real gain.
72
73 Removing support for Python 2.7 is going to be a major drawback for our
74 users. I am not even going to consider those who intentionally reduce
75 their systems to 2.7 only for one reason or another. However, 2.7 has
76 been the Gentoo's 'LTS' so far -- different versions of Python 3 come
77 and go but 2.7 was there for a very long time to ease the transition.
78 Only recently one of the developers had to solve hard upgrade conflicts
79 and the simplest way of doing that was to unmerge Python 3 and use
80 Python 2.7 to install a new version.
81
82 Going up to 3.6 is even worse than that. I would like to remind you
83 that 3.5 is the *current stable* (i.e. the target set by make.defaults).
84 3.6 has stable keywords only as an effort to make it possible to test
85 and stabilize 3.6 support in packages sooner -- it does not imply that
86 we are ready to switch. Not to mention the whole backwards
87 compatibility deal.
88
89 With EAPI 7 approaching in days (and the implementation going to
90 probably have some inevitable bugs), switching supported Python
91 implementation (or doing any major refactorings, to say) is a very bad
92 idea. This is going to once again cause a horrible backwards
93 compatibility problem loop where people wouldn't be able to use EAPI 7
94 because they would need to provide means to upgrade Python and its
95 dependencies first, in order to be able to upgrade Portage.
96
97 --
98 Best regards,
99 Michał Górny

Replies