GeezerVison is showing github.com — [WIP] PEP 394: Allow not installing unversioned "python" command by encukou · Pull Request #893 · python/peps
Conversation
encukou
commented
Feb 13, 2019
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
The intended future for the python command is:
python doesn't exist and one always has to specify python2 or python3.
( – Guido, #630 (comment) )
There are three conflicting ideas around the python command, longer-term:
- The
python command should continue to refer to Python 2 (if Python 2 is available).
python is a correct shebang for py2/py3 source-compatible scripts.
- Python 2 should not be available (by default / after 2020).
One of these has to give.
It seems that (2) is the easiest to shed, so this proposal does just that.
-
Make python3 the preferred shebang for py2/py3 compatible scripts, as that's the only shebang that'll work on py2-less systems. (An exception is made for scripts targetting the system Python on e.g. macOS/RHEL.)
-
Make the unversioned python command optional (along with idle, pydoc, and python-config).
Distributions now do not need to install it by default, even if Python 2 is installed. (But they should make it installable explicitly, as long as they ship Python 2.)
This should introduce more people to systems without the "legacy" python command, encourage the use of explicit python2/python3, and ease switching to systems that don't have Python 2 at all.
-
Clarify that distributions should not make unversioned python configurable. (That might work for carefully managed systems, but the ecosystem should converge on python3, not "your python needs to be set properly".)
-
Remove mentions of choosing to link python to python3 in the future, as we don't expect to start recommending that.
-
Use the term "unversioned" python when contrasting it with python3/python2.
I found that this makes the message much clearer.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
The intended future for the ``python`` command is:
> ``python`` doesn't exist and one always has to specify ``python2``
> or ``python3``.
( – Guido, python#630 (comment) )
There are three conflicting ideas around the ``python`` command,
longer-term:
1. The ``python`` command should continue to refer to Python 2 (if
Python 2 is available).
2. ``python`` is a correct shebang for py2/py3 source-compatible scripts.
3. Python 2 should *not* be available (by default / after 2010).
One of these has to give.
It seems that (2) is the easiest to shed, so this proposal does just that.
* Make ``python3`` the preferred shebang for py2/py3 compatible
scripts, as that's the only shebang that'll work on py2-less systems.
(An exception is made for scripts targetting the *system* Python
on e.g. macOS/RHEL.)
* Make the unversioned ``python`` command optional (along with
``idle``, ``pydoc``, and ``python-config``).
Distributions now do not need to install it by default, even if
Python 2 is installed. (But they should make it installable
explicitly, as long as they ship Python 2.)
This should introduce more people to systems without the
"legacy" ``python`` command, encourage the use of explicit
``python2``/``python3``, and ease switching to systems that don't
have Python 2 at all.
* Clarify that distributions *should not* make unversioned
``python`` configurable. (That might work for carefully managed
systems, but the ecosystem should converge on ``python3``, not
"your ``python`` needs to be set properly".)
* Remove mentions of choosing to link ``python`` to ``python3`` in the
future, as we don't expect to start recommending that.
* Use the term **"unversioned"** ``python`` when contrasting it with
``python3``/``python2``.
I found that this makes the message much clearer.
|
Note:
I'm responsible for how this is handled in RHEL 8 beta, where /usr/bin/python is configurable (though configuring it is discouraged).
I don't recommend that in the PEP – I don't think it needs to cover distros that need to lock in the behavior of /usr/bin/python for a decade.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
It sounds to me like you're suggesting that py2/py3 compatible scripts be basically indistinguishable from Python 3 scripts, which in turn implies that a Python 3.x needs to be installed, even though the script could easily run on Py2. Is that your intention?
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
@Rosuav: Yes. In my opinion, that's the least bad option.
Note that Python 3 is available on the vast majority of systems. Notable exceptions I know of:
- macOS-provided Python, which AFAIK doesn't even have
python2, so it's basically a lost cause
- RHEL 7 (we're working on that, but I'm not allowed to say much more)
- Old OSes where people don't install new things lightly
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Cool. I'm absolutely okay with it too, but then, I'm one of those early adopters who runs everything on alpha releases, so my opinion carries little weight :)
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
So, I'm pretty new to Python, but:
Can I ask what the rationale is for removing python?
IMO using python3 makes Python 3.x seem like a fork of Python 2.x. But I thought the intent was the other way around: that Python 2.x would be the "fork", if it is to continue to exist. Isn't that whole idea of Python 2 End of Life?
I know a lot of distros kept python as python2, to preserve compatibility with legacy python programs. But IMO that's a backwards way of doing things.
Pretty much every other program I know of has foo execute the latest version, and then maybe older versions can be installed as fooX.Y. That makes more sense to me.
|
Nc432o5, artizirk, Ablesius, cclauss, and ncoghlan reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
@encukou Should this be closed in favour of #989?
@FlyingWombat The PEP is slowly being moved in that direction, but back when the PEP was first written (2011, just after Python 3.2 had been released), distros doing that was a genuinely bad idea, so we wanted to actively discourage them from doing it. The situation has changed a lot in the past eight years though, so the guidance needs to change accordingly.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
@encukou Should this be closed in favour of #989?
Ah, I knew I was forgetting something! Thanks for the reminder.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|