Skip to content

chore: default --installer to pip in argparse - #1117

Merged
gaborbernat merged 2 commits into
pypa:mainfrom
henryiii:chore/installer-default
Jul 2, 2026
Merged

gaborbernat merged 2 commits into
pypa:mainfrom
henryiii:chore/installer-default

Conversation

@henryiii

@henryiii henryiii commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

Maybe it was this way because we were thinking to add a smart default that would use either? That never happened, so this seem fine and simpler to check.

🤖 AI text below 🤖

Summary

  • --installer had no default, so args.installer was None at runtime even though it's typed as _env.Installer (Literal['pip', 'uv']) everywhere downstream. It only worked because callers just checked == 'uv'.
  • Set default='pip' on the argparse option (matching the existing help text "defaults to pip") and tighten the _Args stub annotation from _env.Installer | None to _env.Installer.
  • Updated tests/test_main.py assertions/defaults that previously expected installer to be None.

Part of the code review in #1116.

henryiii added 2 commits July 1, 2026 16:20
The `_Args` stub already claimed `installer: _env.Installer | None`
was a `Literal['pip', 'uv']`, but argparse left it unset (`None`)
until `main()` checked `== 'uv'`. Set `default='pip'` explicitly so
the type matches runtime behavior.

Assisted-by: ClaudeCode:claude-sonnet-5
Assisted-by: ClaudeCode:claude-sonnet-5
@henryiii
henryiii marked this pull request as ready for review July 2, 2026 13:55

@gaborbernat gaborbernat left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gaborbernat
gaborbernat merged commit 501d36e into pypa:main Jul 2, 2026
59 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants