Add `uv check` command to validate `pyproject.toml` `uv` configuration
Would it make sense to add some equivalent to poetry check into uv?
- https://python-poetry.org/docs/cli#check
The idea is that you can add this to CI and if a PR makes any change to the uv configuration that is invalid, this will fail the CI.
Looking at Poetry's implementation:
- https://github.com/python-poetry/poetry/blob/bd4adcb749b9a9479039830117d2b4be0457ad3d/src/poetry/console/commands/check.py#L126
It currently validates:
- The Poetry configuration in
pyproject.toml - Trove classifiers are valid
- That READMEs that should exist do
- Dependency sources
- Lock file freshness (i.e.,
uv lock --locked) - Optionally with
poetry check --lockverify that apoetry.lockexists (e.g., that someone didn't accidentally delete it)
In general, most of these checks are useful to enforce in CI for many projects. Would it make sense for uv to have an equivalent of some kind of check command?
Duplicate of https://github.com/astral-sh/uv/issues/7639?
Duplicate of #7639?
Certainly at least related and along a similar vein.
We have some other thoughts for a uv check command, but I think this is a reasonable ask.
I think we can consider this distinct from #7639 which seemed to focus on checking if the lockfile is up-to-date.
As reference, I think Cargo calls this command verify-project.
Another interesting thing that a uv check could do: validate the recorded wheel hashes against the exact unzipped files on disk. Similar to https://manpages.ubuntu.com/manpages/trusty/man1/debsums.1.html.
poetry check validating the pyproject.toml file is useful as a pre-commit hook to catch errors early. It would be appreciated if uv could provide this functionality as well.
Agreed. I'm currently running uvx --from=validate-pyproject[all] validate-pyproject ./pyproject.toml to validate it, and it'd be great for streamlining if uv could provide this.
+1, this is one of few things that Poetry supports and uv does not that I've run into