This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Support -3.11-arm64 in py.exe launcher
Type: enhancement Stage: resolved
Components: Windows Versions: Python 3.11
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: steve.dower Nosy List: TommyVCT, brett.cannon, conio, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords: patch

Created on 2022-01-28 16:52 by steve.dower, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
launcher.msi steve.dower, 2022-03-25 16:54
Pull Requests
URL Status Linked Edit
PR 32062 merged steve.dower, 2022-03-23 00:37
PR 32204 merged steve.dower, 2022-03-30 19:34
Messages (16)
msg412008 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2022-01-28 16:52
We now have a traditional installer that runs on Windows ARM64 devices, but it omits the py.exe launcher. This is because sys.winver is "3.11-arm64" and hence the registry tag (see PEP 514) is not detected by the launcher.

Currently, the launcher is not included in the installer and appears as disabled with an explanatory note.

We need to add support for it eventually, and possibly block the final/RC/beta releases if we don't have it. (We don't ship the launcher with Nuget or Store packages, so nobody will miss it there, but they probably will here.)

32-bit apps can still run on ARM64, so it isn't essential to make it a native process. It just has to be able to detect the registry keys.

It should still support 32-bit and 64-bit installs, because those can also be run on ARM64 devices (though there are numerous things that don't work as well as a native build).

Possibly we want to just do the work to directly follow PEP 514 now? Depends on who volunteers to work on this, I guess.
msg412481 - (view) Author: Tommy Vercetti (TommyVCT) Date: 2022-02-03 22:36
PEP 514 looks good to me
msg414299 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2022-03-01 22:10
I'm working on this now.
msg414928 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2022-03-11 18:17
I'm working on what's become a rewrite of the launcher. If anyone would like to follow along, you can see my changes at bpo-46566">https://github.com/python/cpython/compare/main...zooba:bpo-46566

It's still missing some functionality, and I'm not sure it's any faster or less complex than the previous version :) But it should handle ARM64 properly, and also knows how to do an install of a requested version if you don't already have it (still TBD whether that stays)
msg414929 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2022-03-11 18:18
Hah, that's funny URL formatting. Let's see if this is any better:

<bpo-46566">https://github.com/python/cpython/compare/main...zooba:bpo-46566>
msg414936 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2022-03-11 21:05
If it's already turning into a rewrite, how feasible would it be to adopt Brett's `py` launcher?
msg415165 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2022-03-14 17:02
> If it's already turning into a rewrite, how feasible would it be to adopt Brett's `py` launcher?

I looked at it already, and I'd have to write literally the same code to implement what's needed :) (as well as learning Rust and convincing everyone to let us use Rust in CPython...). Practically nothing can be reused - there's no registry, no shebang handling, and our process launching on Windows is already very complex (and has to remain that way for compatibility).

For now, the old launcher will remain to be used for venv redirectors, but I've got the setup in the new one to be able to play the same role, as well as potentially being able to be a script or .pyz launcher with a simple rename.

If Brett's proposal for extensions (other executables on PATH that know how to identify Python installs) happens, we'll probably copy it, though PEP 514 covers Windows adequately (and the rewrite allows non-PythonCore installs to be found/launched). But the codebase itself isn't helpful.
msg415168 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2022-03-14 17:13
> as well as potentially being able to be a script or .pyz launcher with a simple rename.

Would it be possible to also make the launcher work when prepended to a zipfile? That's a really useful use-case (make a zipapp automatically runnable, but still a single file) that at the moment needs a 3rd party launcher (Vinay's simple-launcher project).

