Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.maint.python > #9726

Re: MBF for deprecating Python2 usage

Path csiph.com!feeder.erje.net!2.eu.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Geoffrey Thomas <geofft@ldpreload.com>
Newsgroups linux.debian.maint.python
Subject Re: MBF for deprecating Python2 usage
Date Tue, 08 Aug 2017 00:50:02 +0200
Message-ID <ubZ0u-6St-17@gated-at.bofh.it> (permalink)
References <uawjU-5YP-3@gated-at.bofh.it> <uaBtf-1rM-9@gated-at.bofh.it> <uaLCi-867-15@gated-at.bofh.it> <uaS13-3Oj-19@gated-at.bofh.it>
X-Original-To debian-python@lists.debian.org
X-Mailbox-Line From debian-python-request@lists.debian.org Mon Aug 7 22:48:10 2017
Old-Return-Path <geofft@ldpreload.com>
X-Amavis-Spam-Status No, score=-2.6 tagged_above=-10000 required=5.3 tests=[BAYES_00=-2, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FOURLA=0.1, RCVD_IN_DNSWL_LOW=-0.7] autolearn=no autolearn_force=no
X-Policyd-Weight using cached result; rate: -6.1
X-Greylist delayed 514 seconds by postgrey-1.35 at bendel; Mon, 07 Aug 2017 22:31:01 UTC
Dkim-Signature v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=date:from:to :subject:in-reply-to:message-id:references:mime-version :content-type; s=sasl; bh=bo1PTZUXymvZhobVu0vJvro00yM=; b=RO/W4T XgYhG8oVjQH4xp8rpv6Fyv5UwEFoyt3LnZy31rWFO/HfmwCgPjhAeIT37RwkWRD6 /7VAKklh3PPdPqEqgDS3pn08FZQZBwB+SZ0KueWjgz1G39JWGu6CXNilSe5HX4MT hrcYPw/dwgW+l7EPeXdBVf4PNPkjfPk4mWLNE=
User-Agent Alpine 2.11 (DEB 23 2013-08-11)
MIME-Version 1.0
Content-Type TEXT/PLAIN; format=flowed; charset=US-ASCII
X-Pobox-Relay-ID E168EEEE-7BBE-11E7-9475-9D2B0D78B957-67873895!pb-smtp2.pobox.com
Dkim-Signature v=1; a=rsa-sha256; c=relaxed; d=ldpreload.com; h=date:from:to:subject:in-reply-to:message-id:references:mime-version:content-type; s=mesmtp; bh=QfJ0zs8mtvq5G5YJ9fyy/MvCWNIZhDhFDToseBsjuWE=; b=f+rTxFioaEY0pBKExRwZGuLYTqTYJmXNAJLhatAockQ1M/qc2jyqMAxM/U09zoB+TM/23FSBe4GsZN/LaJ6fMFwOGy+O9hBO8gOGeiumiLM+uqfxYy66+Nb5qPkRQjkB/bXQlGbOcPCk6rTmpLn3T9WBY0irUn6jxVXHuBychP4=
X-Mailing-List <debian-python@lists.debian.org> archive/latest/15107
List-ID <debian-python.lists.debian.org>
List-URL <https://lists.debian.org/debian-python/>
List-Archive https://lists.debian.org/msgid-search/alpine.DEB.2.11.1708061846220.1801@titan.ldpreload.com
Approved robomod@news.nic.it
Lines 42
Organization linux.* mail to news gateway
Sender robomod@news.nic.it
X-Original-Date Mon, 7 Aug 2017 18:22:20 -0400 (EDT)
X-Original-Message-ID <alpine.DEB.2.11.1708061846220.1801@titan.ldpreload.com>
X-Original-References <f8492955-8f73-8a18-456d-5bb400b5aff7@debian.org> <9614BFBC-E260-48A6-B722-DDD41E715A20@kitterman.com> <92E6FF73-391C-45FE-A213-6AAED284629D@debian.org> <2169853.TGgVnnX51X@kitterma-e6430>
Xref csiph.com linux.debian.maint.python:9726

Show key headers only | View raw


On Fri, 4 Aug 2017, Scott Kitterman wrote:

> If the primary concern is what happens when a user types "python", then can we
> address that in command-not-found and leave /usr/bin/python out of it?

Debian doesn't ship command-not-found by default. One other approach here 
would be to have /usr/bin/python exec python3 if it's run interactively -- 
that is, if isatty(0) -- and print an error message and exit otherwise. 
I don't think it is too bad to print an error message instead of failing 
the exec, since that's equivalent to what happens if you're missing a 
shared library or something: the exec succeeds, but the dynamic loader 
prints an error and exits nonzero.

Ship this /usr/bin/python with python3-minimal, and have the 
python-minimal package divert it and replace it with the current 
/usr/bin/python (a symlink to python2.7). This way we can build systems 
with Python 3 only that behave reasonably, but also allow doing `apt-get 
install python` to cause /usr/bin/python to start working again.


However, I feel like another reason to care about /usr/bin/python is so 
that sysadmins responsible for multiple platforms can continue writing 
#!/usr/bin/python (or #!/usr/bin/env python) scripts and use the same 
script on all their machines. If I can't do this and need 
platform-specific scripts, I might as well use some other language or ship 
compiled binaries. Keeping Python viable for this use case is a large part 
of why I originally proposed pythonmux: I can write scripts that declare 
that they're polyglot Python 2/3 and work on both Python 2-only and Python 
3-only systems, but a Python 2 script using #!/usr/bin/python will give me 
an error (as it should!) if there's no Python 2 installed on the machine.

