[Python-ideas] Adding python to Windows. Was :Re: Make py.exe default to Python 3

Steve Dower steve.dower at python.org
Wed Mar 16 14:44:07 EDT 2016


On 16Mar2016 1115, Oscar Benjamin wrote:
> That would be amazing! Then I guess all the major OSes would ship with
> Python making simple Python scripts portable and solving a lot of the
> problems that pyinstaller/py2exe try to solve.
>
> Can you expand on how that might work? The detail affects which problems
> it would solve. Would it be like the system Python on OSX?

So my main concern about getting Python shipping with Windows has always 
been long-term compatibility. Basically, we're in the same category as 
LTS RHEL: whatever ships now *will still be 100% compatible with what we 
are shipping in ten years time* (yes, that's an aspiration more than a 
guarantee, but it certainly rules out 3.n->3.(n+1) upgrades).

As a result, if Python did ship in Windows, I'd be trying really hard to 
make it an internal implementation detail to discourage people from ever 
relying on it. As Nick Coghlan said when I last chatted with him about 
this, "please, please, learn from our mistakes" :)

So the idea that I was working on was effectively the py.exe launcher, 
but taking over the global "python" name (and probably 
"python3"/"python2"), and with the addition of useful error messages 
(i.e. with URLs or extra tools) for when you try and run "python" 
without having installed it. And also add proper support for configuring 
defaults and active virtual environments (which are both in the current 
py.exe launcher, but seem to not be well known). Shebang support would 
stick around and be encouraged, along with specifying Python language 
versions such that scripts will run with the correct version on new 
machines.

The install step may be painful the first time, but since Python 3.5+ 
does not require admin privileges, it should be quick and easy for most 
people. I don't see us going out of our way to update legacy versions to 
do this - they'll continue to need admin rights.

This would obviously be a big and unexpected change for users, but it 
seems to be the most viable way of making Python universally available 
without locking into a specific version for 10+ years or essentially 
forking a "Microsoft Python" that ends up being very different from 
CPython releases.

And the value only comes from this feature being available by default on 
all machines, so it becomes a question of "does this add enough value to 
be worth the pain?" For education purposes, it certainly does. My gut 
feel is that when this sort of change comes with an operating system 
upgrade (not just an update), it'll be okay, and if it's opt-in for 
earlier versions then people won't be too surprised.

But, alas, I've been finding myself with not enough support around the 
company to get it through, and not enough time to do all the politicking 
and engineering work myself. I started a launcher rewrite at 
https://github.com/zooba/PyLauncher if anyone is interested in looking 
(it's very C++, as opposed to C). Can't promise that it'd remain 
open-source or accept contributions, but I'd certainly try.

Cheers,
Steve



More information about the Python-ideas mailing list