`poetry lock --no-update` still updates dependencies
See original GitHub issue- I am on the latest Poetry version.
- I have searched the issues of this repo and believe that this is not a duplicate.
- If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option).
- OS version and name:
- Poetry version:
- Link of a Gist with the contents of your pyproject.toml file: https://gist.github.com/tobi-lipede-oodle/2954049e777c9b0178209a7fc3a75858
Issue
To recreate, you can run:
pip install requests==2.25.1
poetry lock --no-update
# Updating dependencies
# Resolving dependencies... (39.6s)
I would expect that after running the commands above, I should just see Resolving dependencies...
and my lockfile would just have requests 2.25.1. However, what I actually see is that requests gets updated to 2.26.0.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:8
- Comments:13 (4 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 >Commands | Documentation | Poetry - Python dependency ...
By default, this will lock all dependencies to the latest available compatible versions. To only refresh the lock file, use the --no-update option....
Read more >How To Install Poetry to Manage Python Dependencies on ...
Poetry is a dependency manager for Python that is also capable of building and packaging your ... Run `poetry lock [--no-update]` to fix...
Read more >Dependency Management With Python Poetry
The rp_poetry/ subfolder itself isn't very spectacular yet. ... poetry lock --no-update Resolving dependencies... (0.1s).
Read more >Maintaining the Codebase - Ibis Project
Python library dependencies, WhiteSource Renovate ... Occasionally you may need to lock poetry dependencies, ... poetry lock --no-update ...
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 Free
Top 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
I, too, have a use case where I have a
pip
installed virtual environment whose dependencies I don’t want updated when I run apoetry lock --no-update
. It’s also misleading to me that poetry would update the dependencies for my lock file when I pass a--no-update
flag.It would be really useful to have a flag for the
lock
,install
, oradd
commands to look in a currently existing virtual environment and pull out those packages as pinned dependencies rather than updating the dependencies. Something like--use-venv path/to/venv
or the already existing--no-update
.Current behavior
I have a constraints specification in my
requirements.txt
, so I have to do apoetry run pip install -r requirements.txt
to check and install against the constraints (Behavior poetry does not support, as far as I know. And I’m not going to add and pin each package individually, that’s what poetry is for.). Then, when I perform apoetry install
orpoetry add package
to add a package not specified in therequirements.txt
poetry updates my existing virtual environment dependencies while adding the package. So, poetry must know about the package installed with pip.Expected behavior
I have an existing virtual environment that did not start from a
poetry install
I pass the command:And I keep my existing virtual environment while letting poetry figure out the dependency resolution within those constraints. That is, poetry treats existing packages as pinned to a specific version, so
influxdb = 5.3.1
, rather than updating them.I believe this is a false positive as Poetry does not know about the package installed by pip.
pip install requests==2.25.1
will installrequests
in whatever Python environment is currently active. It will not interact with Poetry.poetry lock --no-update
will actually create the lockfile because you only specified thepyproject.toml
.2.y.z
version ofrequests
.Replace
pip install …
withpoetry add requests=2.25.1
and Poetry will pin the dependency to the version2.25.1
. (Note that subsequentpoetry update
will not update that package unless you relax the constraint. You can do so manually withpoetry add requests@latest
, or by editingpyproject.toml
to add the caret character in front of the version:requests = "^2.25.1"
.)