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

feat(console/commands): add --all-groups #5461

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,13 @@ It's also possible to only install specific dependency groups by using the `only
poetry install --only test,docs
```

You may also enable all available dependency groups with the `--all-groups`
option:

```bash
poetry install --all-groups
```

{{% note %}}
The `--dev-only` option is now deprecated. You should use the `--only dev` notation instead.
{{% /note %}}
Expand Down
8 changes: 8 additions & 0 deletions src/poetry/console/commands/group_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ class GroupCommand(EnvCommand):
@staticmethod
def _group_dependency_options() -> list[Option]:
return [
option(
"all-groups",
None,
"Include all dependency groups.",
),
option(
"without",
None,
Expand Down Expand Up @@ -57,6 +62,9 @@ def non_optional_groups(self) -> set[str]:

@property
def activated_groups(self) -> set[str]:
if self.option("all-groups"):
return self.poetry.package._dependency_groups

groups = {}

for key in {"with", "without", "only"}:
Expand Down
1 change: 1 addition & 0 deletions tests/console/commands/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def tester(
("options", "groups"),
[
("", {"default", "foo", "bar", "baz", "bim"}),
("--all-groups", {"default", "foo", "bar", "baz", "bim", "bam"}),
("--only default", {"default"}),
("--only foo", {"foo"}),
("--only foo,bar", {"foo", "bar"}),
Expand Down