Repository navigation
Windows: launch a Python outside WindowsApps before an alias (fixes #144) - #157
Closed
Vu Linh Truong (vulinh1704) wants to merge 1 commit into
Closed
Vu Linh Truong (vulinh1704) wants to merge 1 commit into
Vu Linh Truong (vulinh1704) wants to merge 1 commit into
Conversation
…ft#144) The launchers took the first `python3` on PATH and, when it was an App Execution Alias under WindowsApps, launched it once with `-c ""` to see that it runs and again for the dispatcher. With the Python Install Manager, every alias launch starts an App Installer update check whose memory AppXSvc never frees (python/pymanager#396), and the hook runs on every tool call. Now python3, python and py come from the first PATH directory outside WindowsApps that has them, and an alias is tried, as before, only when there is no such Python. With the Install Manager's global shortcuts (%LOCALAPPDATA%\Python\bin) on PATH after WindowsApps, a hook event starts one Python and no alias. A python.org Python after the Store's stub aliases is found as well; the stub used to hide it, leaving only `py`, or `{}` without one. `TE_PYTHON` is used as it is, and Linux and macOS are unchanged.
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #144.
On Windows the launchers took the first
python3on PATH. When that was an App Execution Alias under WindowsApps, they launched it once to probe it (-c "") and once more for the dispatcher. With the Python Install Manager, each alias launch starts an App Installer update check that AppXSvc never frees (python/pymanager#396), and the hook runs on every tool call.te-hookandtenow takepython3,pythonandpyfrom the first PATH directory outside WindowsApps that has them. The aliases are only tried, the same way as before, when there is no such Python.TE_PYTHONis still used as given. Linux and macOS go through the sameTE_PYTHON,python3,pythonorder as before.This also fixes a related case: the Microsoft Store's stub aliases, which run nothing, used to hide a python.org Python later on PATH. The hook then fell back to
py, or answered{}without it.Python launches per hook event, counted with logging shims on PATH under Git Bash:
%LOCALAPPDATA%\Python\bin(the setup in #144){}Tests: three new tests in
tests/test_plugin_package.pysetOS=Windows_NTand put logging stand-ins on PATH, so they also run on Linux and macOS. Two of them fail on the old launchers. The third pins that an alias is still the last resort. The full suite passes on Windows 11 (Git Bash, Python 3.12) and on Ubuntu 24.04 (dash as/bin/sh). I could not test with a real Install Manager install. The alias was a stand-in in a...\Microsoft\WindowsAppsdirectory, which is all the launcher looks at.