uv-export
Export Python dependencies
TLDR
Export dependencies to a requirements.txt file
Export dependencies to pylock.toml format
Export only production dependencies (exclude dev dependencies)
Export including a specific optional dependency group
Export including all optional dependencies
Export including a specific dependency group
Export without hashes
Export dependencies for a specific package in the workspace
SYNOPSIS
uv export [OPTIONS] [PACKAGE ...]
PARAMETERS
[PACKAGE ...]
Optional: Specifies one or more packages to export. If omitted, all resolved dependencies are exported.
--format
Sets the output format for the requirements file. Accepted values are 'pip' (default) for pip compatibility or 'uv' for uv-specific features like hashes.
--output-file
Specifies the path to the output file. If not provided, the requirements are written to standard output (stdout).
--python
Defines the Python interpreter to use. Can be a path or a version specifier (e.g., '3.10').
--strict
Requires all exported dependencies to have a hash, failing if any are missing.
--index-url
The URL of the primary Python package index to use for resolution.
--extra-index-url
Additional URLs of Python package indexes to search for packages.
--no-index
Ignores all package indexes, relying only on `--find-links`.
--find-links
Location(s) of local Python package archives.
--client-auth
Path to a client certificate and key file (.pem or .p12) for index authentication.
--keyring-provider
Specifies the keyring provider for authentication (e.g., 'auto', 'system', 'disabled').
--no-color
Disables colored output in the console.
--force-color
Forces colored output, even if not automatically detected.
--verbose
Enables verbose logging output.
--quiet
Suppresses all logging output.
--exclude-newer
Prevents considering package versions newer than the specified version.
--refresh
Refreshes specified packages during export, e.g., 'all' or a specific package name.
--refresh-all
Forces a re-resolution and refresh of all packages.
--exclude-platform-specific
Excludes packages that are specific to certain platforms from the export.
--no-hash
Excludes package hashes from the exported requirements file.
--legacy-sha1-hashes
Allows the inclusion of SHA1 hashes in the exported requirements file.
--with-sources
Includes source URLs (e.g., Git URLs) in the exported requirements file.
--no-strip-extras
Retains extras (e.g., '[test]') in package names during export.
--no-strip-markers
Retains environment markers (e.g., '; python_version < "3.9"') in package names.
--no-strip-vcs-urls
Retains Version Control System (VCS) URLs (e.g., 'git+https://...') in package names.
--strict-markers
Ensures that all environment markers are strictly compatible with the target environment.
--dependency-mode
Sets the mode for including dependencies: 'direct', 'direct-plus-primary', or 'transitive' (default).
--resolve-from
Specifies additional files (e.g., 'pyproject.toml', 'requirements.in') to use as a base for resolution.
--annotation-style
Sets the style of annotations: 'full' (default), 'minimal', or 'none'.
--annotation-format
Sets the format for annotations: 'comments' (default) or 'metadata'.
DESCRIPTION
uv-export is a subcommand of the uv tool, a fast Python package installer and resolver. This command's primary function is to transform a project's dependency resolution (typically derived from a uv.lock file or an input requirements.txt) into a requirements.txt file that is fully compatible with pip. It is an essential utility for ensuring interoperability between uv-managed Python environments and those that rely on the traditional pip ecosystem. Users can control the output format, include or exclude hashes, filter specific packages, and customize annotations for better readability or machine processing. It streamlines the process of sharing dependency lists or deploying applications where pip is the designated installer.
CAVEATS
This command requires uv to be installed and available in your system's PATH. While designed for pip compatibility, minor differences in output might occur compared to a direct pip freeze operation. The '--strict' option may cause exports to fail if the package index does not provide hashes for all dependencies.
USAGE EXAMPLES
Export all dependencies to a file:
uv export > requirements.txt
Export in 'uv' format to a specific file:
uv export --format uv --output-file uv-requirements.txt
Export only specific packages:
uv export numpy pandas --output-file limited-reqs.txt
Export without hashes for simpler requirements:
uv export --no-hash
HISTORY
uv is a modern, high-performance Python packaging tool developed by Astral, first open-sourced in late 2023. The uv export subcommand was a fundamental component from its initial release, emphasizing interoperability with the established pip ecosystem. It aims to offer a faster and more reliable alternative for generating requirements.txt files compared to traditional methods like pip-tools.