diff --git a/crates/uv-cli/src/lib.rs b/crates/uv-cli/src/lib.rs
index 6378977fb..c27343231 100644
--- a/crates/uv-cli/src/lib.rs
+++ b/crates/uv-cli/src/lib.rs
@@ -200,7 +200,7 @@ pub struct GlobalArgs {
/// Disable network access.
///
/// When disabled, uv will only use locally cached data and locally available files.
- #[arg(global = true, long, overrides_with("no_offline"))]
+ #[arg(global = true, long, overrides_with("no_offline"), env = EnvVars::UV_OFFLINE, value_parser = clap::builder::BoolishValueParser::new())]
pub offline: bool,
#[arg(global = true, long, overrides_with("offline"), hide = true)]
diff --git a/crates/uv-static/src/env_vars.rs b/crates/uv-static/src/env_vars.rs
index ec58be134..1960024ce 100644
--- a/crates/uv-static/src/env_vars.rs
+++ b/crates/uv-static/src/env_vars.rs
@@ -5,6 +5,9 @@ pub struct EnvVars;
#[attribute_env_vars_metadata]
impl EnvVars {
+ /// Equivalent to the `--offline` command-line argument. If set, uv will disable network access.
+ pub const UV_OFFLINE: &'static str = "UV_OFFLINE";
+
/// Equivalent to the `--default-index` command-line argument. If set, uv will use
/// this URL as the default index when searching for packages.
pub const UV_DEFAULT_INDEX: &'static str = "UV_DEFAULT_INDEX";
diff --git a/crates/uv/tests/it/help.rs b/crates/uv/tests/it/help.rs
index de2ed24b0..55d235727 100644
--- a/crates/uv/tests/it/help.rs
+++ b/crates/uv/tests/it/help.rs
@@ -57,7 +57,7 @@ fn help() {
Whether to load TLS certificates from the platform's native certificate store [env:
UV_NATIVE_TLS=]
--offline
- Disable network access
+ Disable network access [env: UV_OFFLINE=]
--allow-insecure-host When disabled, uv will only use locally cached data and locally available files. May also be set with the Only include the development dependency group. Omit other dependencies. The project itself will also be omitted. When disabled, uv will only use locally cached data and locally available files. May also be set with the Set up the project to be built as a Python package. Defines a When disabled, uv will only use locally cached data and locally available files. May also be set with the Add the requirements to the package’s optional dependencies for the specified extra. The group may then be activated when installing the project with the When disabled, uv will only use locally cached data and locally available files. May also be set with the Remove the packages from the project’s optional dependencies for the specified extra Remove the dependencies from a specific package in the workspace When disabled, uv will only use locally cached data and locally available files. May also be set with the Only include the development dependency group. Omit other dependencies. The project itself will also be omitted. When disabled, uv will only use locally cached data and locally available files. May also be set with the The strategy to use when considering pre-release versions. By default, uv will accept pre-releases for packages that only publish pre-releases, along with first-party requirements that contain an explicit pre-release marker in the declared specifiers ( When disabled, uv will only use locally cached data and locally available files. May also be set with the Only include the development dependency group. Omit other dependencies. The project itself will also be omitted. When disabled, uv will only use locally cached data and locally available files. May also be set with the Only include the development dependency group. Omit other dependencies. The project itself will also be omitted. When disabled, uv will only use locally cached data and locally available files. May also be set with the The strategy to use when considering pre-release versions. By default, uv will accept pre-releases for packages that only publish pre-releases, along with first-party requirements that contain an explicit pre-release marker in the declared specifiers ( When disabled, uv will only use locally cached data and locally available files. May also be set with the Override versions using the given requirements files. Overrides files are When disabled, uv will only use locally cached data and locally available files. May also be set with the The strategy to use when considering pre-release versions. By default, uv will accept pre-releases for packages that only publish pre-releases, along with first-party requirements that contain an explicit pre-release marker in the declared specifiers ( When disabled, uv will only use locally cached data and locally available files. May also be set with the Run the command within the given project directory. All When disabled, uv will only use locally cached data and locally available files. May also be set with the Run the command within the given project directory. All When disabled, uv will only use locally cached data and locally available files. May also be set with the Run the command within the given project directory. All When disabled, uv will only use locally cached data and locally available files. May also be set with the Run the command within the given project directory. All When disabled, uv will only use locally cached data and locally available files. May also be set with the Only show Python downloads, exclude installed distributions. By default, available downloads for the current platform are shown. When disabled, uv will only use locally cached data and locally available files. May also be set with the Run the command within the given project directory. All When disabled, uv will only use locally cached data and locally available files. May also be set with the Run the command within the given project directory. All When disabled, uv will only use locally cached data and locally available files. May also be set with the Run the command within the given project directory. All When disabled, uv will only use locally cached data and locally available files. May also be set with the Run the command within the given project directory. All When disabled, uv will only use locally cached data and locally available files. May also be set with the Run the command within the given project directory. All When disabled, uv will only use locally cached data and locally available files. May also be set with the Only use pre-built wheels; don’t build source distributions. When enabled, resolving will not run code from the given packages. The cached wheels of already-built source distributions will be reused, but operations that require building distributions will exit with an error. When disabled, uv will only use locally cached data and locally available files. May also be set with the Only use pre-built wheels; don’t build source distributions. When enabled, resolving will not run code from the given packages. The cached wheels of already-built source distributions will be reused, but operations that require building distributions will exit with an error.UV_OFFLINE environment variable.--only-devUV_OFFLINE environment variable.--package[build-system] for the project.UV_OFFLINE environment variable.--optional optional--extra flag.UV_OFFLINE environment variable.--optional optional--package packageUV_OFFLINE environment variable.--only-devUV_OFFLINE environment variable.--prerelease prereleaseif-necessary-or-explicit).UV_OFFLINE environment variable.--only-devUV_OFFLINE environment variable.--only-devUV_OFFLINE environment variable.--prerelease prereleaseif-necessary-or-explicit).UV_OFFLINE environment variable.--overrides overridesrequirements.txt-like files that force a specific version of a requirement to be installed, regardless of the requirements declared by any constituent package, and regardless of whether this would be considered an invalid resolution.UV_OFFLINE environment variable.--prerelease prereleaseif-necessary-or-explicit).UV_OFFLINE environment variable.--project projectpyproject.toml, uv.toml, and .python-version files will be discovered by walking up the directory tree from the project root, as will the project’s virtual environment (.venv).UV_OFFLINE environment variable.--project projectpyproject.toml, uv.toml, and .python-version files will be discovered by walking up the directory tree from the project root, as will the project’s virtual environment (.venv).UV_OFFLINE environment variable.--project projectpyproject.toml, uv.toml, and .python-version files will be discovered by walking up the directory tree from the project root, as will the project’s virtual environment (.venv).UV_OFFLINE environment variable.--project projectpyproject.toml, uv.toml, and .python-version files will be discovered by walking up the directory tree from the project root, as will the project’s virtual environment (.venv).UV_OFFLINE environment variable.--only-downloadsUV_OFFLINE environment variable.--project projectpyproject.toml, uv.toml, and .python-version files will be discovered by walking up the directory tree from the project root, as will the project’s virtual environment (.venv).UV_OFFLINE environment variable.--project projectpyproject.toml, uv.toml, and .python-version files will be discovered by walking up the directory tree from the project root, as will the project’s virtual environment (.venv).UV_OFFLINE environment variable.--project projectpyproject.toml, uv.toml, and .python-version files will be discovered by walking up the directory tree from the project root, as will the project’s virtual environment (.venv).UV_OFFLINE environment variable.--project projectpyproject.toml, uv.toml, and .python-version files will be discovered by walking up the directory tree from the project root, as will the project’s virtual environment (.venv).UV_OFFLINE environment variable.--project projectpyproject.toml, uv.toml, and .python-version files will be discovered by walking up the directory tree from the project root, as will the project’s virtual environment (.venv).UV_OFFLINE environment variable.--only-binary only-binaryUV_OFFLINE environment variable.--only-binary only-binary
May also be set with the UV_OFFLINE environment variable.
--only-binary only-binaryOnly use pre-built wheels; don’t build source distributions.
When enabled, resolving will not run code from the given packages. The cached wheels of already-built source distributions will be reused, but operations that require building distributions will exit with an error.
@@ -6654,6 +6678,7 @@ uv pip uninstall [OPTIONS]When disabled, uv will only use locally cached data and locally available files.
+May also be set with the UV_OFFLINE environment variable.
--prefix prefixUninstall packages from the specified --prefix directory
--project projectRun the command within the given project directory.
@@ -6791,6 +6816,7 @@ uv pip freeze [OPTIONS]When disabled, uv will only use locally cached data and locally available files.
+May also be set with the UV_OFFLINE environment variable.
--project projectRun the command within the given project directory.
All pyproject.toml, uv.toml, and .python-version files will be discovered by walking up the directory tree from the project root, as will the project’s virtual environment (.venv).
When disabled, uv will only use locally cached data and locally available files.
+May also be set with the UV_OFFLINE environment variable.
--outdatedList outdated packages.
The latest version of each package will be shown alongside the installed version. Up-to-date packages will be omitted from the output.
@@ -7153,6 +7180,7 @@ uv pip show [OPTIONS] [PACKAGE]...When disabled, uv will only use locally cached data and locally available files.
+May also be set with the UV_OFFLINE environment variable.
--project projectRun the command within the given project directory.
All pyproject.toml, uv.toml, and .python-version files will be discovered by walking up the directory tree from the project root, as will the project’s virtual environment (.venv).
When disabled, uv will only use locally cached data and locally available files.
+May also be set with the UV_OFFLINE environment variable.
--outdatedShow the latest available version of each package in the tree
--package packageDisplay only the specified packages
@@ -7430,6 +7459,7 @@ uv pip check [OPTIONS]When disabled, uv will only use locally cached data and locally available files.
+May also be set with the UV_OFFLINE environment variable.
--project projectRun the command within the given project directory.
All pyproject.toml, uv.toml, and .python-version files will be discovered by walking up the directory tree from the project root, as will the project’s virtual environment (.venv).
When disabled, uv will only use locally cached data and locally available files.
+May also be set with the UV_OFFLINE environment variable.
--project projectRun the command within the given project directory.
All pyproject.toml, uv.toml, and .python-version files will be discovered by walking up the directory tree from the project root, as will the project’s virtual environment (.venv).
When disabled, uv will only use locally cached data and locally available files.
+May also be set with the UV_OFFLINE environment variable.
--out-dir, -o out-dirThe output directory to which distributions should be written.
Defaults to the dist subdirectory within the source directory, or the directory containing the source distribution archive.
When disabled, uv will only use locally cached data and locally available files.
+May also be set with the UV_OFFLINE environment variable.
--password, -p passwordThe password for the upload
May also be set with the UV_PUBLISH_PASSWORD environment variable.
When disabled, uv will only use locally cached data and locally available files.
+May also be set with the UV_OFFLINE environment variable.
--project projectRun the command within the given project directory.
All pyproject.toml, uv.toml, and .python-version files will be discovered by walking up the directory tree from the project root, as will the project’s virtual environment (.venv).
When disabled, uv will only use locally cached data and locally available files.
+May also be set with the UV_OFFLINE environment variable.
--project projectRun the command within the given project directory.
All pyproject.toml, uv.toml, and .python-version files will be discovered by walking up the directory tree from the project root, as will the project’s virtual environment (.venv).
When disabled, uv will only use locally cached data and locally available files.
+May also be set with the UV_OFFLINE environment variable.
--project projectRun the command within the given project directory.
All pyproject.toml, uv.toml, and .python-version files will be discovered by walking up the directory tree from the project root, as will the project’s virtual environment (.venv).
When disabled, uv will only use locally cached data and locally available files.
+May also be set with the UV_OFFLINE environment variable.
--project projectRun the command within the given project directory.
All pyproject.toml, uv.toml, and .python-version files will be discovered by walking up the directory tree from the project root, as will the project’s virtual environment (.venv).
When disabled, uv will only use locally cached data and locally available files.
+May also be set with the UV_OFFLINE environment variable.
--output-format output-format--project projectRun the command within the given project directory.
All pyproject.toml, uv.toml, and .python-version files will be discovered by walking up the directory tree from the project root, as will the project’s virtual environment (.venv).
When disabled, uv will only use locally cached data and locally available files.
+May also be set with the UV_OFFLINE environment variable.
--project projectRun the command within the given project directory.
All pyproject.toml, uv.toml, and .python-version files will be discovered by walking up the directory tree from the project root, as will the project’s virtual environment (.venv).