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 Newsgroups: linux.debian.maint.python Subject: Re: MBF for deprecating Python2 usage Date: Tue, 08 Aug 2017 00:50:02 +0200 Message-ID: References: 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: 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: archive/latest/15107 List-ID: List-URL: 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: X-Original-References: <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 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