Prefer default install for shared aliases - #415
Merged
Conversation
get_installs() keeps precedence order and only flags an overridden default (e.g. via PYTHON_MANAGER_DEFAULT), so update_all_shortcuts() generated entrypoint aliases such as pip from the first install while python/pythonw came from the default. Move the default install front before alias creation so first-match-wins picks it. Ordering is kept local to preserve py list output.
Punisheroot
marked this pull request as ready for review
September 10, 2026 17:23
Member
|
Thanks! |
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.
Summary
update_all_shortcuts()now moves the flagged default install to the front before generating global aliases, so shared entrypoints (e.g.pip) resolve to the same runtime aspython/pythonw.Context
BaseCommand.get_installs()keeps precedence order and only sets thedefaultflag for an overridden default (e.g. viaPYTHON_MANAGER_DEFAULT). Sincecreate_aliases()is first-match-wins, entrypoint aliases such aspip.exewere claimed by the first install in precedence order, whilepython/pythonw(yielded only for the default) pointed elsewhere.Closes #413
Changes
src/manage/install_command.py: inupdate_all_shortcuts(), find the default install and move it front (early-break loop,O(1)when already first). Kept local to this function sopy listordering is unchanged, per maintainer direction.tests/test_install_command.py: addedtest_update_all_shortcuts_default_firstcovering a duplicated alias shared between a first non-default and a second default install.Validation
pytest tests/test_install_command.py -q: PASS (25 passed)pytest tests/test_install_command.py tests/test_alias.py tests/test_installs.py tests/test_commands.py tests/test_list.py tests/test_uninstall_command.py tests/test_scriptutils.py: PASS (182 passed)pytest -q(full suite): PASS (458 passed)pipfrom non-default, post-fixpipfrom defaultassert 'new' == 'default') and passes with itgit diff --check: PASSCompatibility and risk
get_installs()ordering,py list, shebang lookup, orpython/pythonwhandling.update_all_shortcuts(); per-install Start/PEP 514 shortcuts are order-insensitive.