If not, then that's fine, but if we're already doing a significant rewrite that might be a good time to add it.
msg415173 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2022-03-14 17:59
I'd like to, the main challenge with that is it'd invalidate the code signature on the file, which will make it basically unusable (at the very least, you'll get warnings). A simple rename does not.

But yeah, it can probably go in. Hopefully my restructure will make it easier to follow where certain things get checked.
msg415178 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2022-03-14 19:35
"Practically nothing can be reused - there's no registry, no shebang handling, and our process launching on Windows is already very complex (and has to remain that way for compatibility)."

I do process the shebang to restrict searching, or did you mean something else?

And registry support [is planned](https://github.com/brettcannon/python-launcher/issues/15).
msg415181 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2022-03-14 20:05
> I do process the shebang to restrict searching, or did you mean something else?

That's what I meant. Guess I missed seeing it when scanning the code (probably I should've read the docs :D )

> And registry support [is planned](https://github.com/brettcannon/python-launcher/issues/15).

It's attached to a milestone with no due date and 0% completion ;) Being aware that you'll need to do it isn't the same as planning to do it.
msg415844 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2022-03-23 00:41
Posted my WIP as a draft PR. I'm still adding docs, tests and ironing out minor issues, but the core functionality is there (as well as some added bonuses). Feel free to review, and importantly to mark anywhere you'd like more explanatory comments.

Currently the main known issue is that the "-3-32" (and now-deprecated "-3-64") arguments are not supported. But they will be! There are also likely to be a range of shebang templates that need better handling, and I'll go through the open issues to see what ought to be fixed there compared to today's version.
msg416009 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2022-03-25 16:54
I think this PR is "ready enough" to get in for broader testing, but in case anyone wants to try it first, I've attached a build from my own machine.

You may need Programs & Features to remove any existing "Python Launcher" before installing this MSI, and you will need to do that to remove this later on, but it should otherwise behave identically to a per-user installed launcher.
msg416228 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2022-03-28 23:21
New changeset bad86a621af61f383b9f06fe4a08f66245df99e2 by Steve Dower in branch 'main':
bpo-46566: Add new py.exe launcher implementation (GH-32062)
https://github.com/python/cpython/commit/bad86a621af61f383b9f06fe4a08f66245df99e2
msg416229 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2022-03-28 23:22
It's in! Any new issues probably won't be found until the next release, so I'll close this and we can open new bugs.
msg416399 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2022-03-30 21:18
New changeset f3d5715492195fd2532fc1a5d73be07923cdf2e1 by Steve Dower in branch 'main':
bpo-46566: Make test_launcher more robust to a variety of installs (GH-32204)
https://github.com/python/cpython/commit/f3d5715492195fd2532fc1a5d73be07923cdf2e1
History
Date User Action Args
2022-04-11 14:59:55adminsetgithub: 90724
2022-03-30 21:18:48steve.dowersetmessages: + msg416399
2022-03-30 19:34:31steve.dowersetpull_requests: + pull_request30279
2022-03-28 23:22:12steve.dowersetstatus: open -> closed
resolution: fixed
messages: + msg416229

stage: patch review -> resolved
2022-03-28 23:21:25steve.dowersetmessages: + msg416228
2022-03-25 16:54:01steve.dowersetfiles: + launcher.msi

messages: + msg416009
2022-03-23 00:41:25steve.dowersetmessages: + msg415844
2022-03-23 00:37:13steve.dowersetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request30152
2022-03-14 20:05:43steve.dowersetmessages: + msg415181
2022-03-14 19:35:55brett.cannonsetmessages: + msg415178
2022-03-14 17:59:21steve.dowersetmessages: + msg415173
2022-03-14 17:13:20paul.mooresetmessages: + msg415168
2022-03-14 17:02:40steve.dowersetmessages: + msg415165
2022-03-11 21:05:25zach.waresetnosy: + brett.cannon
messages: + msg414936
2022-03-11 18:18:02steve.dowersetmessages: + msg414929
2022-03-11 18:17:44steve.dowersetmessages: + msg414928
2022-03-01 22:10:12steve.dowersetassignee: steve.dower
messages: + msg414299
2022-02-14 21:14:00coniosetnosy: + conio
2022-02-03 22:36:04TommyVCTsetnosy: + TommyVCT
messages: + msg412481
2022-01-28 16:52:59steve.dowercreate