uv icon indicating copy to clipboard operation
uv copied to clipboard

Add `uv check` command to validate `pyproject.toml` `uv` configuration

Open johnthagen opened this issue 1 year ago • 5 comments

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 --lock verify that a poetry.lock exists (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?

johnthagen avatar Dec 05 '24 03:12 johnthagen

Duplicate of https://github.com/astral-sh/uv/issues/7639?

9128305 avatar Dec 05 '24 08:12 9128305

Duplicate of #7639?

Certainly at least related and along a similar vein.

johnthagen avatar Dec 05 '24 15:12 johnthagen

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.

zanieb avatar Dec 05 '24 15:12 zanieb

As reference, I think Cargo calls this command verify-project.

MichaReiser avatar Dec 05 '24 15:12 MichaReiser

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.

charliermarsh avatar Dec 06 '24 00:12 charliermarsh

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.

rpdelaney avatar Apr 15 '25 23:04 rpdelaney

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.

gboeing avatar Jun 18 '25 00:06 gboeing

+1, this is one of few things that Poetry supports and uv does not that I've run into

j-adamczyk avatar Jun 29 '25 11:06 j-adamczyk