Skip to content

Feature: short form for --extra option #17511

@osma

Description

@osma

Summary

Our project (Annif) has just switched from Poetry to uv. It has quite a few extras (optional dependencies) so the --extra option is needed a lot. We also had to write a little for loop in our Dockerfile just to construct the --extra options for uv sync, where previously (with Poetry) a simple variable substitution did the trick.

Unlike Poetry, uv currently only supports a long --extra option that may be repeated. To improve the developer experience, I would like to propose shorter forms of that option, matching what Poetry supports.

In Poetry, I can run poetry install -E foo,bar to install the package with the extras foo and bar.

uv sync (current version 0.9.26 on Linux) doesn't support the short form -E:

$ uv sync -E foo
error: unexpected argument '-E' found

Usage: uv sync [OPTIONS]

For more information, try '--help'.

uv sync --extra also doesn't support a comma-separated list of extras:

$ uv sync --extra foo,bar
error: invalid value 'foo,bar' for '--extra <EXTRA>': Extra names must start and end with a letter or digit and may only contain -, _, ., and alphanumeric characters

For more information, try '--help'.

Since both of these currently trigger errors, I think it should be unproblematic to add support for the shorter forms, i.e.

  1. A short option -E that works the same way as --extra
  2. Support for a comma-separated value for --extra / -E as an alternative for repeating the option

PS. I tried looking for existing issues with similar proposals but couldn't find any. I hope I didn't miss something.

Example

I would like this command to work (when extras foo and bar are defined):

uv sync -E foo,bar

Metadata

Metadata

Assignees

No one assigned

    Labels

    compatibilityCompatibility with a specification or another toolenhancementNew feature or improvement to existing functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions