Skip to content

poetry update --lock prints operations that don't run. #7588

@hwmq

Description

@hwmq
  • Poetry version: 1.4.0

  • Python version: 3.10.6

  • OS version and name: Ubuntu 22.04

  • pyproject.toml: N/A

  • I am on the latest stable Poetry version, installed using a recommended method.

  • I have searched the issues of this repo and believe that this is not a duplicate.

  • I have consulted the FAQ and blog for any relevant entries or release notes.

  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

poetry update --lock prints operations that don't run. The following gives the gist...

$ poetry update --lock mypackage
Updating dependencies
Resolving dependencies... (0.9s)

Writing lock file
  • Installing a_different_package (0.0.0): Pending...
  • Updating some_other_package (0.0.0 -> 1.0.0): Pending...
# ... and so on ...
$ # and back to my shell.

To be clear, some_other_package is not updated in the lock file.

Essentially, the printed operations correspond to what would happen in the poetry env if --lock were not specified. However since --lock is specified, it doesn't make sense to show this output, because these things do not happen.

We can see this here (tag 1.4.0)

self.installer.execute_operations(not self.option("lock"))

Poetry actually ends up reaching this line, which doesn't end up doing anything because self._execute_operations is False, but does print the output like above.

tasks.append(self._executor.submit(self._execute_operation, operation))

I wonder if when --lock is specified, should we also call self.installer.lock()? That way, the return in this block will execute. Currently it does not because self._lock is False

if self._update:
self._write_lock_file(lockfile_repo)
if self._lock:
# If we are only in lock mode, no need to go any further
return 0

add already does this.

if self.option("lock"):
self.installer.lock()

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/cliRelated to the command linekind/bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions