Skip to content

Adding -E shorthand for --extra flag#18076

Closed
suryawanshishantanu6 wants to merge 2 commits intoastral-sh:mainfrom
suryawanshishantanu6:shantanu-uv-add-shorthand
Closed

Adding -E shorthand for --extra flag#18076
suryawanshishantanu6 wants to merge 2 commits intoastral-sh:mainfrom
suryawanshishantanu6:shantanu-uv-add-shorthand

Conversation

@suryawanshishantanu6
Copy link

Summary

This PR adds the -E shorthand flag for --extra across all relevant uv commands (uv pip compile, uv pip sync, uv pip install, uv run, uv sync, uv add, uv export). This improves CLI ergonomics by providing a shorter way to specify extras and saves time.

Test Plan

  • Added dedicated integration tests for the -E shorthand for all 7 commands that support the --extra flag.
  • Verified that all new and existing shorhand tests pass:
    • pip_compile_extra_shorthand
    • pip_sync_extra_shorthand
    • pip_install_extra_shorthand
    • run_extra_shorthand
    • sync_extra_shorthand
    • add_extra_shorthand
    • export_extra_shorthand
  • Manually verified help output shows -E, --extra for all commands.
  • Confirmed no other commands require updates (uv tree uses dependency groups instead; uv tool run/install don't support extras).

Resolve conflict in crates/uv/tests/it/export.rs by keeping both:
- export_extra_shorthand (testing -E shorthand)
- pylock_toml_filter_by_requires_python (testing pylock.toml format)
@zanieb zanieb marked this pull request as draft February 18, 2026 23:56
@zanieb
Copy link
Member

zanieb commented Feb 18, 2026

I don't think we have consensus that we want to do this.

@zanieb
Copy link
Member

zanieb commented Feb 18, 2026

(which is the hard part of a change like this)

@suryawanshishantanu6
Copy link
Author

Thanks for the quick review @zanieb! I completely understand the need to be conservative with the short-flag namespace.

My main motivation here is that poetry already uses -E for --extras. Since many users (myself included) are migrating workflows from Poetry to uv, having parity with that shorthand makes the transition smoother and improves muscle memory.

Given that --extra is a high-frequency flag for local development (similar to how we use -r for requirements), the ergonomic benefit of -E feels substantial.

Is there a concern that -E might be needed for a different feature in the future, or is the preference simply to minimize aliases generally? Happy to open a Discussion thread if that’s a better place to weigh the pros/cons.

@zanieb
Copy link
Member

zanieb commented Feb 19, 2026

See also #17525 (comment)

Is there a concern that -E might be needed for a different feature in the future, or is the preference simply to minimize aliases generally?

Both. Once we use a flag, we're stuck with it forever, so we've been conservative.

#17511 seems like the best place to discuss

@suryawanshishantanu6
Copy link
Author

Thanks for the context, @zanieb. I understand the need to be conservative with the short-flag namespace.

I'll close this PR for now to keep the queue clean and move my feedback to #17511. If the consensus on that issue changes in favor of -E, I'm happy to reopen or resubmit this.

@zanieb
Copy link
Member

zanieb commented Feb 19, 2026

Thanks!

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.

2 participants