diff --git a/src/poetry/console/commands/group_command.py b/src/poetry/console/commands/group_command.py index e84a5f72323..fb8e3c7cf1c 100644 --- a/src/poetry/console/commands/group_command.py +++ b/src/poetry/console/commands/group_command.py @@ -60,6 +60,15 @@ def non_optional_groups(self) -> set[str]: if not group.is_optional() } + @property + def default_groups(self) -> set[str]: + """ + The groups that are considered by the command by default. + + Can be overridden to adapt behavior. + """ + return self.non_optional_groups + @property def activated_groups(self) -> set[str]: groups = {} @@ -93,9 +102,9 @@ def activated_groups(self) -> set[str]: "" ) - return groups["only"] or self.non_optional_groups.union( - groups["with"] - ).difference(groups["without"]) + return groups["only"] or self.default_groups.union(groups["with"]).difference( + groups["without"] + ) def project_with_activated_groups_only(self) -> ProjectPackage: return self.poetry.package.with_dependency_groups(