Answer a question

After adding a [tool.poetry.extras] section to pyproject.toml, Poetry displays the following warning, for example on install:

Warning: The lock file is not up to date with the latest changes in pyproject.toml. You may be getting outdated dependencies. Run update to update them.

That's fine, but if I run poetry update it upgrades my dependencies, which is not what I want at this time. If I run poetry lock instead, it still upgrades dependencies.

Sorry for not providing a reproducible example, it's quite tricky to generate a poetry.lock file with outdated dependencies. My existing one is too large for posting here.

Update: Opened sdispater/poetry#1614 for this issue

Answers

There is a specific option for the lock command:

poetry lock --no-update

This makes it possible to remove a dependency from pyproject.toml and update the lock file without upgrading dependencies.

Note that this is only available since 1.1.2 (or earlier?) and that the behavior will be changed in v2.0.

Logo

Python社区为您提供最前沿的新闻资讯和知识内容

更多推荐