PyPI
Publish
uv supports building Python packages into source and binary distributions via uv build and uploading them to a registry with uv publish.
Preparing your project
Before attempting to publish your project, you’ll want to make sure it’s ready to be packaged for distribution.
Configure a build system for your project.
This is done by adding a [build-system] table to your pyproject.toml file.
For example:
[]
= ["setuptools", "wheel"]
= "setuptools.build_meta"If your project does not include a [build-system] definition in the pyproject.toml, uv will not build it during uv sync operations in the project, but will fall back to the legacy setuptools build system during uv build.
Read more about build systems in the project configuration documentation.
Building your package
Build your package with uv build:
By default, uv build will build the project in the current directory, and place the built artifacts in a dist/ subdirectory.
Alternatively, uv build <SRC> will build the package in the specified directory, while uv build --package <PACKAGE> will build the specified package within the current workspace.
By default,
uv buildrespectstool.uv.sourceswhen resolving build dependencies from thebuild-system.requiressection of thepyproject.toml. When publishing a package, we recommend runninguv build --no-sourcesto ensure that the package builds correctly whentool.uv.sourcesis disabled, as is the case when using other build tools, likepypa/build.
Updating your version
The uv version command provides conveniences for updating the version of your package before you publish it.
To get the version of your package, run uv version:
To update to an exact version, provide it as a positional argument:
Estás leyendo una vista previa.
Inicia sesión para leer el artículo completo. Cualquier cuenta abre 4 artículos gratuitos al mes; el alumnado y el profesorado leen las páginas de su curso sin límite.
Iniciar sesión