Microsoft Store package does not add the py.exe launcher


(Peter Suter) #1

From Python 3.7.1rc2 and 3.6.7rc2 now available for testing discussion topic (restricted to Committers):

the new Microsoft Store package … does not add the py.exe launcher

Why not?


(Steve Dower) #2

A combination of time/effort constraints and a question of “do we really need it”?

Due to platform limitations, the currenty py.exe code needs some major restructuring to be able to detect the new Store package (due to one minor caveat in how registry mirroring is handled, which I’m trying to just get fixed in the OS). So for starters, it doesn’t work.

Fixing this in the launcher requires making it aware of Store apps, which makes it incompatible with Windows 7 and so it can’t ship as the default. We could put it in the Store package, but then it’ll end up lower on PATH than the usual one, and so that doesn’t work either.

However, unlike the traditional installer, putting commands on PATH is actually reliable via the Store app. For years now we haven’t been putting regular Python on PATH by default (if you enabled it then you’ve opted into the weirdness, sorry) and if you’ve been following the defaults then now this one will behave correctly.

As a bonus, it was trivial to include python3 and python3.7 aliases, as well as aliases for pip and idle (with version number variants also). This makes using it more consistent with the majority of instructions out there, as all the python3 my_script.py commands now work just like on Linux.

If we figure out a reliable way to make the regular py.exe launcher work with old versions of Windows and also locate Store packages, we will. If fixing the OS means it can be discovered normally, even better. In either of these cases, we’ll simply add it to the package, since the equivalent regular py.exe will also work. If we end up having to have a special one, I’m hesitant to cause more confusion, and would honestly rather concede defeat and train people back to typing python3 just like they do everywhere else.


(Paul Moore) #3

The most likely reason here would be “to support registering the .py and .pyw extensions”. Running them via “python” would mean they didn’t respect shebang lines.


(Peter Suter) #4

Thanks for the detailed explanation.

Just to share my perspective: py.exe launcher has been a huge help to me as it seems to be the best way to deal consistently and easily with most of the different Pythons. For me it just works and solved or massively simplified many messy confusing problems. I encouraged everyone I know to start using it and it has had only upsides. The only problem so far was that Anaconda Python doesn’t work with it. So I had to start recommending not using that. I guess I’ll have to recommend not using the Windows Store Python as well.


(Steve Dower) #5

Yeah, there’s been an open bug to support PEP 514 fully for a while now, which would be able to detect Anaconda. We just haven’t had anyone to work on it. (Perhaps for you it “just works”, but many people have contributed a lot of their free time to make that happen.)

Right now I wouldn’t be encouraging everyone to switch to the store app either :slight_smile: It’s the first release and things will likely change over time.


(Steve Dower) #6

This is a good point. The extensions can be registered (and in fact are), but there’s no shebang handling in Python itself. I hadn’t thought about it, but it’ll be interesting to see who else misses it and why.

I’ll add a note to the docs before 3.7.2 mentioning this difference as well.


(Peter Suter) #7

Thousand thanks to them! :smiling_face_with_three_hearts:

I tried to find it. This one maybe? It’s spookily familiar. :ghost:


(Brett Cannon) #8

While it’s UNIX-only ATM, https://crates.io/crates/python-launcher could eventually be made to be cross-platform if I ever finish it and either I stay motivated enough to add Windows support or someone else comes along and contributes it. Not sure if bundling in the Store package would be problematic, though, thanks to it being maintained outside of the CPython repo.


(Steve Dower) #9

Haha, yeah. Guess I should have checked the OP before referring to it :slight_smile: