astral-sh / uv

An extremely fast Python package and project manager, written in Rust.
https://docs.astral.sh/uv
Apache License 2.0
21.42k stars 627 forks source link

Build and publish from CI complete example #7727

Open davidlrobinson opened 3 days ago

davidlrobinson commented 3 days ago

First off, thank you for your work on uv. I read in #7475 that one of the intended uses of uv build is the following:

  1. Publishing a pure Python package from CI
    • Call uv build
    • Clear the venv, install the wheel, run a smoke test
    • Clear the venv, install the source distribution, run a smoke test
    • Call uv publish

The docs mention that a built package can be tested with uv run --with <PACKAGE> --no-project -- python -c "import <PACKAGE>". Is there a complete example demonstrating this in practice from CI?

vtnate commented 2 days ago

In addition, can you share an example workflow file for using this with GitHub Actions, or at least a hint? If I am already using the recommended workflow (without the signing steps) for trusted publishing from GHA, do I just replace the build step internals with uv build? I don't think using uv publish is appropriate in that case, correct?