Last time I checked (2015), entirely reasonable versions of RHEL and macOS 
both shipped only Python 2 and not Python 3. Is it likely to be the case 
that all UNIXy OSes within security support in 2019 or 2020 will have a 
/usr/bin/python3 (preferably 3.3+)? If so, that's a viable option. I just 
want my best migration path from #!/usr/bin/python to not involve 
rewriting my scripts in Go.

-- 
Geoffrey Thomas
https://ldpreload.com
geofft@ldpreload.com

Back to linux.debian.maint.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

MBF for deprecating Python2 usage Matthias Klose <doko@debian.org> - 2017-08-04 00:00 +0200
  Re: MBF for deprecating Python2 usage barry@debian.org - 2017-08-04 03:10 +0200
    Re: MBF for deprecating Python2 usage Scott Kitterman <debian@kitterman.com> - 2017-08-04 05:30 +0200
      Re: MBF for deprecating Python2 usage Piotr Ożarowski <piotr@debian.org> - 2017-08-04 08:10 +0200
      Re: MBF for deprecating Python2 usage barry@debian.org - 2017-08-04 16:20 +0200
        Re: MBF for deprecating Python2 usage Ole Streicher <olebole@debian.org> - 2017-08-04 17:10 +0200
          Re: MBF for deprecating Python2 usage Barry Warsaw <barry@debian.org> - 2017-08-04 17:50 +0200
        Re: MBF for deprecating Python2 usage Scott Kitterman <debian@kitterman.com> - 2017-08-04 23:10 +0200
          Re: MBF for deprecating Python2 usage Barry Warsaw <barry@debian.org> - 2017-08-05 03:40 +0200
            Re: MBF for deprecating Python2 usage Scott Kitterman <debian@kitterman.com> - 2017-08-05 04:10 +0200
          Re: MBF for deprecating Python2 usage Geoffrey Thomas <geofft@ldpreload.com> - 2017-08-08 00:50 +0200
        Re: MBF for deprecating Python2 usage Diane Trout <diane@ghic.org> - 2017-08-08 00:00 +0200
          Re: MBF for deprecating Python2 usage Barry Warsaw <barry@debian.org> - 2017-08-08 00:50 +0200
            Re: MBF for deprecating Python2 usage Ben Finney <bignose@debian.org> - 2017-08-08 01:40 +0200
              Re: MBF for deprecating Python2 usage Diane Trout <diane@ghic.org> - 2017-08-08 01:50 +0200
                Re: MBF for deprecating Python2 usage Ben Finney <bignose@debian.org> - 2017-08-08 03:40 +0200
                Re: MBF for deprecating Python2 usage Barry Warsaw <barry@debian.org> - 2017-08-08 04:00 +0200
                Re: MBF for deprecating Python2 usage Ben Finney <bignose@debian.org> - 2017-08-08 04:20 +0200
                Re: MBF for deprecating Python2 usage Diane Trout <diane@ghic.org> - 2017-08-08 05:10 +0200
                Re: MBF for deprecating Python2 usage Ben Finney <bignose@debian.org> - 2017-08-08 05:30 +0200
                Re: MBF for deprecating Python2 usage Diane Trout <diane@ghic.org> - 2017-08-08 05:40 +0200
                Re: MBF for deprecating Python2 usage Ben Finney <bignose@debian.org> - 2017-08-08 06:00 +0200
                Re: MBF for deprecating Python2 usage Barry Warsaw <barry@debian.org> - 2017-08-08 07:00 +0200
                Re: MBF for deprecating Python2 usage Geoffrey Thomas <geofft@ldpreload.com> - 2017-08-08 04:10 +0200
                Re: MBF for deprecating Python2 usage Ben Finney <bignose@debian.org> - 2017-08-08 04:30 +0200
                Re: MBF for deprecating Python2 usage Diane Trout <diane@ghic.org> - 2017-08-08 05:20 +0200
                Re: MBF for deprecating Python2 usage Ben Finney <bignose@debian.org> - 2017-08-08 05:40 +0200
                Re: MBF for deprecating Python2 usage Steve Langasek <vorlon@debian.org> - 2017-08-08 07:30 +0200
                Re: MBF for deprecating Python2 usage Ben Finney <bignose@debian.org> - 2017-08-08 08:20 +0200
                Re: MBF for deprecating Python2 usage Geoffrey Thomas <geofft@ldpreload.com> - 2017-08-10 17:40 +0200
                Re: MBF for deprecating Python2 usage Ole Streicher <olebole@debian.org> - 2017-08-08 21:20 +0200
                Re: MBF for deprecating Python2 usage Scott Kitterman <debian@kitterman.com> - 2017-08-08 21:30 +0200
    Re: MBF for deprecating Python2 usage Matthias Klose <doko@debian.org> - 2017-08-04 13:00 +0200
      Re: MBF for deprecating Python2 usage Scott Kitterman <debian@kitterman.com> - 2017-08-04 14:40 +0200
  Re: MBF for deprecating Python2 usage Adrian Bunk <bunk@debian.org> - 2017-08-07 00:00 +0200
  Re: MBF for deprecating Python2 usage Adrian Bunk <bunk@debian.org> - 2017-08-07 01:00 +0200
  Re: MBF for deprecating Python2 usage Christian Seiler <christian@iwakd.de> - 2017-08-07 01:10 +0200

csiph-web