Verify that the lock file is up to date
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
- I have searched the issues of this repo and believe that this is not a duplicate.
Issue
When I run poetry export
or poetry install
, I receive a warning message that says 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.
if I have manually updated the pyproject.toml
file.
Although I understand one should not edit dependencies in pyproject.toml and instead use poetry add
, I have no control over what the other engineers at my company do and want to prevent this from happening in an automated test.
I see no way of verifying the lock file is up to date with CLI, and it does not appear that poetry install
or poetry export
return non-zero exit codes when this warning is displayed. I’d really like to avoid the brittle solution of parsing stdout for a warning message that may change.
I’d like to propose either:
- A
poetry lock --check
flag that will check if the lock file is up to date and return a non-zero exit code if it isn’t. - Adding this check to
poetry check
. I’m just not certain if this fits in the scope ofpoetry check
. - Updating the docs (the FAQ) if there is a standard solution to doing this. If parsing stdout is an acceptable solution to the community, I think putting it in the docs will at least make it a less brittle solution for us
- I think I read that poetry will have an extension system somewhere (similar to pytest). If this is the case, I could also write this as an extension
I’m happy to implement any solution the maintainers see fit
Issue Analytics
- State:
- Created 4 years ago
- Reactions:39
- Comments:13 (4 by maintainers)
Top GitHub Comments
@jacobperron Might make sense to keep it open until 1.2.0 is released, since the feature is not yet available to end-users. (I came here because I was looking for this feature myself. 🙂)
I wonder if it would be reasonable to have a flag to pass to
poetry install
that would exit with a failure if the lock file is out of sync.When building a container or using CI, I’d expect that would be the usual intent, so it would be nice if there was a succinct way to do it. If not, then
poetry check && poetry install …
isn’t terribly onerous.