Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --all-group option to uv sync #8594

Open
shoucandanghehe opened this issue Oct 26, 2024 · 9 comments · May be fixed by #8892
Open

Add --all-group option to uv sync #8594

shoucandanghehe opened this issue Oct 26, 2024 · 9 comments · May be fixed by #8892
Labels
cli Related to the command line interface help wanted Contribution especially encouraged

Comments

@shoucandanghehe
Copy link

When installing multiple dependency groups you need to specify --group multiple times, which can be annoying if you want to install many dependency groups at the same time

Also --all-group should be able to be used in conjunction with --no-group in case you don't want to actually install all the dependencies.

@zanieb
Copy link
Member

zanieb commented Oct 26, 2024

Sure, we could add --all-groups throughout to match --all-extras

@zanieb zanieb added help wanted Contribution especially encouraged cli Related to the command line interface labels Oct 26, 2024
@frfahim
Copy link

frfahim commented Oct 26, 2024

The --all-group command would be very helpful to install all groups with a single command.
Also it would be great to support multiple groups together within one --group argument like this uv sync --group "lint,docs" instead of uv sync --group lint --group docs

@zanieb
Copy link
Member

zanieb commented Oct 27, 2024

We probably won't support multiple groups in a single option, that doesn't match the design of the rest of our CLI.

@drmikehenry
Copy link

Though it's not completely portable, you can use brace expansion in many Unix shells (Bash, Zsh, Ksh, Fish, etc.) to get the desired behavior because the --group groupname syntax may use an = as in --group=groupname. To show this using the echo command:

echo uv sync --group={lint,docs}

with output:

uv sync --group=lint --group=docs

@bluss
Copy link
Contributor

bluss commented Oct 27, 2024

Groups can also include each other, so you can add a group that includes all other groups, if you want to.

@bluss
Copy link
Contributor

bluss commented Oct 27, 2024

The PEP has the syntax for group inclusion here https://peps.python.org/pep-0735/#dependency-group-include

@amoralesc
Copy link

Just referencing here that I temporally solved this issue by defining default groups:

# pyproject.toml
[tool.uv]
default-groups = ["lint", "docs"]

This makes the uv sync command sync all groups contained there. This obviously has the disadvantage that now I need to specify --no-group or --only-group when I don't want any of those groups.

@amoralesc
Copy link

amoralesc commented Oct 29, 2024

@zanieb In line with the above comment, I also can't find a way to only install the project-level dependencies (those under [project].dependencies), regardless of what the default groups property defines.

For example, Poetry achieves this behavior by using the --only main flag (although badly documented). This seems equivalent to the --only-group flag, with the caveat that the project-level dependencies don't seem to belong to a group.

My workaround for achieving both behaviors (sync with default groups and sync only main) is creating a main group.

Edit: This seems loosely related to #8582

@zanieb
Copy link
Member

zanieb commented Oct 29, 2024

@amoralesc it seems like we might want a --no-default-groups flag, which I was sort of hoping we could avoid (just because we have so many flags)

olzhasar-reef added a commit to backend-developers-ltd/ComputeHorde that referenced this issue Nov 5, 2024
`uv` does not yet support running sync for all groups. We need to specify
each group manually. These scripts are a temporary workaround until the
corresponding feature is implemented in `uv`.

astral-sh/uv#8594
olzhasar-reef added a commit to backend-developers-ltd/ComputeHorde that referenced this issue Nov 5, 2024
`uv` does not yet support running sync for all groups. We need to specify
each group manually. These scripts are a temporary workaround until the
corresponding feature is implemented in `uv`.

astral-sh/uv#8594
olzhasar-reef added a commit to backend-developers-ltd/ComputeHorde that referenced this issue Nov 6, 2024
`uv` does not yet support running sync for all groups. We need to specify
each group manually. These scripts are a temporary workaround until the
corresponding feature is implemented in `uv`.

astral-sh/uv#8594
olzhasar-reef added a commit to backend-developers-ltd/ComputeHorde that referenced this issue Nov 6, 2024
`uv` does not yet support running sync for all groups. We need to specify
each group manually. These scripts are a temporary workaround until the
corresponding feature is implemented in `uv`.

astral-sh/uv#8594
olzhasar-reef added a commit to backend-developers-ltd/ComputeHorde that referenced this issue Nov 7, 2024
`uv` does not yet support running sync for all groups. We need to specify
each group manually. These scripts are a temporary workaround until the
corresponding feature is implemented in `uv`.

astral-sh/uv#8594
@j178 j178 linked a pull request Nov 7, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Related to the command line interface help wanted Contribution especially encouraged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants