I just installed python with brew install python and was a little surprised to get python 2.
Shouldn't python 3 nowadays be the default?
Probably wouldn't expect that until Apple goes to Python 3 in 2050.
Why does this depend on Apple? It's just a symlink, and I too would highly prefer that python links to python3. Of course this requires some more changes under the hood, but shouldn't this question be discussed among the Homebrew devs before dismissing it so quickly?
If you run other software that invokes "python" on macOS, it will expect a version 2 python.
Yes, but I'm not aware of software that uses the bundled Python version by calling python on the command line. The proper way to do that would be to specify the full path to the desired Python version (somewhere in /System/Library/Frameworks), which is what programs depending on the system Python likely do.
Yes, but I'm not aware of software that uses the bundled Python version by calling python on the command line.
There are lots of things that do this.
The proper way to do that would be to specify the full path to the desired Python version (somewhere in /System/Library/Frameworks), which is what programs depending on the system Python likely do.
Unfortunately the proper way doesn't mean we can make a change unless it's not going to break things.
This is something we may consider longer-term when we consider renaming python to e.g. python@2 and making it keg-only.
This is something we may consider longer-term when we consider renaming python to e.g. python@2 and making it keg-only.
Even if at that point brew install python installs python3, it should still be suffixed "python3" unless python (i.e., python@3) is also made keg_only.
I'm not fully into Homebrew terminology, but I think it would be great if such a move could be officially considered (I have the feeling that this discussion in a closed issue might be easily forgotten) - without the suffix, plain old python should be Python 3!
officially considered
It has been. I'm lead maintainer, I've considered it 馃槈.
without the suffix, plain old python should be Python 3!
This is a good long-term goal. Can you point to other package managers/distributions where this is the case today?
It has been. I'm lead maintainer, I've considered it 馃槈.
Nice, that was fast :-)! So by considering I meant approving, but I guess you're in favor of going in this direction mid- to long-term?
This is a good long-term goal. Can you point to other package managers/distributions where this is the case today?
It shouldn't be too long-term IMO, because it's 2017 and everyone should be using Python 3 except for very specific reasons (like a huge legacy code base).
I know that Arch Linux uses Python 3 as the default python (without any suffix).
Why can't the two Homebrew formulas not just be renamed to python2 and python3 - that way, nothing that Apple provides will be overwritten. Then the only thing needed is a symlink called python that points to the desired version and voil脿.
Nice, that was fast :-)! So by considering I meant approving, but I guess you're in favor of going in this direction mid- to long-term?
Maybe. I can't really speak for long-term goals as they depend on so many other things.
It shouldn't be too long-term IMO, because it's 2017 and everyone should be using Python 3 except for very specific reasons (like a huge legacy code base).
Your view on _should_ doesn't mean that we _should_ break other people's stuff knowingly.
I know that Arch Linux uses Python 3 as the default python (without any suffix).
Good to know. I'd probably want to see Debian and/or Ubuntu or similar do something like this first.
Why can't the two Homebrew formulas not just
As said: we'll consider such things longer-term. If any of this was trivial we'd be doing it today.
Your view on should doesn't mean that we should break other people's stuff knowingly.
Sure, it's always a tradeoff.
Good to know. I'd probably want to see Debian and/or Ubuntu or similar do something like this first.
Debian? Then you might as well wait until 2050 until Apple replaces Python with Python 3 :-P.
Debian? Then you might as well wait until 2050 until Apple replaces Python with Python 3 :-P.
Oh you thought I was kidding about that.
According to the Ubuntu Python wiki, the move to Python3 is planned for 18.04 (26th April 2018):
Obviously it remains to be seen whether it will actually happen.
@gibfahn it will happen, Python 2 will only be maintained for 2 more years, and no one should use Python 2 in new projects anymore. Many large projects have already started to sunset Python 2 support, newer releases are Python 3 only.
Also note PEP 394. TL;DR: scripts should use python2 or python3 in the shebang line. If they use python, they should be source compatible with Python 2 and Python 3. The python command usually refers to python2, but this might and will change in the future to python3 (e.g. Arch Linux and Anaconda already let python point to python3).
I still don't understand what the problem with renaming the python formula to python2 is, but python@2 and python@3 sound fine to me.
Most helpful comment
Yes, but I'm not aware of software that uses the bundled Python version by calling
pythonon the command line. The proper way to do that would be to specify the full path to the desired Python version (somewhere in/System/Library/Frameworks), which is what programs depending on the system Python likely do.