Tidying up Python

Ryan Carsten Schmidt ryandesign at macports.org
Sun Jul 13 14:26:40 UTC 2025


On Jul 11, 2025, at 05:48, Bjarne D Mathiesen via wrote:
> 
> Den 11.07.2025 kl. 11.51 skrev Ryan Carsten Schmidt:
>>>> I believe I read somewhere that the python community recommends that "python" always be python 2.x, never python 3.x. Programs that want to use python 3.x should use the program name "python3". If "port select python" currently allows versions of python 3.x to be selected, we may want to change that.
>>> We did do a concerted effort in getting rid of python27 in macports some
>>> time back. If I remember correctly, I had a major part in updating a lot
>>> of stuff to at least python35 at that time.
>>> Python27 is offically dead. It was only being kept around in a comatose
>>> state because of a lot of stuff not having been upgraded to python3.x
>> None of that contradicts what I wrote. Any program running "python" expects it to be python 2.x. Don't make "python" be python 3.x or you will break those programs.
>> At least, that was the wisdom I gleaned last time I looked this up some years ago. If the position of the python community has changed since then, please provide a citation.
> 
> So, I used https://www.perplexity.ai/ with the following questions:
> 
> Q1 : what is the recommend default version of python on linux

The AI has answered what version of the Python language one should use by default. I don't disagree that when you have the choice you probably want to use a recent supported version of the language.

But that wasn't the question I brought up in this thread. I questioned whether the "python" command or symlink should ever be version 3.x. I said that if you want Python 3.x you should be using the "python3" command or symlink, leaving "python" to continue to be version 2.x so as not to break old software.

I don't remember where I read that or how many years ago it was, but it might have been this:

https://peps.python.org/pep-0394/

That PEP currently says that the decision of whether "python" should be 2.x or 3.x is left up to the distribution. We could therefore take our cue from Apple. In all versions of macOS that have "python", it is version 2.x. In all versions of macOS that have version 3.x, it is available as "python3" not "python". If you are writing scripts to share with other macOS users, following that example makes sense. It would make sense for the MacPorts "port select" system to follow that example as well. 

The PEP also has a historical note that it used to recommend "python" always be 2.x but that this has been relaxed now that 2.x is EOL. However it also still contains the rationale for why this is still a good idea. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-users/attachments/20250713/d5c76e93/attachment.htm>


More information about the macports-users mailing list