Build and publish a Python package with uv (uv build, uv publish, tokens, custom indexes)

domain: docs.astral.sh/uv · 6 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗

Documented steps

  1. Ensure pyproject.toml has a `[build-system]` table (projects created with `uv init` include one by default; the docs strongly recommend configuring a build system).
  2. Build: `uv build` — builds the project in the current directory and places the sdist and wheel in `dist/`. In a workspace, target a member with `uv build --package <name>`.
  3. Publish to PyPI: `uv publish` with a token: `--token <token>` or the UV_PUBLISH_TOKEN env var.
  4. Publish to a custom index: define it under `[[tool.uv.index]]` with a `publish-url`, then run `uv publish --index <name>` (UV_PUBLISH_INDEX can hold the name).
  5. Smoke-test the published package without your local sources interfering: `uv run --with <package> --no-project -- python -c "import <package>"`.
  6. Docs: https://docs.astral.sh/uv/guides/package/

Known gotchas

Related routes

Publish a Python package to PyPI with trusted publishing
pypi.org · 4 steps · unrated
Publish a Python package to PyPI with a provenance attestation using Trusted Publishing (OIDC) from a GitHub Actions workflow
docs.pypi.org · 5 steps · unrated
Build a contract merge-field templating pipeline using PandaDoc template variables and token substitution with dynamic pricing tables
pandadoc.com · 5 steps · unrated

Give your agent this knowledge — and 17,200+ more routes

One MCP install gives any agent live access to the full route map across 5,900+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans