I’ve gone point by point through your comments. But the important thing is that my expectation is that the installer should install pymanager
and the default Python interpreter, all as part of the initial install. See below for an expansion on this point. If that happens, the rest of the user experience flows quite naturally.
I’m a strong +1 on the point you make that recommending another tool like uv or conda is effectively abandoning the idea of providing binaries. But unlike you, I’m very definitely against that option. Not just because of the disruption it would cause, but also because I feel that having an authoritative source of binaries is important.
My answer here is “neither of these”. In my view, installing PyManager should also install Python, so that after instaling PyManager, python
should run the newly-installed interpreter.
In trying to understand why you framed the question the way you did, it occurred to me that maybe MSIX installers are like wheels, and can only unpack files and set up shortcuts, with no capability to do “post-install actions” like running the newly installed app. If that’s the case, then the problem is that you’ve completely missed the fact that most participants in this discussion have no idea what the constraints are on the new MSIX installer. And in that case, I think you need (both here and in the PEP) to more clearly explain the constraints we’re working under, and why we have to accept them[1].
If “Installing PyManager also installs an initial Python interpreter” isn’t an option, then I agree we’re in a bad place (because Microsoft hijacked the python
command for this usage, not because of a decision we made). In that case, I think that python
installing and launching Python on first run is the best we can make of a bad job. But I think it should be very much a one-off thing, with the initial run of python
doing the install and then fixing the app alias to point to the interpreter, so that the long-term effect is the same as if Python had been installed when the manager was.
IMO, pymanager
should be just that - the manager. It shouldn’t run Python (unless we add a pymanager run
subcommand, but why bother with that?) Running it without a subcommand should provide usage help - just like other commands that use subcommands, such as git
, do.
Having a separate manager is a common pattern - rustup
, for example, is similar. I think this is a perfectly fine user experience, probably even better than having a weird “the manager can also run the language” mixture of responsibilities.
(Added while reviewing)
Re-reading this, I now think that you’re hinting at what I said above - the python
app alias initially points to some “other command” (not pymanager itself, but maybe a special “mode” of pymanager) which installs the runtime. If that is what you mean, then once it’s done the install, it should redirect the app alias to point at the new runtime. That’s sort of like saying “PyManager’s python
should launch the runtime”, but I don’t think there’s a need for an explicit "PyManager’s python
after that initial run.
(My initial comment)
I don’t know what “other command” you’re referring to here. In my model, python
always points to the command that runs the Python interpreter (specifically the interpreter that the user expects, which means “the default system one unless a venv is active, when it should be the active venv”).
If, by python
, you mean “the Windows AppAlias thing”, then I don’t understand enough about what constraints there are on what AppAliases do to be able to answer that question. Once again, I think you underestimate how much people understand the Windows side of this proposal.
My understanding is that the AppAlias can change what it points to - otherwise how would installing a new runtime change the version that python
runs? And my understanding is that a python.exe
on PATH
overrides the AppAlias. Putting those two facts together, I would say that the AppAlias should point to the installed Python that’s marked as the “default”. That way, it behaves exactly as the core interpreter (because it is the core interpreter), and activating a venv replaces it with a python
command that behaves the same way (by the design of venvs). If any of that isn’t possible, you need to explain why the AppAlias mechanism prevents it - both here and in the PEP.
It should not support -V:
or shebangs, because the core interpreter doesn’t. The pymanager
command should not support those either, because it’s a manager, not a runner (again, if you want to allow pymanager run
then that could be an exception).
The py
command should support these things, as it currently does. And with that in mind, installing pymanager
should also install py
, which behaves functionally exactly the same as it currently does. In some ways, py
could be viewed as equivalent to the possoble pymanager run
command I’ve mentioned a couple of times, but I see py
as the most important one to include (for backward compatibility reasons) with pymanager run
as an optional extra.
No, it shouldn’t. python -V:3.12
is an error according to the Python documentation (there’s no documented -V
option), so it should give an error, just like python -F
does.
Users should use py -V:3.12
, just like they currently do on Windows, or use python3.12
, just like they currently do on Unix. We shouldn’t provide auto-install, users can manually install the versions they need (and speaking as a user, I’m perfectly happy with a tool that says “what gets downloaded and installed is under your control” rather than downloading things for me).
OK. Two scenarios.
First Scenario
New user, on a new machine. Personally, I’d go to the Store and look for Python to install it manually, but let’s say I somehow went to the command line and typed python
. It opens the store. I’m a little confused, but whatever, I can now download “Python”, so I do. I’d hope the Store page explains that this will install the Python interpreter and a pymanage
tool to manage my Python installations, but I’m cynical enough to expect that it just says “Woohoo! Python is awesome, have fun doing AI and data analysis with the best language ever!!!” Now, I go back to the command prompt and run python
. I’d expect Python to start. I’d expect it to work exactly like the python
command documented in the Python documentation, and in all the Reddit and StackOverflow articles I read rather than reading the documentation I’d hopefully know (either from the store page or from Reddit/StackOverflow - or maybe even by reading the Python docs!!!) that there’s a pymanage
command which lets me install new runtimes, and do other cool stuff. But for most day to day usage, I’d expect things to “just work”.
As a naive user, I’d expect to be able to double click on .py
or .pyw
files, and be able to associate them with Python. I’d prefer it if the installer had done that for me, but I can live with having to do it myself. But if I have to do it myself, I’d want there to be only one pair of choices - “Associate with Python (Console)” or “Associate with Python (GUI)”. This probably means using the py
launcher, as it was explicitly designed for this use case - which is why I want it installed alongside Python. I would not want to have to pick a Python version. In fact, I would probably not even have multiple Python versions. The only use I’d make of the manager would be to upgrade Python, and I’d probably wonder why the Store app didn’t auto-upgrade. But the first time I upgraded my Python and my existing scripts got broken, I’d be enlightened. At that point, I’d want to be able to use multiple versions, and I’d need to find out about shebangs, the launcher, maybe even virtual environments. Now I’m not a new user, though, and while my experience starts to degrade rapidly from here, that is not the problem we’re trying to solve in this PEP.
Second Scenario
I’m a relatively experienced Python user on Windows. I’ve been using Python for a number of versions - maybe I have multiple versions on my PC. I am familiar with virtual environments. I generally use the official distribution, not the Store one. Maybe I use the launcher, maybe I add python to my PATH
. I’m grumpy and cynical, because it’s all annoyingly hard, but I’ve got something that works. Now the new version of Python comes out, and it uses the new launcher. Maybe I’ve heard that you can now get “proper” Python from the Store, or maybe I got the MSIX from python.org. Either way, I run the installer. I want it to just install, not to start Python for me. But I do expect it to install the latest version of Python.
I run python
. I expect to see the new version of Python start. If I typically use py
, I’m trying out whether python
now works. It does. Unless I disabled the python
AppAlias, in which case I probably forgot I’d done that and wonder why I’m getting “Command not found”. But I try py
and it works. Great. Now I try pymanager
. Also great - I can uninstall all those old Python versions, and reinstall them from here, managing everything from one place. At this point, I might break everything, because I forgot that all my venvs are tied to the existing installations. But maybe I’m lucky and remember that. And after all, “recreating venvs is easy” isn’t it? Sigh. Maybe I’ll keep the old versions as they are for now. (A note here - what happens if I have Python 3.12 installed and then install a second copy via pymanager? Will the two be separate in the registry?) I try some venvs, both old ones and new ones I create for testing. Running Python using py
or python
works just fine, as expected.
But overall, everything is good. It’s not clear to me (writing this scenario) whether the py
command is now running the old py
installed with previous Python versions, or a new py
installed with the manager, but I (the user in the scenario) don’t actually care, as long as it keeps working (and will continue to do so when I uninstall the older Python versions).
On the other hand, if I added Python to my PATH
, I expect to need to change my PATH
, but I’m not sure what to change it to, because the installer didn’t talk about PATH
and didn’t offer an “Add to PATH” option. Maybe I just need to remove old Python versions from PATH
? Should I have done that before installing? Anyway, python
is still running the old Python version. That’s annoying. I remove Python from PATH
by manually hacking it - it’s annoying that you can add Python to PATH
when installing, but there’s no supported way to remove it later (short of uninstalling). But I’m sort of used to that - I had to do it every time I upgraded[2]. OK, now python
runs the new version. Cool.
Most of the rest goes the same as the py
user, although the benefits of switching to managing older versions of Python via pymanager
are more compelling here - the pythonX.Y
aliases and easier switching of the default version being the two clear wins.
(Apologies if I’ve made “add Python to PATH
” seem like a terrible experience - I haven’t used it myself in years, and maybe it’s not as bad as I remember it being. The point is that I think it would be a rougher ride than using the launcher, but not in any way that would be unfamiliar to someone who used that approach).
This relates more to why we’re proposing msix/pymanager as the official python.org installer, I’m assuming we have no choice over msix for the store app ↩︎
or if I didn’t, my
PATH
is a bit of a mess, and I have a tidying up exercise to do… ↩︎