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

Oscar Benjamin oscar.j.benjamin at gmail.com
Wed Mar 16 18:13:01 EDT 2016


On 16 Mar 2016 18:44, "Steve Dower" <steve.dower at python.org> wrote:
>
> 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" :)

I can understand that. The OSX system Python is like that. You're not
supposed to mess with it and when you want to do some programming every
guide suggests to install a newer non-system Python. I often see reports of
people getting into trouble after removing the system Python because they
wanted a newer version for some reason.

However I do really like the fact that there is *some* Python installed and
Windows is the only OS where this is not the case. As long as some Python
is installed I can bundle a bunch of Python code in a zip file and I've got
a portable program. On Windows it's only portable if you ask someone to
install Python first which is often a deal-breaker (hence py2exe).

> 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 privileges

So this Python.exe is a launcher that is bundled with Windows which solves
your concerns about PATH manipulation and then when Python is actually
installed it hooks into this launcher?

> 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.

To what extent can the same benefits be achieved by bundling the same
launcher in the Python installer? Is it just that it would require elevated
privileges? I'm not sure that that would be a significant problem for e.g.
my students. They'd just have to type in their passwords (on their own
laptops) right?

--
Oscar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160316/e6def4a3/attachment-0001.html>


More information about the Python-ideas mailing list