Update the lock file without upgrading dependencies
See original GitHub issue- I have searched the issues of this repo and believe that this is not a duplicate.
- I have searched the documentation and believe that my question is not covered.
Feature Request
Please provide a way to update the lock file without upgrading dependencies.
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. Am I missing something?
Here are the relevant files and the commit:
Sorry for not providing a smaller reproducible example, it’s quite tricky to generate a poetry.lock file with outdated dependencies.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:51
- Comments:13 (5 by maintainers)
Top Results From Across the Web
python - How to update Poetry's lock file without upgrading ...
There is a specific option for the lock command: poetry lock --no-update. This makes it possible to remove a dependency from pyproject.toml ...
Read more >Yarn.lock: How to Update it - DEV Community
lock file is important: it lists the packages that your application will end up using. Sure, your dependencies are listed in your package.json...
Read more >Basic usage | Documentation | Poetry - Python dependency ...
Updating dependencies to their latest versions As mentioned above, the poetry.lock file prevents you from automatically getting the latest versions of your ......
Read more >Yarn lock: how it works and what you risk without maintaining ...
Updating the lockfile is a bit easier to explain. An update can happen in 3 situations: When the dependency is added, removed, or...
Read more >How Yarn Lock Files Work and Upgrading Dependencies
lock file as well as how to upgrade dependencies when a lock file is present. Many people see it as a nuisance to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This functionality is much needed imo. A single package addition/update shouldn’t trigger a dependency graph resolution for all the dependencies of the project.
I’d rather
poetry lock
/poetry update
be more conservative by default. If we want to keep the current functionality as well, even though I consider auto-updates to be a bad practice, there could be an additional flag like--refresh
to force irrelevant dependencies to update as well if there’s a newer, compatible version.In https://github.com/python-poetry/poetry/issues/496#issuecomment-455913689 there is also outlined an alternate workaround:
poetry add pathlib2 ; poetry remove pathlib2
, wherepathlib2
is any library you don’t already depend on and that has no dependents… likepathlib2
. (Strictly speaking, it can be any library with a dependency tree disjoint from your project, but why drag in more stuff than you need?)I use this workaround all the time. Updating metadata in the lockfiles, resolving merge conflicts, etc. All of these operations get me into a state where I want something like
poetry lock --preserve
(which doesn’t exist, but has a nice ring to it): re-locking, but keeping as many versions as possible where they currently are.