Gentoo Archives: gentoo-project

From: Zac Medico <zmedico@g.o>
To: gentoo-project@l.g.o, Daniel Robbins <drobbins@××××××.org>
Subject: Re: [gentoo-project] For next council meeting: moving Portage to python3.6+
Date: Wed, 18 Apr 2018 15:58:15
Message-Id: 46696547-f923-4c51-7ae7-787f6c465afc@gentoo.org
In Reply to: [gentoo-project] For next council meeting: moving Portage to python3.6+ by Daniel Robbins
1 On 02/23/2018 06:58 PM, Daniel Robbins wrote:
2 > Hi there,
3 >
4 > Zac Medico and I would like to discuss the following at the next council
5 > meeting: moving Portage to support only python3.6+. One of the primary
6 > benefits of this change is that it will allow us to use python's native
7 > async implementation as we look to make Portage faster at a critical
8 > time when we are looking to improve Portage performance. As we approach
9 > the stabilization of python3.6 in Gentoo, it seems like a good time to
10 > discuss the process of jettisoning 2.7 support and standardizing on 3.6
11 > for Portage.
12 >
13 > Right now, a custom 'asyncio-like' set of classes is used for async in
14 > Portage. This limits interoperability with other async-friendly python
15 > modules and produces additional maintenance overhead for the project. 
16 >
17 > Maybe even more importantly, 3.6+ compatibility also gives us the
18 > ability to use many other new language features and reduce the
19 > maintenance overhead of having 2.7 compatibility for the extensive
20 > Portage code-base. We expect that this will improve the velocity of
21 > Portage development, provide opportunities to improve Portage
22 > functionality and also allow us clean up a lot of unnecessarily complex
23 > code (and eliminate code) that is there only to ensure compatibility
24 > with 2.7.
25 >
26 > Best,
27 >
28 > Daniel
29
30 In portage-2.3.30, portage's python API includes an asyncio event loop
31 policy that is compatible with PEP 492 coroutines using async and await
32 syntax [1]. This is possible while still maintaining backward
33 compatibility with python2.7, though obviously you need to use a newer
34 python if you want to use async and await syntax.
35
36 I've posted a code example that is compatible with python2.7 and uses
37 portage's event loop policy to do the same thing as emerge --regen,
38 complete with --jobs and --load-average options [2].
39
40 [1] https://www.python.org/dev/peps/pep-0492/
41 [2]
42 https://blogs.gentoo.org/zmedico/2018/04/17/portage-api-asyncio-event-loop/
43 --
44 Thanks,
45 Zac

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies