From 9dca875b0778a5996e78d78949aa3d96db5adf5b Mon Sep 17 00:00:00 2001 From: Bernardo Meurer Date: Sat, 16 Apr 2022 13:26:28 -0700 Subject: [PATCH] feat(console/commands): add --all-groups --- docs/cli.md | 7 +++++++ src/poetry/console/commands/group_command.py | 8 ++++++++ tests/console/commands/test_install.py | 1 + 3 files changed, 16 insertions(+) diff --git a/docs/cli.md b/docs/cli.md index 8d2b4901000..315cb7d0390 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -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 %}} diff --git a/src/poetry/console/commands/group_command.py b/src/poetry/console/commands/group_command.py index 23bf04e3a95..c7f08b07a5a 100644 --- a/src/poetry/console/commands/group_command.py +++ b/src/poetry/console/commands/group_command.py @@ -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, @@ -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"}: diff --git a/tests/console/commands/test_install.py b/tests/console/commands/test_install.py index 615d8236353..7f16063c1f6 100644 --- a/tests/console/commands/test_install.py +++ b/tests/console/commands/test_install.py @@ -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"}),