CLI Reference
uv
An extremely fast Python package manager.
Usage
Commands
uv authManage authentication
uv runRun a command or script
uv initCreate a new project
uv addAdd dependencies to the project
uv removeRemove dependencies from the project
uv versionRead or update the project's version
uv syncUpdate the project's environment
uv lockUpdate the project's lockfile
uv exportExport the project's lockfile to an alternate format
uv treeDisplay the project's dependency tree
uv formatFormat Python code in the project
uv toolRun and install commands provided by Python packages
uv pythonManage Python versions and installations
uv pipManage Python packages with a pip-compatible interface
uv venvCreate a virtual environment
uv buildBuild Python packages into source distributions and wheels
uv publishUpload distributions to an index
uv cacheManage uv's cache
uv selfManage the uv executable
uv helpDisplay documentation for a command
uv auth
Manage authentication
Usage
Commands
uv auth loginLogin to a service
uv auth logoutLogout of a service
uv auth tokenShow the authentication token for a service
uv auth dirShow the path to the uv credentials directory
uv auth login
Login to a service
Usage
Arguments
- SERVICE
The domain or URL of the service to log into
Options
--allow-insecure-host,--trusted-hostallow-insecure-hostAllow insecure connections to a host.
Can be provided multiple times.
Expects to receive either a hostname (e.g.,
localhost), a host-port pair (e.g.,localhost:8080), or a URL (e.g.,https://localhost).WARNING: Hosts included in this list will not be verified against the system's certificate store. Only use
--allow-insecure-hostin a secure network with verified sources, as it bypasses SSL verification and could expose you to MITM attacks.May also be set with the
UV_INSECURE_HOSTenvironment variable.--cache-dircache-dirPath to the cache directory.
Defaults to
$XDG_CACHE_HOME/uvor$HOME/.cache/uvon macOS and Linux, and%LOCALAPPDATA%\uv\cacheon Windows.To view the location of the cache directory, run
uv cache dir.May also be set with the
UV_CACHE_DIRenvironment variable.--colorcolor-choiceControl the use of color in output.
By default, uv will automatically detect support for colors when writing to a terminal.
Possible values:
auto: Enables colored output only when the output is going to a terminal or TTY with supportalways: Enables colored output regardless of the detected environmentnever: Disables colored output
--config-fileconfig-fileThe path to a
uv.tomlfile to use for configuration.While uv configuration can be included in a
pyproject.tomlfile, it is not allowed in this context.May also be set with the
UV_CONFIG_FILEenvironment variable.--directorydirectoryChange to the given directory prior to running the command.
Relative paths are resolved with the given directory as the base.
See
--projectto only change the project root directory.May also be set with the
UV_WORKING_DIRenvironment variable.--help,-hDisplay the concise help for this command
--keyring-providerkeyring-providerThe keyring provider to use for storage of credentials.
Only
--keyring-provider nativeis supported forlogin, which uses the system keyring via an integration built into uv.May also be set with the
UV_KEYRING_PROVIDERenvironment variable.Possible values:
disabled: Do not use keyring for credential lookupsubprocess: Use thekeyringcommand for credential lookup
--managed-pythonRequire use of uv-managed Python versions.
By default, uv prefers using Python versions it manages. However, it will use system Python versions if a uv-managed Python is not installed. This option disables use of system Python versions.
May also be set with the
UV_MANAGED_PYTHONenvironment variable.--native-tlsWhether to load TLS certificates from the platform's native certificate store.
By default, uv loads certificates from the bundled
webpki-rootscrate. Thewebpki-rootsare a reliable set of trust roots from Mozilla, and including them in uv improves portability and performance (especially on macOS).However, in some cases, you may want to use the platform's native certificate store, especially if you're relying on a corporate trust root (e.g., for a mandatory proxy) that's included in your system's certificate store.
May also be set with the
UV_NATIVE_TLSenvironment variable.--no-cache,--no-cache-dir,-nAvoid reading from or writing to the cache, instead using a temporary directory for the duration of the operation
May also be set with the
UV_NO_CACHEenvironment variable.--no-configAvoid discovering configuration files (
pyproject.toml,uv.toml).Normally, configuration files are discovered in the current directory, parent directories, or user configuration directories.
May also be set with the
UV_NO_CONFIGenvironment variable.--no-managed-pythonDisable use of uv-managed Python versions.
Instead, uv will search for a suitable Python version on the system.
May also be set with the
UV_NO_MANAGED_PYTHONenvironment variable.--no-progressHide all progress outputs.
For example, spinners or progress bars.
May also be set with the
UV_NO_PROGRESSenvironment variable.--no-python-downloadsDisable automatic downloads of Python.
--offlineDisable network access.
When disabled, uv will only use locally cached data and locally available files.
May also be set with the
UV_OFFLINEenvironment variable.--passwordpasswordThe password to use for the service.
Use
-to read the password from stdin.--projectprojectDiscover a project in the given directory.
All
pyproject.toml,uv.toml, and.python-versionfiles will be discovered by walking up the directory tree from the project root, as will the project's virtual environment (.venv).Other command-line arguments (such as relative paths) will be resolved relative to the current working directory.
See
--directoryto change the working directory entirely.This setting has no effect when used in the
uv pipinterface.May also be set with the
UV_PROJECTenvironment variable.--quiet,-qUse quiet output.
Repeating this option, e.g.,
-qq, will enable a silent mode in which uv will write no output to stdout.--token,-ttokenThe token to use for the service.
The username will be set to
__token__.Use
-to read the token from stdin.--username,-uusernameThe username to use for the service
--verbose,-vUse verbose output.
You can configure fine-grained logging using the
RUST_LOGenvironment variable. (https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#directives)
uv auth logout
Logout of a service
Usage
Arguments
- SERVICE
The domain or URL of the service to logout from
Options
--allow-insecure-host,--trusted-hostallow-insecure-hostAllow insecure connections to a host.
Can be provided multiple times.
Expects to receive either a hostname (e.g.,
localhost), a host-port pair (e.g.,localhost:8080), or a URL (e.g.,https://localhost).WARNING: Hosts included in this list will not be verified against the system's certificate store. Only use
--allow-insecure-hostin a secure network with verified sources, as it bypasses SSL verification and could expose you to MITM attacks.May also be set with the
UV_INSECURE_HOSTenvironment variable.--cache-dircache-dirPath to the cache directory.
Defaults to
$XDG_CACHE_HOME/uvor$HOME/.cache/uvon macOS and Linux, and%LOCALAPPDATA%\uv\cacheon Windows.To view the location of the cache directory, run
uv cache dir.May also be set with the
UV_CACHE_DIRenvironment variable.--colorcolor-choiceControl the use of color in output.
By default, uv will automatically detect support for colors when writing to a terminal.
Possible values:
auto: Enables colored output only when the output is going to a terminal or TTY with supportalways: Enables colored output regardless of the detected environmentnever: Disables colored output
--config-fileconfig-fileThe path to a
uv.tomlfile to use for configuration.While uv configuration can be included in a
pyproject.tomlfile, it is not allowed in this context.May also be set with the
UV_CONFIG_FILEenvironment variable.--directorydirectoryChange to the given directory prior to running the command.
Relative paths are resolved with the given directory as the base.
See
--projectto only change the project root directory.May also be set with the
UV_WORKING_DIRenvironment variable.--help,-hDisplay the concise help for this command
--keyring-providerkeyring-providerThe keyring provider to use for storage of credentials.
Only
--keyring-provider nativeis supported forlogout, which uses the system keyring via an integration built into uv.May also be set with the
UV_KEYRING_PROVIDERenvironment variable.Possible values:
disabled: Do not use keyring for credential lookupsubprocess: Use thekeyringcommand for credential lookup
--managed-pythonRequire use of uv-managed Python versions.
By default, uv prefers using Python versions it manages. However, it will use system Python versions if a uv-managed Python is not installed. This option disables use of system Python versions.
May also be set with the
UV_MANAGED_PYTHONenvironment variable.--native-tlsWhether to load TLS certificates from the platform's native certificate store.
By default, uv loads certificates from the bundled
webpki-rootscrate. Thewebpki-rootsare a reliable set of trust roots from Mozilla, and including them in uv improves portability and performance (especially on macOS).However, in some cases, you may want to use the platform's native certificate store, especially if you're relying on a corporate trust root (e.g., for a mandatory proxy) that's included in your system's certificate store.
May also be set with the
UV_NATIVE_TLSenvironment variable.--no-cache,--no-cache-dir,-nAvoid reading from or writing to the cache, instead using a temporary directory for the duration of the operation
May also be set with the
UV_NO_CACHEenvironment variable.--no-configAvoid discovering configuration files (
pyproject.toml,uv.toml).Normally, configuration files are discovered in the current directory, parent directories, or user configuration directories.
May also be set with the
UV_NO_CONFIGenvironment variable.--no-managed-pythonDisable use of uv-managed Python versions.
Instead, uv will search for a suitable Python version on the system.
May also be set with the
UV_NO_MANAGED_PYTHONenvironment variable.--no-progressHide all progress outputs.
For example, spinners or progress bars.
May also be set with the
UV_NO_PROGRESSenvironment variable.--no-python-downloadsDisable automatic downloads of Python.
--offlineDisable network access.
When disabled, uv will only use locally cached data and locally available files.
May also be set with the
UV_OFFLINEenvironment variable.--projectprojectDiscover a project in the given directory.
All
pyproject.toml,uv.toml, and.python-versionfiles will be discovered by walking up the directory tree from the project root, as will the project's virtual environment (.venv).Other command-line arguments (such as relative paths) will be resolved relative to the current working directory.
See
--directoryto change the working directory entirely.This setting has no effect when used in the
uv pipinterface.May also be set with the
UV_PROJECTenvironment variable.--quiet,-qUse quiet output.
Repeating this option, e.g.,
-qq, will enable a silent mode in which uv will write no output to stdout.--username,-uusernameThe username to logout
--verbose,-vUse verbose output.
You can configure fine-grained logging using the
RUST_LOGenvironment variable. (https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#directives)
uv auth token
Show the authentication token for a service
Usage
Arguments
- SERVICE
The domain or URL of the service to lookup
Options
--allow-insecure-host,--trusted-hostallow-insecure-hostAllow insecure connections to a host.
Can be provided multiple times.
Expects to receive either a hostname (e.g.,
localhost), a host-port pair (e.g.,localhost:8080), or a URL (e.g.,https://localhost).WARNING: Hosts included in this list will not be verified against the system's certificate store. Only use
--allow-insecure-hostin a secure network with verified sources, as it bypasses SSL verification and could expose you to MITM attacks.May also be set with the
UV_INSECURE_HOSTenvironment variable.--cache-dircache-dirPath to the cache directory.
Defaults to
$XDG_CACHE_HOME/uvor$HOME/.cache/uvon macOS and Linux, and%LOCALAPPDATA%\uv\cacheon Windows.To view the location of the cache directory, run
uv cache dir.May also be set with the
UV_CACHE_DIRenvironment variable.--colorcolor-choiceControl the use of color in output.
By default, uv will automatically detect support for colors when writing to a terminal.
Possible values:
auto: Enables colored output only when the output is going to a terminal or TTY with supportalways: Enables colored output regardless of the detected environmentnever: Disables colored output
--config-fileconfig-fileThe path to a
uv.tomlfile to use for configuration.While uv configuration can be included in a
pyproject.tomlfile, it is not allowed in this context.May also be set with the
UV_CONFIG_FILEenvironment variable.--directorydirectoryChange to the given directory prior to running the command.
Relative paths are resolved with the given directory as the base.
See
--projectto only change the project root directory.May also be set with the
UV_WORKING_DIRenvironment variable.--help,-hDisplay the concise help for this command
--keyring-providerkeyring-providerThe keyring provider to use for reading credentials
May also be set with the
UV_KEYRING_PROVIDERenvironment variable.Possible values:
disabled: Do not use keyring for credential lookupsubprocess: Use thekeyringcommand for credential lookup
--managed-pythonRequire use of uv-managed Python versions.
By default, uv prefers using Python versions it manages. However, it will use system Python versions if a uv-managed Python is not installed. This option disables use of system Python versions.
May also be set with the
UV_MANAGED_PYTHONenvironment variable.--native-tlsWhether to load TLS certificates from the platform's native certificate store.
By default, uv loads certificates from the bundled
webpki-rootscrate. Thewebpki-rootsare a reliable set of trust roots from Mozilla, and including them in uv improves portability and performance (especially on macOS).However, in some cases, you may want to use the platform's native certificate store, especially if you're relying on a corporate trust root (e.g., for a mandatory proxy) that's included in your system's certificate store.
May also be set with the
UV_NATIVE_TLSenvironment variable.--no-cache,--no-cache-dir,-nAvoid reading from or writing to the cache, instead using a temporary directory for the duration of the operation
May also be set with the
UV_NO_CACHEenvironment variable.--no-configAvoid discovering configuration files (
pyproject.toml,uv.toml).Normally, configuration files are discovered in the current directory, parent directories, or user configuration directories.
May also be set with the
UV_NO_CONFIGenvironment variable.--no-managed-pythonDisable use of uv-managed Python versions.
Instead, uv will search for a suitable Python version on the system.
May also be set with the
UV_NO_MANAGED_PYTHONenvironment variable.--no-progressHide all progress outputs.
For example, spinners or progress bars.
May also be set with the
UV_NO_PROGRESSenvironment variable.--no-python-downloadsDisable automatic downloads of Python.
--offlineDisable network access.
When disabled, uv will only use locally cached data and locally available files.
May also be set with the
UV_OFFLINEenvironment variable.--projectprojectDiscover a project in the given directory.
All
pyproject.toml,uv.toml, and.python-versionfiles will be discovered by walking up the directory tree from the project root, as will the project's virtual environment (.venv).Other command-line arguments (such as relative paths) will be resolved relative to the current working directory.
See
--directoryto change the working directory entirely.This setting has no effect when used in the
uv pipinterface.May also be set with the
UV_PROJECTenvironment variable.--quiet,-qUse quiet output.
Repeating this option, e.g.,
-qq, will enable a silent mode in which uv will write no output to stdout.--username,-uusernameThe username to lookup
--verbose,-vUse verbose output.
You can configure fine-grained logging using the
RUST_LOGenvironment variable. (https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#directives)
uv auth dir
Show the path to the uv credentials directory.
By default, credentials are stored in the uv data directory at $XDG_DATA_HOME/uv/credentials or $HOME/.local/share/uv/credentials on Unix and %APPDATA%\uv\data\credentials on Windows.
The credentials directory may be overridden with $UV_CREDENTIALS_DIR.
Credentials are only stored in this directory when the plaintext backend is used, as opposed to the native backend, which uses the system keyring.
Usage
Arguments
- SERVICE
The domain or URL of the service to lookup
Options
--allow-insecure-host,--trusted-hostallow-insecure-hostAllow insecure connections to a host.
Can be provided multiple times.
Expects to receive either a hostname (e.g.,
localhost), a host-port pair (e.g.,localhost:8080), or a URL (e.g.,https://localhost).WARNING: Hosts included in this list will not be verified against the system's certificate store. Only use
--allow-insecure-hostin a secure network with verified sources, as it bypasses SSL verification and could expose you to MITM attacks.May also be set with the
UV_INSECURE_HOSTenvironment variable.--cache-dircache-dirPath to the cache directory.
Defaults to
$XDG_CACHE_HOME/uvor$HOME/.cache/uvon macOS and Linux, and%LOCALAPPDATA%\uv\cacheon Windows.To view the location of the cache directory, run
uv cache dir.May also be set with the
UV_CACHE_DIRenvironment variable.--colorcolor-choiceControl the use of color in output.
By default, uv will automatically detect support for colors when writing to a terminal.
Possible values:
auto: Enables colored output only when the output is going to a terminal or TTY with supportalways: Enables colored output regardless of the detected environmentnever: Disables colored output
--config-fileconfig-fileThe path to a
uv.tomlfile to use for configuration.While uv configuration can be included in a
pyproject.tomlfile, it is not allowed in this context.May also be set with the
UV_CONFIG_FILEenvironment variable.--directorydirectoryChange to the given directory prior to running the command.
Relative paths are resolved with the given directory as the base.
See
--projectto only change the project root directory.May also be set with the
UV_WORKING_DIRenvironment variable.--help,-hDisplay the concise help for this command
--managed-pythonRequire use of uv-managed Python versions.
By default, uv prefers using Python versions it manages. However, it will use system Python versions if a uv-managed Python is not installed. This option disables use of system Python versions.
May also be set with the
UV_MANAGED_PYTHONenvironment variable.--native-tlsWhether to load TLS certificates from the platform's native certificate store.
By default, uv loads certificates from the bundled
webpki-rootscrate. Thewebpki-rootsare a reliable set of trust roots from Mozilla, and including them in uv improves portability and performance (especially on macOS).However, in some cases, you may want to use the platform's native certificate store, especially if you're relying on a corporate trust root (e.g., for a mandatory proxy) that's included in your system's certificate store.
May also be set with the
UV_NATIVE_TLSenvironment variable.--no-cache,--no-cache-dir,-nAvoid reading from or writing to the cache, instead using a temporary directory for the duration of the operation
May also be set with the
UV_NO_CACHEenvironment variable.--no-configAvoid discovering configuration files (
pyproject.toml,uv.toml).Normally, configuration files are discovered in the current directory, parent directories, or user configuration directories.
May also be set with the
UV_NO_CONFIGenvironment variable.--no-managed-pythonDisable use of uv-managed Python versions.
Instead, uv will search for a suitable Python version on the system.
May also be set with the
UV_NO_MANAGED_PYTHONenvironment variable.--no-progressHide all progress outputs.
For example, spinners or progress bars.
May also be set with the
UV_NO_PROGRESSenvironment variable.--no-python-downloadsDisable automatic downloads of Python.
--offlineDisable network access.
When disabled, uv will only use locally cached data and locally available files.
May also be set with the
UV_OFFLINEenvironment variable.--projectprojectDiscover a project in the given directory.
All
pyproject.toml,uv.toml, and.python-versionfiles will be discovered by walking up the directory tree from the project root, as will the project's virtual environment (.venv).Other command-line arguments (such as relative paths) will be resolved relative to the current working directory.
See
--directoryto change the working directory entirely.This setting has no effect when used in the
uv pipinterface.May also be set with the
UV_PROJECTenvironment variable.--quiet,-qUse quiet output.
Repeating this option, e.g.,
-qq, will enable a silent mode in which uv will write no output to stdout.--verbose,-vUse verbose output.
You can configure fine-grained logging using the
RUST_LOGenvironment variable. (https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#directives)
uv run
Run a command or script.
Ensures that the command runs in a Python environment.
When used with a file ending in .py or an HTTP(S) URL, the file will be treated as a script and run with a Python interpreter, i.e., uv run file.py is equivalent to uv run python file.py. For URLs, the script is temporarily downloaded before execution. If the script contains inline dependency metadata, it will be installed into an isolated, ephemeral environment. When used with -, the input will be read from stdin, and treated as a Python script.
When used in a project, the project environment will be created and updated before invoking the command.
When used outside a project, if a virtual environment can be found in the current directory or a parent directory, the command will be run in that environment. Otherwise, the command will be run in the environment of the discovered interpreter.
Arguments following the command (or script) are not interpreted as arguments to uv. All options to uv must be provided before the command, e.g., uv run --verbose foo. A -- can be used to separate the command from uv options for clarity, e.g., uv run --python 3.12 -- python.
Usage
Options
--activePrefer the active virtual environment over the project's virtual environment.
If the project virtual environment is active or no virtual environment is active, this has no effect.
--all-extrasInclude all optional dependencies.
Optional dependencies are defined via
project.optional-dependenciesin apyproject.toml.This option is only available when running in a project.
--all-groupsInclude dependencies from all dependency groups.
--no-groupcan be used to exclude specific groups.--all-packagesRun the command with all workspace members installed.
The workspace's environment (
.venv) is updated to include all workspace members.Any extras or groups specified via
--extra,--group, or related options will be applied to all workspace members.