option to fail if `poetry.lock` doesn't match `pyproject.toml`
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.
steps
1: add dependencies and run poetry update
2: change dependencies and run poetry install
expected
The command fails as you will install dependencies that are not reflecting the project configuration
actual
All you get is a warning
Feature Request
currently when you run poetry install
with an outdated lock file, you get this warning:
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.
it would be nice if there was an option to make this an error instead of a warning. in my case i want the CI to fail if poetry.lock
is outdated.
the warning can be easily missed when running in CI
Issue Analytics
- State:
- Created 2 years ago
- Reactions:17
- Comments:10 (8 by maintainers)
Top Results From Across the Web
Warning: The lock file is not up to date with the latest changes ...
I am getting the following error: Warning: The lock file is not up to date with the latest changes in pyproject. toml. You...
Read more >Commands | master | Documentation | Poetry - Python ...
The install command reads the pyproject.toml file from the current project, resolves the ... and ensure it matches the lock file – use...
Read more >Dependency Management With Python Poetry
When you run the poetry add command, Poetry automatically updates pyproject.toml and pins the resolved versions in the poetry.lock file. However ...
Read more >A Poetic Apology. Or Why Should You Use Poetry to Manage…
lock file already exists, if you now run poetry install then Poetry will resolve and install dependencies using the versions specified in such...
Read more >Dependency scanning fails for setuptools project that ... - GitLab
pyproject.toml is no longer specific to Poetry, so it should be removed from the definition of PackageManagerPoetry . // PackageManagerPoetry ...
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 disagree. If I change/add a dependency in
pyproject.toml
and forget to runpoetry update
, I’ll experience unexpected behaviour where the cause won’t be immediately obvious. Other similar tools such as npm and gradle fail when the lock file is outdatedI’m not asking for an option to remove the lock file’s assertions, only an option to fail if
pyproject.toml
contradicts those assertionsAh, I see. My example was only addressing the case where the version of an existing dependency is changed manually. I had not considered the case where a new dependency is added manually and not via
poetry add
. But I agree with you, poetry should be able to identify when a dependency specified in thepyproject.toml
file doesn’t exist in a lock file when runningpoetry install
.I am interested in the decision to add dependencies manually vs using
poetry add
. It’s definitely a valid workflow but could you elaborate on why you prefer that workflow?@KotlinIsland agreed 😆