Skip to content

Clarify "poetry lock" suggestion provided for poetry self subcommands #10536

@shellydavid

Description

@shellydavid

Issue Kind

Change in current behaviour

Description

When a lock file is outdated, the provided suggestion is to run poetry lock. The same suggestion applies for poetry self subcommands - ex poetry self sync:

"pyproject.toml changed significantly since poetry.lock was last generated. Run poetry lock to fix the lock file"

For poetry self subcommands however, the fix would be poetry self lock:

  • poetry lock references pyproject.toml from the current project/directory.
  • poetry self lock references pyproject.toml from the Poetry installation directory:
    • macOS - ~/Library/Application\ Support/pypoetry
    • Linux - ~/.config/pypoetry
    • Windows - %APPDATA%\pypoetry

Assuming the user is likely to be in a different directory, they might see "Poetry could not find a pyproject.toml file" or a lock file from an unrelated project gets updated. poetry lock updates the expected lock file in this case only if you're in the Poetry installation directory - it does also create a virtualenv and I'm not sure if this may present other unintended consequences.


Proposal

  • An outdated lock file from a regular command continues to suggest poetry lock
  • An outdated lock file from a poetry self subcommand suggests poetry self lock

I did not find an existing issue on this, apologies in advance if I missed a duplicate issue!

Impact

Could reduce potential confusion/errors for the user

Workarounds

  • Running poetry self lock
  • Running poetry lock as suggested, but specifically in the Poetry installation configuration directory
    • macOS - ~/Library/Application\ Support/pypoetry
    • Linux - ~/.config/pypoetry
    • Windows - %APPDATA%\pypoetry

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions