Gentoo Archives: gentoo-catalyst

From: Matthew Ruffalo <mmr15@××××.edu>
To: gentoo-catalyst@l.g.o
Subject: Re: [gentoo-catalyst] Python 3 support
Date: Tue, 21 May 2013 15:34:15
Message-Id: 519B93EE.8080707@case.edu
In Reply to: Re: [gentoo-catalyst] Python 3 support by Brian Dolbec
1 On 05/21/2013 10:33 AM, Brian Dolbec wrote:
2 > On Tue, 2013-05-21 at 12:33 +0200, Dmitry Selyutin wrote:
3 >> Hello everyone!
4 >>
5 >> Since I'm going to reimplement catalyst in GSoC, I'd like to tell my
6 >> opinion if it has some weight. :-)
7 >> Some years have passed since Python 3 was created, and nowadays I
8 >> think it is stable enough to select it. I'd rather thought about
9 >> Python 2 compatibility than Python 3, since it seems to become a
10 >> standart soon. To cut a long story short, I'd rather oriented to
11 >> Python 3 than Python 2, though I prefer to use Python 2 nowadays. Of
12 >> course compatibility will be one of main aims, but I see some benefit
13 >> if we will choose Python 3 rather than Python 2, though users may
14 >> successfully use catalyst with Python 2 in the future. It's just a
15 >> proposal, so I'd like to hear your opinions. If you don't agree, we
16 >> may rather think about Python 2.
17 > Dmitry, It's not that I don't want it to be python3 compatible as an
18 > afterthought. For the same reason as i told you already. Catalyst is a
19 > python2 application and is working code. It is better to fix all the
20 > poor areas of the code first before migrating to python3. Also, that
21 > will fix some of the compatibility issues on it's own. That way the
22 > changes can be properly tested. Changing the code to py3 will bring
23 > enough bugs into the system on it's own. It is far better to fix the
24 > poor code first.
25 >
26 >> Even more, I'd like to avoid some generators and provide this support
27 >> manually: I've always hated generators, especially code generators
28 >> (and GUI ones).
29 >>
30 >> What do you think about it?
31 > Catalyst should not need to have 2to3 run on it's codebase in the ebuild
32 > to be py3 compatible. python2.6 and up are mostly py3 compatible
33 > already. Catalyst does not do anything wild that should need porting
34 > between versions. There are also a few tricks that can be done to
35 > simplify compatibility without the need for conversion runs.
36 Thank you all for the advice and feedback. Things like "don't base any
37 real work on the master branch at
38 git://git.overlays.gentoo.org/proj/catalyst.git" are exactly what I was
39 hoping to hear.
40
41 Some other thoughts:
42
43 I wouldn't call what I'm proposing to do "refactoring". I've _used_
44 catalyst for quite a while but only looked at its code a few days ago.
45 The extent of my changes would be "make it run on Python 3 and update
46 some parts of the code to use newer/cleaner Python idioms".
47
48 Almost all of the bugs introduced in 2to3 conversion will be bytes/str
49 related, and it's easy enough to decode() text that is read from a
50 subprocess. Everything should be valid UTF-8, so there won't be any
51 unpleasant character encoding issues.
52
53 It's likely that I'm wrong about this, but I don't think that there is
54 much (any?) benefit to supporting Python 2 and Python 3 with the same
55 code base. I have added 2to3 conversion to a few setup.py files, but
56 these were in Python packages that still had to support Python 2 on
57 multiple distributions. Catalyst is fundamentally a Gentoo
58 _application_, and the implementation details don't really matter as
59 long as it runs on current Gentoo systems. From my own experience as a
60 user, I run the catalyst executable and I don't particularly care
61 whether it's implemented in C, Java, Haskell, Python, INTERCAL, etc. I
62 only care that I can 'emerge catalyst', make some tweaks to its files in
63 /etc, and run 'catalyst'.
64
65 Since Python 3.2+ is available on all current Gentoo systems and will be
66 from now on, I don't think there's anything to lose by doing a one-shot
67 conversion and changing relevant hashbang lines to "#!/usr/bin/env python3".
68
69 (Brian: you may want to change
70 http://dev.gentoo.org/~dolsen/catalyst/HEAD to contain "ref:
71 refs/heads/rewrite" :) )
72
73 Thanks,
74 MMR...

Replies

Subject Author
Re: [gentoo-catalyst] Python 3 support "W. Trevor King" <wking@×××××××.us>