Skip to content

Error/warning when group specified in poetry install --with does not exist or group names are modified in the lock file #10580

@martinezpl

Description

@martinezpl

Issue Kind

Change in current behaviour

Description

When upgrading poetry to 2.2.0 and beyond, names of dependency groups are now silently normalized: #10387 which can act as a breaking change.

Updating a lock file after the upgrade breaks any automation that depends on groups with names subject to normalization.

Personal example. I bumped a dependency in pyproject.toml and updated the lock file. Because I happened to have the latest poetry, while the lock in the repo was generated with 2.1.4, the normalization changed the names of the groups in the lock file. This was overlooked in the review process, as the changes in the lock file tend to be. As a result, after CI has "successfully" installed the dependencies and deployed the code, some dependencies were missing. It wasn't exactly obvious why at the time.

I think it would be a good idea to either:

  • output a warning during poetry lock when a dependency name is normalized
  • return an error when using --with option when specified group name does not exist in the lock file

Impact

Introduces guardrails to avoid breaking behaviour. Communicates clearly the modifications applied.

Workarounds

  1. Make sure the names of the dependency groups in the lock file are the same as the ones in the toml.
  2. Rename the dependency groups in the toml

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureFeature requests/implementationsstatus/triageThis issue needs to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions