Skip to content

Commit

Permalink
Document the environment variables that uv respects
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Mar 10, 2024
1 parent f7f6453 commit de0013b
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,38 @@ to build on aarch64 Windows, but does not consider either platform to be support

uv supports and is tested against Python 3.8, 3.9, 3.10, 3.11, and 3.12.

## Environment variables

uv accepts the following command-line arguments as environment variables:

- `UV_INDEX_URL`: Equivalent to the `--index-url` command-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-url` command-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-dir` command-line argument. If set, uv will use this
directory for caching instead of the default cache directory.
- `UV_NO_CACHE`: Equivalent to the `--no-cache` command-line argument. If set, uv will not use the
cache for any operations.
- `UV_PRERELEASE`: Equivalent to the `--prerelease` command-line argument. If set to `allow`, uv
will allow pre-release versions for all dependencies.

In each case, the corresponding command-line argument takes precedence over an environment variable.

In addition, uv respects the following environment variables:

- `SSL_CERT_FILE`: If set, uv will use this file as the certificate bundle instead of the system's
trust store.
- `RUST_LOG`: If set, uv will use this value as the log level for its `--verbose` output. For
example, `RUST_LOG=trace` will enable trace-level logging.
- `HTTP_TIMEOUT` (or `UV_HTTP_TIMEOUT`: If set, uv will use this value (in seconds) as the timeout
for HTTP requests.
- `PYC_INVALIDATION_MODE`: The validation modes to use when run with `--compile`.
See: [`PycInvalidationMode`](https://docs.python.org/3/library/py_compile.html#py_compile.PycInvalidationMode).
- `VIRTUAL_ENV`: Used to detect an activated virtual environment.
- `CONDA_PREFIX`: Used to detect an activated Conda environment.
- `PROMPT`: Used to detect the appropriate activation script after generating a virtual environment.
- `NU_VERSION`: Used to detect the appropriate activation script after generating a virtual environment.

## Custom CA Certificates

uv supports custom CA certificates (such as those needed by corporate proxies) by utilizing the
Expand Down
4 changes: 4 additions & 0 deletions crates/uv-cache/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ pub struct CacheArgs {
no_cache: bool,

/// Path to the cache directory.
///
/// Defaults to `$HOME/Library/Caches/uv` on macOS, `$XDG_CACHE_HOME/uv` or `$HOME/.cache/uv` on
/// Linux, and `$HOME/.cache/<project_path> {FOLDERID_LocalAppData}/<project_path>/cache/uv`
/// on Windows.
#[arg(global = true, long, env = "UV_CACHE_DIR")]
cache_dir: Option<PathBuf>,
}
Expand Down

0 comments on commit de0013b

Please sign in to comment.