poetry icon indicating copy to clipboard operation
poetry copied to clipboard

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

Open martinezpl opened this issue 5 months ago • 0 comments

Issue Kind

Change in current behaviour

Description

When upgrading poetry to 2.2.0 and beyond, names of dependency groups are now silently normalized: https://github.com/python-poetry/poetry/pull/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

martinezpl avatar Oct 13 '25 11:10 martinezpl