mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-26 18:06:45 +00:00
9 KiB
9 KiB
Environment variables
uv accepts the following command-line arguments as environment variables:
UV_INDEX_URL: Equivalent to the--index-urlcommand-line argument. If set, uv will use this URL as the base index for searching for packages.UV_EXTRA_INDEX_URL: Equivalent to the--extra-index-urlcommand-line argument. If set, uv will use this space-separated list of URLs as additional indexes when searching for packages.UV_CACHE_DIR: Equivalent to the--cache-dircommand-line argument. If set, uv will use this directory for caching instead of the default cache directory.UV_NO_CACHE: Equivalent to the--no-cachecommand-line argument. If set, uv will not use the cache for any operations.UV_RESOLUTION: Equivalent to the--resolutioncommand-line argument. For example, if set tolowest-direct, uv will install the lowest compatible versions of all direct dependencies.UV_PRERELEASE: Equivalent to the--prereleasecommand-line argument. For example, if set toallow, uv will allow pre-release versions for all dependencies.UV_SYSTEM_PYTHON: Equivalent to the--systemcommand-line argument. If set totrue, uv will use the first Python interpreter found in the systemPATH. WARNING:UV_SYSTEM_PYTHON=trueis intended for use in continuous integration (CI) or containerized environments and should be used with caution, as modifying the system Python can lead to unexpected behavior.UV_PYTHON: Equivalent to the--pythoncommand-line argument. If set to a path, uv will use this Python interpreter for all operations.UV_BREAK_SYSTEM_PACKAGES: Equivalent to the--break-system-packagescommand-line argument. If set totrue, uv will allow the installation of packages that conflict with system-installed packages. WARNING:UV_BREAK_SYSTEM_PACKAGES=trueis intended for use in continuous integration (CI) or containerized environments and should be used with caution, as modifying the system Python can lead to unexpected behavior.UV_NATIVE_TLS: Equivalent to the--native-tlscommand-line argument. If set totrue, uv will use the system's trust store instead of the bundledwebpki-rootscrate.UV_INDEX_STRATEGY: Equivalent to the--index-strategycommand-line argument. For example, if set tounsafe-any-match, uv will consider versions of a given package available across all index URLs, rather than limiting its search to the first index URL that contains the package.UV_REQUIRE_HASHES: Equivalent to the--require-hashescommand-line argument. If set totrue, uv will require that all dependencies have a hash specified in the requirements file.UV_CONSTRAINT: Equivalent to the--constraintcommand-line argument. If set, uv will use this file as the constraints file. Uses space-separated list of files.UV_BUILD_CONSTRAINT: Equivalent to the--build-constraintcommand-line argument. If set, uv will use this file as constraints for any source distribution builds. Uses space-separated list of files.UV_OVERRIDE: Equivalent to the--overridecommand-line argument. If set, uv will use this file as the overrides file. Uses space-separated list of files.UV_LINK_MODE: Equivalent to the--link-modecommand-line argument. If set, uv will use this as a link mode.UV_NO_BUILD_ISOLATION: Equivalent to the--no-build-isolationcommand-line argument. If set, uv will skip isolation when building source distributions.UV_CUSTOM_COMPILE_COMMAND: Equivalent to the--custom-compile-commandcommand-line argument. Used to override uv in the output header of therequirements.txtfiles generated byuv pip compile. Intended for use-cases in whichuv pip compileis called from within a wrapper script, to include the name of the wrapper script in the output file.UV_KEYRING_PROVIDER: Equivalent to the--keyring-providercommand-line argument. If set, uv will use this value as the keyring provider.UV_CONFIG_FILE: Equivalent to the--config-filecommand-line argument. Expects a path to a localuv.tomlfile to use as the configuration file.UV_NO_CONFIG: Equivalent to the--no-configcommand-line argument. If set, uv will not read any configuration files from the current directory, parent directories, or user configuration directories.UV_EXCLUDE_NEWER: Equivalent to the--exclude-newercommand-line argument. If set, uv will exclude distributions published after the specified date.UV_PYTHON_PREFERENCE: Equivalent to the--python-preferencecommand-line argument. Whether uv should prefer system or managed Python versions.UV_PYTHON_DOWNLOADS: Equivalent to thepython-downloadssetting and, when disabled, the--no-python-downloadsoption. Whether uv should allow Python downloads.UV_COMPILE_BYTECODE: Equivalent to the--compile-bytecodecommand-line argument. If set, uv will compile Python source files to bytecode after installation.
In each case, the corresponding command-line argument takes precedence over an environment variable.
In addition, uv respects the following environment variables:
UV_CONCURRENT_DOWNLOADS: Sets the maximum number of in-flight concurrent downloads that uv will perform at any given time.UV_CONCURRENT_BUILDS: Sets the maximum number of source distributions that uv will build concurrently at any given time.UV_CONCURRENT_INSTALLS: Used to control the number of threads used when installing and unzipping packages.UV_TOOL_DIR: Used to specify the directory where uv will store managed tools.UV_TOOL_BIN_DIR: Used to specify the "bin" directory where uv will install tool executables.UV_PYTHON_INSTALL_DIR: Used to specify the directory where uv will store managed Python installations.UV_PYTHON_INSTALL_MIRROR: Managed Python installations are downloaded frompython-build-standalone. This variable can be set to a mirror URL to use a different source for Python installations. The provided URL will replacehttps://github.com/indygreg/python-build-standalone/releases/downloadin, e.g.,https://github.com/indygreg/python-build-standalone/releases/download/20240713/cpython-3.12.4%2B20240713-aarch64-apple-darwin-install_only.tar.gz.UV_PYPY_INSTALL_MIRROR: Managed PyPy installations are downloaded from python.org. This variable can be set to a mirror URL to use a different source for PyPy installations. The provided URL will replacehttps://downloads.python.org/pypyin, e.g.,https://downloads.python.org/pypy/pypy3.8-v7.3.7-osx64.tar.bz2.XDG_CONFIG_HOME: Used to specify the path to uv user-level configuration directory on Unix systems.XDG_CACHE_HOME: Used to specify the directory where uv stores cache files on Unix systems.XDG_DATA_HOME: Used to specify the directory where uv stores managed Python installations and managed tools on Unix systems.XDG_BIN_HOME: Used to specify the directory where executables are installed into.SSL_CERT_FILE: If set, uv will use this file as the certificate bundle instead of the system's trust store.SSL_CLIENT_CERT: If set, uv will use this file for mTLS authentication. This should be a single file containing both the certificate and the private key in PEM format.RUST_LOG: If set, uv will use this value as the log level for its--verboseoutput. Accepts any filter compatible with thetracing_subscribercrate. For example,RUST_LOG=tracewill enable trace-level logging. See the tracing documentation for more.HTTP_PROXY,HTTPS_PROXY,ALL_PROXY: The proxy to use for all HTTP/HTTPS requests.HTTP_TIMEOUT(orUV_HTTP_TIMEOUT): If set, uv will use this value (in seconds) as the timeout for HTTP reads (default: 30 s).PYC_INVALIDATION_MODE: The validation modes to use when run with--compile. See:PycInvalidationMode.VIRTUAL_ENV: Used to detect an activated virtual environment.CONDA_PREFIX: Used to detect an activated Conda environment.PROMPT: Used to detect the use of the Windows Command Prompt (as opposed to PowerShell).NU_VERSION: Used to detect the use of NuShell.FISH_VERSION: Used to detect the use of the Fish shell.BASH_VERSION: Used to detect the use of the Bash shell.ZSH_VERSION: Used to detect the use of the Zsh shell.MACOSX_DEPLOYMENT_TARGET: Used with--python-platform macosand related variants to set the deployment target (i.e., the minimum supported macOS version). Defaults to12.0, the least-recent non-EOL macOS version at time of writing.NO_COLOR: Disable colors. Takes precedence overFORCE_COLOR. See no-color.org.FORCE_COLOR: Enforce colors regardless of TTY support. See force-color.org.