[GRASS-user] [GRASS-dev] experimental Python 3 support in trunk

Markus Metz markus.metz.giswork at gmail.com
Thu Sep 6 13:41:09 PDT 2018

On Thu, Sep 6, 2018 at 5:28 AM Vaclav Petras <wenzeslaus at gmail.com> wrote:
> On Wed, Sep 5, 2018 at 3:57 PM Markus Metz <markus.metz.giswork at gmail.com>
>> On Wed, Sep 5, 2018 at 9:41 PM Martin Landa <landa.martin at gmail.com>
>> >
>> > Hi,
>> >
>> > st 5. 9. 2018 v 21:38 odesílatel Markus Metz
>> > <markus.metz.giswork at gmail.com> napsal:
>> > > alternatively, the shebang in GRASS *.py files can be changed to
python3 (should be changed to python3 according to Python developer's Guide
>> >
>> > we are going to support both Python2 and 3, at least for 7.6/7.8,
right? Ma
>> the symbolic link python is deprecated and will disappear soon from
current distros: GRASS does not work if python does not exist, while
python2 and/or python3 might exist. Current distros are already replacing
the shebang in GRASS *.py files with python2. IMHO, if we want to support
python3 we need to change the shebang accordingly: no more support for
python2 in trunk.
>> - python as a link to python2 is no longer available on modern distros
>> - python3 is older than GRASS7
>> - all currently supported distros provide a full python3 environment
> Hi Markus and Martin,
> That being said, GRASS GIS does not fully support Python 3 yet and, with
exception of few contributions, there was no major work done on the Python
3 support up until recently, i.e. we are not ready to switch to 3 for 7.6.
I think we can have something like "technical preview" in 7.8 (e.g. with
warning "use 3 only if you have to"). 8.0 should fully support 3.
> Another thing is that Python 3 means using wxPython 4 to get the GUI
(other wxPythons don't support Python 3). That was hard to do for quite
some time (4.0.0 released in January), but now it is included, e.g., in
Ubuntu 18.04 (released April).
> As for the shebang, PEP394 says: "for the time being, all distributions
should ensure that python, if installed, refers to the same target as
python2, unless the user deliberately overrides this or a virtual
environment is active" and that "python should be used in the shebang line
only for scripts that are source compatible with both Python 2 and 3" which
is what we aim for. So that tells me we should keep there `python` and if a
distro decides to patch it to 2 (because their `python` does not point to
`python2` as PEP394 suggests) or perhaps later to 3 (because they want to
ensure `python3`), they are free to do that. We are not planning to drop
support for 2, so keeping `python` in shebang is appropriate in the long
term according to PEP394.

That means that trunk will continue to use python2 by default, and it also
requires that the link python is installed, which will, if installed, refer
to the same target as python2.

If we want to get python3 support tested in trunk, we must make it clear to
testers that python must refer to python3, contrary to PEP394, i.e. "the
user deliberately overrides this".

IMHO, we would get more feedback on python3 support if we change the
shebang to python3 in trunk.

Markus M

> Best,
> Vaclav
> Links:
> https://wxpython.org/news/wxpython-4.0.0-release/index.html
> https://wxpython.org/news/wxpython-4.0.0a1-release/index.html
> https://launchpad.net/ubuntu/+source/wxpython4.0
> https://www.python.org/dev/peps/pep-0394/
>> Markus M
>> _______________________________________________
>> grass-dev mailing list
>> grass-dev at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/grass-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20180906/6468ae30/attachment.html>

More information about the grass-user mailing list