-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
-
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 (
-vvvoption) 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.
poetry/src/poetry/installation/executor.py
Line 187 in 0e72a55
| 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
poetry/src/poetry/installation/installer.py
Lines 294 to 299 in 0e72a55
| 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.
poetry/src/poetry/console/commands/add.py
Lines 257 to 258 in 0e72a55
| if self.option("lock"): | |
| self.installer.lock() |