Documentation Index
Fetch the complete documentation index at: https://mintlify.com/astral-sh/uv/llms.txt
Use this file to discover all available pages before exploring further.
Overview
uv supports building Python packages into source and binary distributions and uploading them to package registries like PyPI.Preparing your project
Before publishing, ensure your project is ready for distribution.Configure a build system
If yourpyproject.toml lacks a [build-system] definition, uv won’t build it during uv sync, but will fall back to legacy setuptools during uv build.
Add a build system to your pyproject.toml:
Building your package
Build distributions
- Source distribution (
.tar.gz) - Wheel (
.whl)
dist/:Updating your version
Theuv version command helps manage your package version before publishing.
View current version
Set exact version
Preview changes
Bump version semantically
Use--bump with version components:
Pre-release versions
Set specific component values
By default,
uv version performs lock and sync. Use --frozen to prevent both, or --no-sync to only prevent syncing.Publishing your package
Get credentials
Set PyPI credentials using environment variables or command options:
PyPI no longer supports username/password authentication. Generate a token instead, which is equivalent to
--username __token__ with the token as password.Publish to PyPI
Publishing to custom indexes
Configure custom indexes inpyproject.toml:
When using
uv publish --index <name>, pyproject.toml must be present (e.g., include a checkout step in CI).Handling failed uploads
uv publish retries failed uploads, but if some files upload and others fail:
With PyPI
With PyPI
Retry the same command — existing identical files are ignored:
With other registries
With other registries
Use uv skips uploading files identical to those in the registry and handles parallel upload races.
--check-url with the index URL:Uploading attestations
uv supports uploading attestations to registries like PyPI.uv publish doesn’t generate attestations — create them separately before publishing.Testing your package
After publishing, test that it installs correctly:--no-project flag avoids using your local project directory.
Complete workflow examples
First-time package release
Releasing a new version
Publishing from GitHub Actions
Set up PyPI trusted publisher
Configure at https://pypi.org/manage/account/publishing/
Best practices
Always test before publishing
Always test before publishing
Test on TestPyPI first:This catches issues without affecting your PyPI release.
Use semantic versioning
Use semantic versioning
Verify build contents
Verify build contents
Check what’s included in your distributions:Use
.gitignore and MANIFEST.in to control contents.Automate with CI/CD
Automate with CI/CD
Use GitHub Actions or similar for:
- Automated testing
- Building on multiple platforms
- Publishing on release
Document your releases
Document your releases
Maintain a
CHANGELOG.md and create GitHub releases with notes.Next steps
PyPA build guide
Official Python packaging guides
Integration guides
Integrate uv with other tools
GitHub integration
CI/CD with GitHub Actions
Build systems
Configure build systems