Add reference documentation for pip settings (#5125)

## Summary

Third part of https://github.com/astral-sh/uv/issues/5093.
This commit is contained in:
Charlie Marsh 2024-07-16 17:14:27 -04:00 committed by GitHub
parent 21cda3e079
commit 7211e62132
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 2199 additions and 50 deletions

View file

@ -485,11 +485,13 @@ pub struct PipCompileArgs {
pub r#override: Vec<Maybe<PathBuf>>, pub r#override: Vec<Maybe<PathBuf>>,
/// Include optional dependencies from the extra group name; may be provided more than once. /// Include optional dependencies from the extra group name; may be provided more than once.
///
/// Only applies to `pyproject.toml`, `setup.py`, and `setup.cfg` sources. /// Only applies to `pyproject.toml`, `setup.py`, and `setup.cfg` sources.
#[arg(long, conflicts_with = "all_extras", value_parser = extra_name_with_clap_error)] #[arg(long, conflicts_with = "all_extras", value_parser = extra_name_with_clap_error)]
pub extra: Option<Vec<ExtraName>>, pub extra: Option<Vec<ExtraName>>,
/// Include all optional dependencies. /// Include all optional dependencies.
///
/// Only applies to `pyproject.toml`, `setup.py`, and `setup.cfg` sources. /// Only applies to `pyproject.toml`, `setup.py`, and `setup.cfg` sources.
#[arg(long, conflicts_with = "extra")] #[arg(long, conflicts_with = "extra")]
pub all_extras: bool, pub all_extras: bool,
@ -512,6 +514,9 @@ pub struct PipCompileArgs {
pub deps: bool, pub deps: bool,
/// Write the compiled requirements to the given `requirements.txt` file. /// Write the compiled requirements to the given `requirements.txt` file.
///
/// If the file already exists, the existing versions will be preferred when resolving
/// dependencies, unless `--upgrade` is also specified.
#[arg(long, short)] #[arg(long, short)]
pub output_file: Option<PathBuf>, pub output_file: Option<PathBuf>,
@ -550,13 +555,16 @@ pub struct PipCompileArgs {
#[arg(long, overrides_with("no_header"), hide = true)] #[arg(long, overrides_with("no_header"), hide = true)]
pub header: bool, pub header: bool,
/// Choose the style of the annotation comments, which indicate the source of each package. /// The style of the annotation comments included in the output file, used to indicate the
/// source of each package.
/// ///
/// Defaults to `split`. /// Defaults to `split`.
#[arg(long, value_enum)] #[arg(long, value_enum)]
pub annotation_style: Option<AnnotationStyle>, pub annotation_style: Option<AnnotationStyle>,
/// Change header comment to reflect custom command wrapping `uv pip compile`. /// The header comment to include at the top of the output file generated by `uv pip compile`.
///
/// Used to reflect custom build scripts and commands that wrap `uv pip compile`.
#[arg(long, env = "UV_CUSTOM_COMPILE_COMMAND")] #[arg(long, env = "UV_CUSTOM_COMPILE_COMMAND")]
pub custom_compile_command: Option<String>, pub custom_compile_command: Option<String>,
@ -574,7 +582,7 @@ pub struct PipCompileArgs {
#[arg(long, verbatim_doc_comment)] #[arg(long, verbatim_doc_comment)]
pub python: Option<String>, pub python: Option<String>,
/// Install packages into the system Python. /// Install packages into the system Python environment.
/// ///
/// By default, uv uses the virtual environment in the current working directory or any parent /// By default, uv uses the virtual environment in the current working directory or any parent
/// directory, falling back to searching for a Python executable in `PATH`. The `--system` /// directory, falling back to searching for a Python executable in `PATH`. The `--system`
@ -665,11 +673,11 @@ pub struct PipCompileArgs {
#[arg(long, conflicts_with = "no_build")] #[arg(long, conflicts_with = "no_build")]
pub only_binary: Option<Vec<PackageNameSpecifier>>, pub only_binary: Option<Vec<PackageNameSpecifier>>,
/// The minimum Python version that should be supported by the compiled requirements (e.g., /// The minimum Python version that should be supported by the resolved requirements (e.g.,
/// `3.7` or `3.7.9`). /// `3.8` or `3.8.17`).
/// ///
/// If a patch version is omitted, the minimum patch version is assumed. For example, `3.7` is /// If a patch version is omitted, the minimum patch version is assumed. For example, `3.8` is
/// mapped to `3.7.0`. /// mapped to `3.8.0`.
#[arg(long, short)] #[arg(long, short)]
pub python_version: Option<PythonVersion>, pub python_version: Option<PythonVersion>,
@ -783,6 +791,7 @@ pub struct PipSyncArgs {
/// must either be pinned to exact versions (e.g., `==1.0.0`), or be specified via direct URL. /// must either be pinned to exact versions (e.g., `==1.0.0`), or be specified via direct URL.
/// ///
/// Hash-checking mode introduces a number of additional constraints: /// Hash-checking mode introduces a number of additional constraints:
///
/// - Git dependencies are not supported. /// - Git dependencies are not supported.
/// - Editable installs are not supported. /// - Editable installs are not supported.
/// - Local dependencies are not supported, unless they point to a specific wheel (`.whl`) or /// - Local dependencies are not supported, unless they point to a specific wheel (`.whl`) or
@ -809,7 +818,7 @@ pub struct PipSyncArgs {
#[arg(long, short, env = "UV_PYTHON", verbatim_doc_comment)] #[arg(long, short, env = "UV_PYTHON", verbatim_doc_comment)]
pub python: Option<String>, pub python: Option<String>,
/// Install packages into the system Python. /// Install packages into the system Python environment.
/// ///
/// By default, uv installs into the virtual environment in the current working directory or /// By default, uv installs into the virtual environment in the current working directory or
/// any parent directory. The `--system` option instructs uv to instead use the first Python /// any parent directory. The `--system` option instructs uv to instead use the first Python
@ -845,14 +854,13 @@ pub struct PipSyncArgs {
#[arg(long, overrides_with("break_system_packages"))] #[arg(long, overrides_with("break_system_packages"))]
pub no_break_system_packages: bool, pub no_break_system_packages: bool,
/// Install packages into the specified directory, rather than into the virtual environment /// Install packages into the specified directory, rather than into the virtual or system Python
/// or system Python interpreter. The packages will be installed at the top-level of the /// environment. The packages will be installed at the top-level of the directory.
/// directory
#[arg(long, conflicts_with = "prefix")] #[arg(long, conflicts_with = "prefix")]
pub target: Option<PathBuf>, pub target: Option<PathBuf>,
/// Install packages into `lib`, `bin`, and other top-level folders under the specified /// Install packages into `lib`, `bin`, and other top-level folders under the specified
/// directory, as if a virtual environment were created at the specified location. /// directory, as if a virtual environment were present at that location.
/// ///
/// In general, prefer the use of `--python` to install into an alternate environment, as /// In general, prefer the use of `--python` to install into an alternate environment, as
/// scripts and other artifacts installed via `--prefix` will reference the installing /// scripts and other artifacts installed via `--prefix` will reference the installing
@ -957,7 +965,7 @@ pub struct PipSyncArgs {
#[arg(long)] #[arg(long)]
pub python_platform: Option<TargetTriple>, pub python_platform: Option<TargetTriple>,
/// Validate the virtual environment after completing the installation, to detect packages with /// Validate the Python environment after completing the installation, to detect and with
/// missing dependencies or other issues. /// missing dependencies or other issues.
#[arg(long, overrides_with("no_strict"))] #[arg(long, overrides_with("no_strict"))]
pub strict: bool, pub strict: bool,
@ -1018,11 +1026,13 @@ pub struct PipInstallArgs {
pub r#override: Vec<Maybe<PathBuf>>, pub r#override: Vec<Maybe<PathBuf>>,
/// Include optional dependencies from the extra group name; may be provided more than once. /// Include optional dependencies from the extra group name; may be provided more than once.
///
/// Only applies to `pyproject.toml`, `setup.py`, and `setup.cfg` sources. /// Only applies to `pyproject.toml`, `setup.py`, and `setup.cfg` sources.
#[arg(long, conflicts_with = "all_extras", value_parser = extra_name_with_clap_error)] #[arg(long, conflicts_with = "all_extras", value_parser = extra_name_with_clap_error)]
pub extra: Option<Vec<ExtraName>>, pub extra: Option<Vec<ExtraName>>,
/// Include all optional dependencies. /// Include all optional dependencies.
///
/// Only applies to `pyproject.toml`, `setup.py`, and `setup.cfg` sources. /// Only applies to `pyproject.toml`, `setup.py`, and `setup.cfg` sources.
#[arg(long, conflicts_with = "extra", overrides_with = "no_all_extras")] #[arg(long, conflicts_with = "extra", overrides_with = "no_all_extras")]
pub all_extras: bool, pub all_extras: bool,
@ -1051,6 +1061,7 @@ pub struct PipInstallArgs {
/// must either be pinned to exact versions (e.g., `==1.0.0`), or be specified via direct URL. /// must either be pinned to exact versions (e.g., `==1.0.0`), or be specified via direct URL.
/// ///
/// Hash-checking mode introduces a number of additional constraints: /// Hash-checking mode introduces a number of additional constraints:
///
/// - Git dependencies are not supported. /// - Git dependencies are not supported.
/// - Editable installs are not supported. /// - Editable installs are not supported.
/// - Local dependencies are not supported, unless they point to a specific wheel (`.whl`) or /// - Local dependencies are not supported, unless they point to a specific wheel (`.whl`) or
@ -1081,7 +1092,7 @@ pub struct PipInstallArgs {
#[arg(long, short, env = "UV_PYTHON", verbatim_doc_comment)] #[arg(long, short, env = "UV_PYTHON", verbatim_doc_comment)]
pub python: Option<String>, pub python: Option<String>,
/// Install packages into the system Python. /// Install packages into the system Python environment.
/// ///
/// By default, uv installs into the virtual environment in the current working directory or /// By default, uv installs into the virtual environment in the current working directory or
/// any parent directory. The `--system` option instructs uv to instead use the first Python /// any parent directory. The `--system` option instructs uv to instead use the first Python
@ -1117,14 +1128,13 @@ pub struct PipInstallArgs {
#[arg(long, overrides_with("break_system_packages"))] #[arg(long, overrides_with("break_system_packages"))]
pub no_break_system_packages: bool, pub no_break_system_packages: bool,
/// Install packages into the specified directory, rather than into the virtual environment /// Install packages into the specified directory, rather than into the virtual or system Python
/// or system Python interpreter. The packages will be installed at the top-level of the /// environment. The packages will be installed at the top-level of the directory.
/// directory
#[arg(long, conflicts_with = "prefix")] #[arg(long, conflicts_with = "prefix")]
pub target: Option<PathBuf>, pub target: Option<PathBuf>,
/// Install packages into `lib`, `bin`, and other top-level folders under the specified /// Install packages into `lib`, `bin`, and other top-level folders under the specified
/// directory, as if a virtual environment were created at the specified location. /// directory, as if a virtual environment were present at that location.
/// ///
/// In general, prefer the use of `--python` to install into an alternate environment, as /// In general, prefer the use of `--python` to install into an alternate environment, as
/// scripts and other artifacts installed via `--prefix` will reference the installing /// scripts and other artifacts installed via `--prefix` will reference the installing
@ -1222,7 +1232,7 @@ pub struct PipInstallArgs {
#[arg(long)] #[arg(long)]
pub python_platform: Option<TargetTriple>, pub python_platform: Option<TargetTriple>,
/// Validate the virtual environment after completing the installation, to detect packages with /// Validate the Python environment after completing the installation, to detect and with
/// missing dependencies or other issues. /// missing dependencies or other issues.
#[arg(long, overrides_with("no_strict"))] #[arg(long, overrides_with("no_strict"))]
pub strict: bool, pub strict: bool,
@ -1330,7 +1340,7 @@ pub struct PipFreezeArgs {
#[arg(long)] #[arg(long)]
pub exclude_editable: bool, pub exclude_editable: bool,
/// Validate the virtual environment, to detect packages with missing dependencies or other /// Validate the Python environment, to detect packages with missing dependencies and other
/// issues. /// issues.
#[arg(long, overrides_with("no_strict"))] #[arg(long, overrides_with("no_strict"))]
pub strict: bool, pub strict: bool,
@ -1395,7 +1405,7 @@ pub struct PipListArgs {
#[arg(long, value_enum, default_value_t = ListFormat::default())] #[arg(long, value_enum, default_value_t = ListFormat::default())]
pub format: ListFormat, pub format: ListFormat,
/// Validate the virtual environment, to detect packages with missing dependencies or other /// Validate the Python environment, to detect packages with missing dependencies and other
/// issues. /// issues.
#[arg(long, overrides_with("no_strict"))] #[arg(long, overrides_with("no_strict"))]
pub strict: bool, pub strict: bool,
@ -1485,7 +1495,7 @@ pub struct PipShowArgs {
/// The package(s) to display. /// The package(s) to display.
pub package: Vec<PackageName>, pub package: Vec<PackageName>,
/// Validate the virtual environment, to detect packages with missing dependencies or other /// Validate the Python environment, to detect packages with missing dependencies and other
/// issues. /// issues.
#[arg(long, overrides_with("no_strict"))] #[arg(long, overrides_with("no_strict"))]
pub strict: bool, pub strict: bool,
@ -1537,7 +1547,7 @@ pub struct PipTreeArgs {
#[command(flatten)] #[command(flatten)]
pub tree: DisplayTreeArgs, pub tree: DisplayTreeArgs,
/// Validate the virtual environment, to detect packages with missing dependencies or other /// Validate the Python environment, to detect packages with missing dependencies and other
/// issues. /// issues.
#[arg(long, overrides_with("no_strict"))] #[arg(long, overrides_with("no_strict"))]
pub strict: bool, pub strict: bool,
@ -1732,11 +1742,13 @@ impl ExternalCommand {
#[allow(clippy::struct_excessive_bools)] #[allow(clippy::struct_excessive_bools)]
pub struct RunArgs { pub struct RunArgs {
/// Include optional dependencies from the extra group name; may be provided more than once. /// Include optional dependencies from the extra group name; may be provided more than once.
///
/// Only applies to `pyproject.toml`, `setup.py`, and `setup.cfg` sources. /// Only applies to `pyproject.toml`, `setup.py`, and `setup.cfg` sources.
#[arg(long, conflicts_with = "all_extras", value_parser = extra_name_with_clap_error)] #[arg(long, conflicts_with = "all_extras", value_parser = extra_name_with_clap_error)]
pub extra: Option<Vec<ExtraName>>, pub extra: Option<Vec<ExtraName>>,
/// Include all optional dependencies. /// Include all optional dependencies.
///
/// Only applies to `pyproject.toml`, `setup.py`, and `setup.cfg` sources. /// Only applies to `pyproject.toml`, `setup.py`, and `setup.cfg` sources.
#[arg(long, conflicts_with = "extra")] #[arg(long, conflicts_with = "extra")]
pub all_extras: bool, pub all_extras: bool,
@ -1800,11 +1812,13 @@ pub struct SyncArgs {
pub frozen: bool, pub frozen: bool,
/// Include optional dependencies from the extra group name; may be provided more than once. /// Include optional dependencies from the extra group name; may be provided more than once.
///
/// Only applies to `pyproject.toml`, `setup.py`, and `setup.cfg` sources. /// Only applies to `pyproject.toml`, `setup.py`, and `setup.cfg` sources.
#[arg(long, conflicts_with = "all_extras", value_parser = extra_name_with_clap_error)] #[arg(long, conflicts_with = "all_extras", value_parser = extra_name_with_clap_error)]
pub extra: Option<Vec<ExtraName>>, pub extra: Option<Vec<ExtraName>>,
/// Include all optional dependencies. /// Include all optional dependencies.
///
/// Only applies to `pyproject.toml`, `setup.py`, and `setup.cfg` sources. /// Only applies to `pyproject.toml`, `setup.py`, and `setup.cfg` sources.
#[arg(long, conflicts_with = "extra")] #[arg(long, conflicts_with = "extra")]
pub all_extras: bool, pub all_extras: bool,
@ -2401,15 +2415,16 @@ pub struct InstallerArgs {
#[arg(long, value_enum, env = "UV_LINK_MODE")] #[arg(long, value_enum, env = "UV_LINK_MODE")]
pub link_mode: Option<install_wheel_rs::linker::LinkMode>, pub link_mode: Option<install_wheel_rs::linker::LinkMode>,
/// Compile Python files to bytecode. /// Compile Python files to bytecode after installation.
/// ///
/// By default, does not compile Python (`.py`) files to bytecode (`__pycache__/*.pyc`), instead /// By default, uv does not compile Python (`.py`) files to bytecode (`__pycache__/*.pyc`);
/// Python lazily does the compilation the first time a module is imported. In cases where the /// instead, compilation is performed lazily the first time a module is imported. For use-cases
/// first start time matters, such as CLI applications and docker containers, this option can /// in which start time is critical, such as CLI applications and Docker containers, this option
/// trade longer install time for faster startup. /// can be enabled to trade longer installation times for faster start times.
/// ///
/// The compile option will process the entire site-packages directory for consistency and /// When enabled, uv will process the entire site-packages directory (including packages that
/// (like pip) ignore all errors. /// are not being modified by the current operation) for consistency. Like pip, it will also
/// ignore errors.
#[arg(long, alias = "compile", overrides_with("no_compile_bytecode"))] #[arg(long, alias = "compile", overrides_with("no_compile_bytecode"))]
pub compile_bytecode: bool, pub compile_bytecode: bool,
@ -2582,15 +2597,16 @@ pub struct ResolverInstallerArgs {
#[arg(long, value_enum, env = "UV_LINK_MODE")] #[arg(long, value_enum, env = "UV_LINK_MODE")]
pub link_mode: Option<install_wheel_rs::linker::LinkMode>, pub link_mode: Option<install_wheel_rs::linker::LinkMode>,
/// Compile Python files to bytecode. /// Compile Python files to bytecode after installation.
/// ///
/// By default, does not compile Python (`.py`) files to bytecode (`__pycache__/*.pyc`), instead /// By default, uv does not compile Python (`.py`) files to bytecode (`__pycache__/*.pyc`);
/// Python lazily does the compilation the first time a module is imported. In cases where the /// instead, compilation is performed lazily the first time a module is imported. For use-cases
/// first start time matters, such as CLI applications and docker containers, this option can /// in which start time is critical, such as CLI applications and Docker containers, this option
/// trade longer install time for faster startup. /// can be enabled to trade longer installation times for faster start times.
/// ///
/// The compile option will process the entire site-packages directory for consistency and /// When enabled, uv will process the entire site-packages directory (including packages that
/// (like pip) ignore all errors. /// are not being modified by the current operation) for consistency. Like pip, it will also
/// ignore errors.
#[arg(long, alias = "compile", overrides_with("no_compile_bytecode"))] #[arg(long, alias = "compile", overrides_with("no_compile_bytecode"))]
pub compile_bytecode: bool, pub compile_bytecode: bool,

View file

@ -341,13 +341,14 @@ pub struct ResolverInstallerOptions {
pub link_mode: Option<LinkMode>, pub link_mode: Option<LinkMode>,
/// Compile Python files to bytecode after installation. /// Compile Python files to bytecode after installation.
/// ///
/// By default, does not compile Python (`.py`) files to bytecode (`__pycache__/*.pyc`), instead /// By default, uv does not compile Python (`.py`) files to bytecode (`__pycache__/*.pyc`);
/// Python lazily does the compilation the first time a module is imported. In cases where the /// instead, compilation is performed lazily the first time a module is imported. For use-cases
/// first start time matters, such as CLI applications and docker containers, this option can /// in which start time is critical, such as CLI applications and Docker containers, this option
/// trade longer install time for faster startup. /// can be enabled to trade longer installation times for faster start times.
/// ///
/// The compile option will process the entire site-packages directory for consistency and /// When enabled, uv will process the entire site-packages directory (including packages that
/// (like pip) ignore all errors. /// are not being modified by the current operation) for consistency. Like pip, it will also
/// ignore errors.
#[option( #[option(
default = "false", default = "false",
value_type = "bool", value_type = "bool",
@ -449,31 +450,352 @@ pub struct ResolverInstallerOptions {
#[serde(deny_unknown_fields, rename_all = "kebab-case")] #[serde(deny_unknown_fields, rename_all = "kebab-case")]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
pub struct PipOptions { pub struct PipOptions {
/// The Python interpreter into which packages should be installed.
///
/// By default, uv installs into the virtual environment in the current working directory or
/// any parent directory. The `--python` option allows you to specify a different interpreter,
/// which is intended for use in continuous integration (CI) environments or other automated
/// workflows.
///
/// Supported formats:
/// - `3.10` looks for an installed Python 3.10 using `py --list-paths` on Windows, or
/// `python3.10` on Linux and macOS.
/// - `python3.10` or `python.exe` looks for a binary with the given name in `PATH`.
/// - `/home/ferris/.local/bin/python3.10` uses the exact Python at the given path.
#[option(
default = "None",
value_type = "str",
example = r#"
python = "3.10"
"#
)]
pub python: Option<String>, pub python: Option<String>,
/// Install packages into the system Python environment.
///
/// By default, uv installs into the virtual environment in the current working directory or
/// any parent directory. The `--system` option instructs uv to instead use the first Python
/// found in the system `PATH`.
///
/// WARNING: `--system` is intended for use in continuous integration (CI) environments and
/// should be used with caution, as it can modify the system Python installation.
#[option(
default = "false",
value_type = "bool",
example = r#"
system = true
"#
)]
pub system: Option<bool>, pub system: Option<bool>,
/// Allow uv to modify an `EXTERNALLY-MANAGED` Python installation.
///
/// WARNING: `--break-system-packages` is intended for use in continuous integration (CI)
/// environments, when installing into Python installations that are managed by an external
/// package manager, like `apt`. It should be used with caution, as such Python installations
/// explicitly recommend against modifications by other package managers (like uv or pip).
#[option(
default = "false",
value_type = "bool",
example = r#"
break-system-packages = true
"#
)]
pub break_system_packages: Option<bool>, pub break_system_packages: Option<bool>,
/// Install packages into the specified directory, rather than into the virtual or system Python
/// environment. The packages will be installed at the top-level of the directory.
#[option(
default = "None",
value_type = "str",
example = r#"
target = "./target"
"#
)]
pub target: Option<PathBuf>, pub target: Option<PathBuf>,
/// Install packages into `lib`, `bin`, and other top-level folders under the specified
/// directory, as if a virtual environment were present at that location.
///
/// In general, prefer the use of `--python` to install into an alternate environment, as
/// scripts and other artifacts installed via `--prefix` will reference the installing
/// interpreter, rather than any interpreter added to the `--prefix` directory, rendering them
/// non-portable.
#[option(
default = "None",
value_type = "str",
example = r#"
prefix = "./prefix"
"#
)]
pub prefix: Option<PathBuf>, pub prefix: Option<PathBuf>,
/// The URL of the Python package index (by default: <https://pypi.org/simple>).
///
/// Accepts either a repository compliant with PEP 503 (the simple repository API), or a local
/// directory laid out in the same format.
///
/// The index provided by this setting is given lower priority than any indexes specified via
/// [`extra_index_url`](#extra-index-url).
#[option(
default = "\"https://pypi.org/simple\"",
value_type = "str",
example = r#"
index-url = "https://pypi.org/simple"
"#
)]
pub index_url: Option<IndexUrl>, pub index_url: Option<IndexUrl>,
/// Extra URLs of package indexes to use, in addition to `--index-url`.
///
/// Accepts either a repository compliant with PEP 503 (the simple repository API), or a local
/// directory laid out in the same format.
///
/// All indexes provided via this flag take priority over the index specified by
/// [`index_url`](#index-url). When multiple indexes are provided, earlier values take priority.
///
/// To control uv's resolution strategy when multiple indexes are present, see
/// [`index_strategy`](#index-strategy).
#[option(
default = "[]",
value_type = "list[str]",
example = r#"
extra-index-url = ["https://download.pytorch.org/whl/cpu"]
"#
)]
pub extra_index_url: Option<Vec<IndexUrl>>, pub extra_index_url: Option<Vec<IndexUrl>>,
/// Ignore all registry indexes (e.g., PyPI), instead relying on direct URL dependencies and
/// those provided via `--find-links`.
#[option(
default = "false",
value_type = "bool",
example = r#"
no-index = true
"#
)]
pub no_index: Option<bool>, pub no_index: Option<bool>,
/// Locations to search for candidate distributions, in addition to those found in the registry
/// indexes.
///
/// If a path, the target must be a directory that contains packages as wheel files (`.whl`) or
/// source distributions (`.tar.gz` or `.zip`) at the top level.
///
/// If a URL, the page must contain a flat list of links to package files adhering to the
/// formats described above.
#[option(
default = "[]",
value_type = "list[str]",
example = r#"
find-links = ["https://download.pytorch.org/whl/torch_stable.html"]
"#
)]
pub find_links: Option<Vec<FlatIndexLocation>>, pub find_links: Option<Vec<FlatIndexLocation>>,
/// The strategy to use when resolving against multiple index URLs.
///
/// By default, uv will stop at the first index on which a given package is available, and
/// limit resolutions to those present on that first index (`first-match`). This prevents
/// "dependency confusion" attacks, whereby an attack can upload a malicious package under the
/// same name to a secondary.
///
/// Possible values:
///
/// - `"first-index"`: Only use results from the first index that returns a match for a given package name.
/// - `"unsafe-first-match"`: Search for every package name across all indexes, exhausting the versions from the first index before moving on to the next.
/// - `"unsafe-best-match"`: Search for every package name across all indexes, preferring the "best" version found. If a package version is in multiple indexes, only look at the entry for the first index.
#[option(
default = "\"first-index\"",
value_type = "str",
example = r#"
index-strategy = "unsafe-best-match"
"#
)]
pub index_strategy: Option<IndexStrategy>, pub index_strategy: Option<IndexStrategy>,
/// Attempt to use `keyring` for authentication for index URLs.
///
/// At present, only `--keyring-provider subprocess` is supported, which configures uv to
/// use the `keyring` CLI to handle authentication.
#[option(
default = "disabled",
value_type = "str",
example = r#"
keyring-provider = "subprocess"
"#
)]
pub keyring_provider: Option<KeyringProviderType>, pub keyring_provider: Option<KeyringProviderType>,
/// Don't build source distributions.
///
/// When enabled, resolving will not run arbitrary Python code. The cached wheels of
/// already-built source distributions will be reused, but operations that require building
/// distributions will exit with an error.
///
/// Alias for `--only-binary :all:`.
#[option(
default = "false",
value_type = "bool",
example = r#"
no-build = true
"#
)]
pub no_build: Option<bool>, pub no_build: Option<bool>,
/// Don't install pre-built wheels.
///
/// The given packages will be built and installed from source. The resolver will still use
/// pre-built wheels to extract package metadata, if available.
///
/// Multiple packages may be provided. Disable binaries for all packages with `:all:`.
/// Clear previously specified packages with `:none:`.
#[option(
default = "[]",
value_type = "list[str]",
example = r#"
no-binary = ["ruff"]
"#
)]
pub no_binary: Option<Vec<PackageNameSpecifier>>, pub no_binary: Option<Vec<PackageNameSpecifier>>,
/// 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.
///
/// Multiple packages may be provided. Disable binaries for all packages with `:all:`.
/// Clear previously specified packages with `:none:`.
#[option(
default = "[]",
value_type = "list[str]",
example = r#"
only-binary = ["ruff"]
"#
)]
pub only_binary: Option<Vec<PackageNameSpecifier>>, pub only_binary: Option<Vec<PackageNameSpecifier>>,
/// Disable isolation when building source distributions.
///
/// Assumes that build dependencies specified by PEP 518 are already installed.
#[option(
default = "false",
value_type = "bool",
example = r#"
no-build-isolation = true
"#
)]
pub no_build_isolation: Option<bool>, pub no_build_isolation: Option<bool>,
/// Validate the Python environment, to detect packages with missing dependencies and other
/// issues.
#[option(
default = "false",
value_type = "bool",
example = r#"
strict = true
"#
)]
pub strict: Option<bool>, pub strict: Option<bool>,
/// Include optional dependencies from the extra group name; may be provided more than once.
///
/// Only applies to `pyproject.toml`, `setup.py`, and `setup.cfg` sources.
#[option(
default = "[]",
value_type = "list[str]",
example = r#"
extra = ["dev", "docs"]
"#
)]
pub extra: Option<Vec<ExtraName>>, pub extra: Option<Vec<ExtraName>>,
/// Include all optional dependencies.
///
/// Only applies to `pyproject.toml`, `setup.py`, and `setup.cfg` sources.
#[option(
default = "false",
value_type = "bool",
example = r#"
all-extras = true
"#
)]
pub all_extras: Option<bool>, pub all_extras: Option<bool>,
/// Ignore package dependencies, instead only add those packages explicitly listed
/// on the command line to the resulting the requirements file.
#[option(
default = "false",
value_type = "bool",
example = r#"
no-deps = true
"#
)]
pub no_deps: Option<bool>, pub no_deps: Option<bool>,
/// Allow `uv pip sync` with empty requirements, which will clear the environment of all
/// packages.
#[option(
default = "false",
value_type = "bool",
example = r#"
allow-empty-requirements = true
"#
)]
pub allow_empty_requirements: Option<bool>, pub allow_empty_requirements: Option<bool>,
/// The strategy to use when selecting between the different compatible versions for a given
/// package requirement.
///
/// By default, uv will use the latest compatible version of each package (`highest`).
#[option(
default = "\"highest\"",
value_type = "str",
example = r#"
resolution = "lowest-direct"
"#
)]
pub resolution: Option<ResolutionMode>, pub resolution: Option<ResolutionMode>,
/// 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 (`if-necessary-or-explicit`).
#[option(
default = "\"if-necessary-or-explicit\"",
value_type = "str",
example = r#"
prerelease = "allow"
"#
)]
pub prerelease: Option<PreReleaseMode>, pub prerelease: Option<PreReleaseMode>,
/// Write the requirements generated by `uv pip compile` to the given `requirements.txt` file.
///
/// If the file already exists, the existing versions will be preferred when resolving
/// dependencies, unless `--upgrade` is also specified.
#[option(
default = "None",
value_type = "str",
example = r#"
output-file = "requirements.txt"
"#
)]
pub output_file: Option<PathBuf>, pub output_file: Option<PathBuf>,
/// Include extras in the output file.
///
/// By default, uv strips extras, as any packages pulled in by the extras are already included
/// as dependencies in the output file directly. Further, output files generated with
/// `--no-strip-extras` cannot be used as constraints files in `install` and `sync` invocations.
#[option(
default = "false",
value_type = "bool",
example = r#"
no-strip-extras = true
"#
)]
pub no_strip_extras: Option<bool>, pub no_strip_extras: Option<bool>,
/// Include environment markers in the output file generated by `uv pip compile`.
///
/// By default, uv strips environment markers, as the resolution generated by `compile` is
/// only guaranteed to be correct for the target environment.
#[option(
default = "false",
value_type = "bool",
example = r#"
no-strip-markers = true
"#
)]
pub no_strip_markers: Option<bool>, pub no_strip_markers: Option<bool>,
/// Exclude comment annotations indicating the source of each package from the output file
/// generated by `uv pip compile`.
#[option(
default = "false",
value_type = "bool",
example = r#"
no-annotate = true
"#
)]
pub no_annotate: Option<bool>, pub no_annotate: Option<bool>,
/// Exclude the comment header at the top of output file generated by `uv pip compile`. /// Exclude the comment header at the top of output file generated by `uv pip compile`.
#[option( #[option(
@ -484,29 +806,289 @@ pub struct PipOptions {
"# "#
)] )]
pub no_header: Option<bool>, pub no_header: Option<bool>,
/// The header comment to include at the top of the output file generated by `uv pip compile`.
///
/// Used to reflect custom build scripts and commands that wrap `uv pip compile`.
#[option(
default = "None",
value_type = "str",
example = r#"
custom-compile-command = "./custom-uv-compile.sh"
"#
)]
pub custom_compile_command: Option<String>, pub custom_compile_command: Option<String>,
/// Include distribution hashes in the output file.
#[option(
default = "false",
value_type = "bool",
example = r#"
generate-hashes = true
"#
)]
pub generate_hashes: Option<bool>, pub generate_hashes: Option<bool>,
/// Use legacy `setuptools` behavior when building source distributions without a
/// `pyproject.toml`.
#[option(
default = "None",
value_type = "bool",
example = r#"
legacy-setup-py = true
"#
)]
pub legacy_setup_py: Option<bool>, pub legacy_setup_py: Option<bool>,
/// Settings to pass to the PEP 517 build backend, specified as `KEY=VALUE` pairs.
#[option(
default = "{}",
value_type = "dict",
example = r#"
config-settings = { "editable_mode": "compat" }
"#
)]
pub config_settings: Option<ConfigSettings>, pub config_settings: Option<ConfigSettings>,
/// The minimum Python version that should be supported by the resolved requirements (e.g.,
/// `3.8` or `3.8.17`).
///
/// If a patch version is omitted, the minimum patch version is assumed. For example, `3.8` is
/// mapped to `3.8.0`.
#[option(
default = "None",
value_type = "str",
example = r#"
python-version = "3.8"
"#
)]
pub python_version: Option<PythonVersion>, pub python_version: Option<PythonVersion>,
/// The platform for which requirements should be resolved.
///
/// Represented as a "target triple", a string that describes the target platform in terms of
/// its CPU, vendor, and operating system name, like `x86_64-unknown-linux-gnu` or
/// `aaarch64-apple-darwin`.
#[option(
default = "None",
value_type = "str",
example = r#"
python-platform = "x86_64-unknown-linux-gnu"
"#
)]
pub python_platform: Option<TargetTriple>, pub python_platform: Option<TargetTriple>,
/// Perform a universal resolution, attempting to generate a single `requirements.txt` output
/// file that is compatible with all operating systems, architectures, and Python
/// implementations.
///
/// In universal mode, the current Python version (or user-provided `--python-version`) will be
/// treated as a lower bound. For example, `--universal --python-version 3.7` would produce a
/// universal resolution for Python 3.7 and later.
#[option(
default = "None",
value_type = "bool",
example = r#"
universal = true
"#
)]
pub universal: Option<bool>, pub universal: Option<bool>,
/// Limit candidate packages to those that were uploaded prior to the given date.
///
/// Accepts both RFC 3339 timestamps (e.g., `2006-12-02T02:07:43Z`) and UTC dates in the same
/// format (e.g., `2006-12-02`).
#[option(
default = "None",
value_type = "str",
example = r#"
exclude-newer = "2006-12-02"
"#
)]
pub exclude_newer: Option<ExcludeNewer>, pub exclude_newer: Option<ExcludeNewer>,
/// Specify a package to omit from the output resolution. Its dependencies will still be
/// included in the resolution. Equivalent to pip-compile's `--unsafe-package` option.
#[option(
default = "[]",
value_type = "list[str]",
example = r#"
no-emit-package = ["ruff"]
"#
)]
pub no_emit_package: Option<Vec<PackageName>>, pub no_emit_package: Option<Vec<PackageName>>,
/// Include `--index-url` and `--extra-index-url` entries in the output file generated by `uv pip compile`.
#[option(
default = "false",
value_type = "bool",
example = r#"
emit-index-url = true
"#
)]
pub emit_index_url: Option<bool>, pub emit_index_url: Option<bool>,
/// Include `--find-links` entries in the output file generated by `uv pip compile`.
#[option(
default = "false",
value_type = "bool",
example = r#"
emit-find-links = true
"#
)]
pub emit_find_links: Option<bool>, pub emit_find_links: Option<bool>,
/// Include `--no-binary` and `--only-binary` entries in the output file generated by `uv pip compile`.
#[option(
default = "false",
value_type = "bool",
example = r#"
emit-binary = true
"#
)]
pub emit_build_options: Option<bool>, pub emit_build_options: Option<bool>,
/// Whether to emit a marker string indicating the conditions under which the set of pinned
/// dependencies is valid.
///
/// The pinned dependencies may be valid even when the marker expression is
/// false, but when the expression is true, the requirements are known to
/// be correct.
#[option(
default = "false",
value_type = "bool",
example = r#"
emit-marker-expression = true
"#
)]
pub emit_marker_expression: Option<bool>, pub emit_marker_expression: Option<bool>,
/// Include comment annotations indicating the index used to resolve each package (e.g.,
/// `# from https://pypi.org/simple`).
#[option(
default = "false",
value_type = "bool",
example = r#"
emit-index-annotation = true
"#
)]
pub emit_index_annotation: Option<bool>, pub emit_index_annotation: Option<bool>,
/// The style of the annotation comments included in the output file, used to indicate the
/// source of each package.
#[option(
default = "\"split\"",
value_type = "str",
example = r#"
annotation-style = "line"
"#
)]
pub annotation_style: Option<AnnotationStyle>, pub annotation_style: Option<AnnotationStyle>,
/// The method to use when installing packages from the global cache.
///
/// Defaults to `clone` (also known as Copy-on-Write) on macOS, and `hardlink` on Linux and
/// Windows.
#[option(
default = "\"clone\" (macOS) or \"hardlink\" (Linux, Windows)",
value_type = "str",
example = r#"
link-mode = "copy"
"#
)]
pub link_mode: Option<LinkMode>, pub link_mode: Option<LinkMode>,
/// Compile Python files to bytecode after installation.
///
/// By default, uv does not compile Python (`.py`) files to bytecode (`__pycache__/*.pyc`);
/// instead, compilation is performed lazily the first time a module is imported. For use-cases
/// in which start time is critical, such as CLI applications and Docker containers, this option
/// can be enabled to trade longer installation times for faster start times.
///
/// When enabled, uv will process the entire site-packages directory (including packages that
/// are not being modified by the current operation) for consistency. Like pip, it will also
/// ignore errors.
#[option(
default = "false",
value_type = "bool",
example = r#"
compile-bytecode = true
"#
)]
pub compile_bytecode: Option<bool>, pub compile_bytecode: Option<bool>,
/// Require a matching hash for each requirement.
///
/// Hash-checking mode is all or nothing. If enabled, _all_ requirements must be provided
/// with a corresponding hash or set of hashes. Additionally, if enabled, _all_ requirements
/// must either be pinned to exact versions (e.g., `==1.0.0`), or be specified via direct URL.
///
/// Hash-checking mode introduces a number of additional constraints:
///
/// - Git dependencies are not supported.
/// - Editable installs are not supported.
/// - Local dependencies are not supported, unless they point to a specific wheel (`.whl`) or
/// source archive (`.zip`, `.tar.gz`), as opposed to a directory.
#[option(
default = "false",
value_type = "bool",
example = r#"
require-hashes = true
"#
)]
pub require_hashes: Option<bool>, pub require_hashes: Option<bool>,
/// Allow package upgrades, ignoring pinned versions in any existing output file.
#[option(
default = "false",
value_type = "bool",
example = r#"
upgrade = true
"#
)]
pub upgrade: Option<bool>, pub upgrade: Option<bool>,
/// Allow upgrades for a specific package, ignoring pinned versions in any existing output
/// file.
///
/// Accepts both standalone package names (`ruff`) and version specifiers (`ruff<0.5.0`).
#[option(
default = "[]",
value_type = "list[str]",
example = r#"
upgrade-package = ["ruff"]
"#
)]
pub upgrade_package: Option<Vec<Requirement<VerbatimParsedUrl>>>, pub upgrade_package: Option<Vec<Requirement<VerbatimParsedUrl>>>,
/// Reinstall all packages, regardless of whether they're already installed.
#[option(
default = "false",
value_type = "bool",
example = r#"
reinstall = true
"#
)]
pub reinstall: Option<bool>, pub reinstall: Option<bool>,
/// Reinstall a specific package, regardless of whether it's already installed.
#[option(
default = "[]",
value_type = "list[str]",
example = r#"
reinstall-package = ["ruff"]
"#
)]
pub reinstall_package: Option<Vec<PackageName>>, pub reinstall_package: Option<Vec<PackageName>>,
/// The maximum number of in-flight concurrent downloads that uv will perform at any given
/// time.
#[option(
default = "50",
value_type = "int",
example = r#"
concurrent-downloads = 4
"#
)]
pub concurrent_downloads: Option<NonZeroUsize>, pub concurrent_downloads: Option<NonZeroUsize>,
/// The maximum number of source distributions that uv will build concurrently at any given
/// time.
///
/// Defaults to the number of available CPU cores.
#[option(
default = "None",
value_type = "int",
example = r#"
concurrent-builds = 4
"#
)]
pub concurrent_builds: Option<NonZeroUsize>, pub concurrent_builds: Option<NonZeroUsize>,
/// The number of threads used when installing and unzipping packages.
///
/// Defaults to the number of available CPU cores.
#[option(
default = "None",
value_type = "int",
example = r#"
concurrent-installs = 4
"#
)]
pub concurrent_installs: Option<NonZeroUsize>, pub concurrent_installs: Option<NonZeroUsize>,
} }

File diff suppressed because it is too large Load diff

53
uv.schema.json generated
View file

@ -12,7 +12,7 @@
] ]
}, },
"compile-bytecode": { "compile-bytecode": {
"description": "Compile Python files to bytecode after installation.\n\nBy default, does not compile Python (`.py`) files to bytecode (`__pycache__/*.pyc`), instead Python lazily does the compilation the first time a module is imported. In cases where the first start time matters, such as CLI applications and docker containers, this option can trade longer install time for faster startup.\n\nThe compile option will process the entire site-packages directory for consistency and (like pip) ignore all errors.", "description": "Compile Python files to bytecode after installation.\n\nBy default, uv does not compile Python (`.py`) files to bytecode (`__pycache__/*.pyc`); instead, compilation is performed lazily the first time a module is imported. For use-cases in which start time is critical, such as CLI applications and Docker containers, this option can be enabled to trade longer installation times for faster start times.\n\nWhen enabled, uv will process the entire site-packages directory (including packages that are not being modified by the current operation) for consistency. Like pip, it will also ignore errors.",
"type": [ "type": [
"boolean", "boolean",
"null" "null"
@ -471,18 +471,21 @@
"type": "object", "type": "object",
"properties": { "properties": {
"all-extras": { "all-extras": {
"description": "Include all optional dependencies.\n\nOnly applies to `pyproject.toml`, `setup.py`, and `setup.cfg` sources.",
"type": [ "type": [
"boolean", "boolean",
"null" "null"
] ]
}, },
"allow-empty-requirements": { "allow-empty-requirements": {
"description": "Allow `uv pip sync` with empty requirements, which will clear the environment of all packages.",
"type": [ "type": [
"boolean", "boolean",
"null" "null"
] ]
}, },
"annotation-style": { "annotation-style": {
"description": "The style of the annotation comments included in the output file, used to indicate the source of each package.",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/AnnotationStyle" "$ref": "#/definitions/AnnotationStyle"
@ -493,18 +496,21 @@
] ]
}, },
"break-system-packages": { "break-system-packages": {
"description": "Allow uv to modify an `EXTERNALLY-MANAGED` Python installation.\n\nWARNING: `--break-system-packages` is intended for use in continuous integration (CI) environments, when installing into Python installations that are managed by an external package manager, like `apt`. It should be used with caution, as such Python installations explicitly recommend against modifications by other package managers (like uv or pip).",
"type": [ "type": [
"boolean", "boolean",
"null" "null"
] ]
}, },
"compile-bytecode": { "compile-bytecode": {
"description": "Compile Python files to bytecode after installation.\n\nBy default, uv does not compile Python (`.py`) files to bytecode (`__pycache__/*.pyc`); instead, compilation is performed lazily the first time a module is imported. For use-cases in which start time is critical, such as CLI applications and Docker containers, this option can be enabled to trade longer installation times for faster start times.\n\nWhen enabled, uv will process the entire site-packages directory (including packages that are not being modified by the current operation) for consistency. Like pip, it will also ignore errors.",
"type": [ "type": [
"boolean", "boolean",
"null" "null"
] ]
}, },
"concurrent-builds": { "concurrent-builds": {
"description": "The maximum number of source distributions that uv will build concurrently at any given time.\n\nDefaults to the number of available CPU cores.",
"type": [ "type": [
"integer", "integer",
"null" "null"
@ -513,6 +519,7 @@
"minimum": 1.0 "minimum": 1.0
}, },
"concurrent-downloads": { "concurrent-downloads": {
"description": "The maximum number of in-flight concurrent downloads that uv will perform at any given time.",
"type": [ "type": [
"integer", "integer",
"null" "null"
@ -521,6 +528,7 @@
"minimum": 1.0 "minimum": 1.0
}, },
"concurrent-installs": { "concurrent-installs": {
"description": "The number of threads used when installing and unzipping packages.\n\nDefaults to the number of available CPU cores.",
"type": [ "type": [
"integer", "integer",
"null" "null"
@ -529,6 +537,7 @@
"minimum": 1.0 "minimum": 1.0
}, },
"config-settings": { "config-settings": {
"description": "Settings to pass to the PEP 517 build backend, specified as `KEY=VALUE` pairs.",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/ConfigSettings" "$ref": "#/definitions/ConfigSettings"
@ -539,42 +548,49 @@
] ]
}, },
"custom-compile-command": { "custom-compile-command": {
"description": "The header comment to include at the top of the output file generated by `uv pip compile`.\n\nUsed to reflect custom build scripts and commands that wrap `uv pip compile`.",
"type": [ "type": [
"string", "string",
"null" "null"
] ]
}, },
"emit-build-options": { "emit-build-options": {
"description": "Include `--no-binary` and `--only-binary` entries in the output file generated by `uv pip compile`.",
"type": [ "type": [
"boolean", "boolean",
"null" "null"
] ]
}, },
"emit-find-links": { "emit-find-links": {
"description": "Include `--find-links` entries in the output file generated by `uv pip compile`.",
"type": [ "type": [
"boolean", "boolean",
"null" "null"
] ]
}, },
"emit-index-annotation": { "emit-index-annotation": {
"description": "Include comment annotations indicating the index used to resolve each package (e.g., `# from https://pypi.org/simple`).",
"type": [ "type": [
"boolean", "boolean",
"null" "null"
] ]
}, },
"emit-index-url": { "emit-index-url": {
"description": "Include `--index-url` and `--extra-index-url` entries in the output file generated by `uv pip compile`.",
"type": [ "type": [
"boolean", "boolean",
"null" "null"
] ]
}, },
"emit-marker-expression": { "emit-marker-expression": {
"description": "Whether to emit a marker string indicating the conditions under which the set of pinned dependencies is valid.\n\nThe pinned dependencies may be valid even when the marker expression is false, but when the expression is true, the requirements are known to be correct.",
"type": [ "type": [
"boolean", "boolean",
"null" "null"
] ]
}, },
"exclude-newer": { "exclude-newer": {
"description": "Limit candidate packages to those that were uploaded prior to the given date.\n\nAccepts both RFC 3339 timestamps (e.g., `2006-12-02T02:07:43Z`) and UTC dates in the same format (e.g., `2006-12-02`).",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/ExcludeNewer" "$ref": "#/definitions/ExcludeNewer"
@ -585,6 +601,7 @@
] ]
}, },
"extra": { "extra": {
"description": "Include optional dependencies from the extra group name; may be provided more than once.\n\nOnly applies to `pyproject.toml`, `setup.py`, and `setup.cfg` sources.",
"type": [ "type": [
"array", "array",
"null" "null"
@ -594,6 +611,7 @@
} }
}, },
"extra-index-url": { "extra-index-url": {
"description": "Extra URLs of package indexes to use, in addition to `--index-url`.\n\nAccepts either a repository compliant with PEP 503 (the simple repository API), or a local directory laid out in the same format.\n\nAll indexes provided via this flag take priority over the index specified by [`index_url`](#index-url). When multiple indexes are provided, earlier values take priority.\n\nTo control uv's resolution strategy when multiple indexes are present, see [`index_strategy`](#index-strategy).",
"type": [ "type": [
"array", "array",
"null" "null"
@ -603,6 +621,7 @@
} }
}, },
"find-links": { "find-links": {
"description": "Locations to search for candidate distributions, in addition to those found in the registry indexes.\n\nIf a path, the target must be a directory that contains packages as wheel files (`.whl`) or source distributions (`.tar.gz` or `.zip`) at the top level.\n\nIf a URL, the page must contain a flat list of links to package files adhering to the formats described above.",
"type": [ "type": [
"array", "array",
"null" "null"
@ -612,12 +631,14 @@
} }
}, },
"generate-hashes": { "generate-hashes": {
"description": "Include distribution hashes in the output file.",
"type": [ "type": [
"boolean", "boolean",
"null" "null"
] ]
}, },
"index-strategy": { "index-strategy": {
"description": "The strategy to use when resolving against multiple index URLs.\n\nBy default, uv will stop at the first index on which a given package is available, and limit resolutions to those present on that first index (`first-match`). This prevents \"dependency confusion\" attacks, whereby an attack can upload a malicious package under the same name to a secondary.\n\nPossible values:\n\n- `\"first-index\"`: Only use results from the first index that returns a match for a given package name. - `\"unsafe-first-match\"`: Search for every package name across all indexes, exhausting the versions from the first index before moving on to the next. - `\"unsafe-best-match\"`: Search for every package name across all indexes, preferring the \"best\" version found. If a package version is in multiple indexes, only look at the entry for the first index.",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/IndexStrategy" "$ref": "#/definitions/IndexStrategy"
@ -628,6 +649,7 @@
] ]
}, },
"index-url": { "index-url": {
"description": "The URL of the Python package index (by default: <https://pypi.org/simple>).\n\nAccepts either a repository compliant with PEP 503 (the simple repository API), or a local directory laid out in the same format.\n\nThe index provided by this setting is given lower priority than any indexes specified via [`extra_index_url`](#extra-index-url).",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/IndexUrl" "$ref": "#/definitions/IndexUrl"
@ -638,6 +660,7 @@
] ]
}, },
"keyring-provider": { "keyring-provider": {
"description": "Attempt to use `keyring` for authentication for index URLs.\n\nAt present, only `--keyring-provider subprocess` is supported, which configures uv to use the `keyring` CLI to handle authentication.",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/KeyringProviderType" "$ref": "#/definitions/KeyringProviderType"
@ -648,12 +671,14 @@
] ]
}, },
"legacy-setup-py": { "legacy-setup-py": {
"description": "Use legacy `setuptools` behavior when building source distributions without a `pyproject.toml`.",
"type": [ "type": [
"boolean", "boolean",
"null" "null"
] ]
}, },
"link-mode": { "link-mode": {
"description": "The method to use when installing packages from the global cache.\n\nDefaults to `clone` (also known as Copy-on-Write) on macOS, and `hardlink` on Linux and Windows.",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/LinkMode" "$ref": "#/definitions/LinkMode"
@ -664,12 +689,14 @@
] ]
}, },
"no-annotate": { "no-annotate": {
"description": "Exclude comment annotations indicating the source of each package from the output file generated by `uv pip compile`.",
"type": [ "type": [
"boolean", "boolean",
"null" "null"
] ]
}, },
"no-binary": { "no-binary": {
"description": "Don't install pre-built wheels.\n\nThe given packages will be built and installed from source. The resolver will still use pre-built wheels to extract package metadata, if available.\n\nMultiple packages may be provided. Disable binaries for all packages with `:all:`. Clear previously specified packages with `:none:`.",
"type": [ "type": [
"array", "array",
"null" "null"
@ -679,24 +706,28 @@
} }
}, },
"no-build": { "no-build": {
"description": "Don't build source distributions.\n\nWhen enabled, resolving will not run arbitrary Python code. The cached wheels of already-built source distributions will be reused, but operations that require building distributions will exit with an error.\n\nAlias for `--only-binary :all:`.",
"type": [ "type": [
"boolean", "boolean",
"null" "null"
] ]
}, },
"no-build-isolation": { "no-build-isolation": {
"description": "Disable isolation when building source distributions.\n\nAssumes that build dependencies specified by PEP 518 are already installed.",
"type": [ "type": [
"boolean", "boolean",
"null" "null"
] ]
}, },
"no-deps": { "no-deps": {
"description": "Ignore package dependencies, instead only add those packages explicitly listed on the command line to the resulting the requirements file.",
"type": [ "type": [
"boolean", "boolean",
"null" "null"
] ]
}, },
"no-emit-package": { "no-emit-package": {
"description": "Specify a package to omit from the output resolution. Its dependencies will still be included in the resolution. Equivalent to pip-compile's `--unsafe-package` option.",
"type": [ "type": [
"array", "array",
"null" "null"
@ -713,24 +744,28 @@
] ]
}, },
"no-index": { "no-index": {
"description": "Ignore all registry indexes (e.g., PyPI), instead relying on direct URL dependencies and those provided via `--find-links`.",
"type": [ "type": [
"boolean", "boolean",
"null" "null"
] ]
}, },
"no-strip-extras": { "no-strip-extras": {
"description": "Include extras in the output file.\n\nBy default, uv strips extras, as any packages pulled in by the extras are already included as dependencies in the output file directly. Further, output files generated with `--no-strip-extras` cannot be used as constraints files in `install` and `sync` invocations.",
"type": [ "type": [
"boolean", "boolean",
"null" "null"
] ]
}, },
"no-strip-markers": { "no-strip-markers": {
"description": "Include environment markers in the output file generated by `uv pip compile`.\n\nBy default, uv strips environment markers, as the resolution generated by `compile` is only guaranteed to be correct for the target environment.",
"type": [ "type": [
"boolean", "boolean",
"null" "null"
] ]
}, },
"only-binary": { "only-binary": {
"description": "Only use pre-built wheels; don't build source distributions.\n\nWhen 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.\n\nMultiple packages may be provided. Disable binaries for all packages with `:all:`. Clear previously specified packages with `:none:`.",
"type": [ "type": [
"array", "array",
"null" "null"
@ -740,18 +775,21 @@
} }
}, },
"output-file": { "output-file": {
"description": "Write the requirements generated by `uv pip compile` to the given `requirements.txt` file.\n\nIf the file already exists, the existing versions will be preferred when resolving dependencies, unless `--upgrade` is also specified.",
"type": [ "type": [
"string", "string",
"null" "null"
] ]
}, },
"prefix": { "prefix": {
"description": "Install packages into `lib`, `bin`, and other top-level folders under the specified directory, as if a virtual environment were present at that location.\n\nIn general, prefer the use of `--python` to install into an alternate environment, as scripts and other artifacts installed via `--prefix` will reference the installing interpreter, rather than any interpreter added to the `--prefix` directory, rendering them non-portable.",
"type": [ "type": [
"string", "string",
"null" "null"
] ]
}, },
"prerelease": { "prerelease": {
"description": "The strategy to use when considering pre-release versions.\n\nBy 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 (`if-necessary-or-explicit`).",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/PreReleaseMode" "$ref": "#/definitions/PreReleaseMode"
@ -762,12 +800,14 @@
] ]
}, },
"python": { "python": {
"description": "The Python interpreter into which packages should be installed.\n\nBy default, uv installs into the virtual environment in the current working directory or any parent directory. The `--python` option allows you to specify a different interpreter, which is intended for use in continuous integration (CI) environments or other automated workflows.\n\nSupported formats: - `3.10` looks for an installed Python 3.10 using `py --list-paths` on Windows, or `python3.10` on Linux and macOS. - `python3.10` or `python.exe` looks for a binary with the given name in `PATH`. - `/home/ferris/.local/bin/python3.10` uses the exact Python at the given path.",
"type": [ "type": [
"string", "string",
"null" "null"
] ]
}, },
"python-platform": { "python-platform": {
"description": "The platform for which requirements should be resolved.\n\nRepresented as a \"target triple\", a string that describes the target platform in terms of its CPU, vendor, and operating system name, like `x86_64-unknown-linux-gnu` or `aaarch64-apple-darwin`.",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/TargetTriple" "$ref": "#/definitions/TargetTriple"
@ -778,6 +818,7 @@
] ]
}, },
"python-version": { "python-version": {
"description": "The minimum Python version that should be supported by the resolved requirements (e.g., `3.8` or `3.8.17`).\n\nIf a patch version is omitted, the minimum patch version is assumed. For example, `3.8` is mapped to `3.8.0`.",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/PythonVersion" "$ref": "#/definitions/PythonVersion"
@ -788,12 +829,14 @@
] ]
}, },
"reinstall": { "reinstall": {
"description": "Reinstall all packages, regardless of whether they're already installed.",
"type": [ "type": [
"boolean", "boolean",
"null" "null"
] ]
}, },
"reinstall-package": { "reinstall-package": {
"description": "Reinstall a specific package, regardless of whether it's already installed.",
"type": [ "type": [
"array", "array",
"null" "null"
@ -803,12 +846,14 @@
} }
}, },
"require-hashes": { "require-hashes": {
"description": "Require a matching hash for each requirement.\n\nHash-checking mode is all or nothing. If enabled, _all_ requirements must be provided with a corresponding hash or set of hashes. Additionally, if enabled, _all_ requirements must either be pinned to exact versions (e.g., `==1.0.0`), or be specified via direct URL.\n\nHash-checking mode introduces a number of additional constraints:\n\n- Git dependencies are not supported. - Editable installs are not supported. - Local dependencies are not supported, unless they point to a specific wheel (`.whl`) or source archive (`.zip`, `.tar.gz`), as opposed to a directory.",
"type": [ "type": [
"boolean", "boolean",
"null" "null"
] ]
}, },
"resolution": { "resolution": {
"description": "The strategy to use when selecting between the different compatible versions for a given package requirement.\n\nBy default, uv will use the latest compatible version of each package (`highest`).",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/ResolutionMode" "$ref": "#/definitions/ResolutionMode"
@ -819,36 +864,42 @@
] ]
}, },
"strict": { "strict": {
"description": "Validate the Python environment, to detect packages with missing dependencies and other issues.",
"type": [ "type": [
"boolean", "boolean",
"null" "null"
] ]
}, },
"system": { "system": {
"description": "Install packages into the system Python environment.\n\nBy default, uv installs into the virtual environment in the current working directory or any parent directory. The `--system` option instructs uv to instead use the first Python found in the system `PATH`.\n\nWARNING: `--system` is intended for use in continuous integration (CI) environments and should be used with caution, as it can modify the system Python installation.",
"type": [ "type": [
"boolean", "boolean",
"null" "null"
] ]
}, },
"target": { "target": {
"description": "Install packages into the specified directory, rather than into the virtual or system Python environment. The packages will be installed at the top-level of the directory.",
"type": [ "type": [
"string", "string",
"null" "null"
] ]
}, },
"universal": { "universal": {
"description": "Perform a universal resolution, attempting to generate a single `requirements.txt` output file that is compatible with all operating systems, architectures, and Python implementations.\n\nIn universal mode, the current Python version (or user-provided `--python-version`) will be treated as a lower bound. For example, `--universal --python-version 3.7` would produce a universal resolution for Python 3.7 and later.",
"type": [ "type": [
"boolean", "boolean",
"null" "null"
] ]
}, },
"upgrade": { "upgrade": {
"description": "Allow package upgrades, ignoring pinned versions in any existing output file.",
"type": [ "type": [
"boolean", "boolean",
"null" "null"
] ]
}, },
"upgrade-package": { "upgrade-package": {
"description": "Allow upgrades for a specific package, ignoring pinned versions in any existing output file.\n\nAccepts both standalone package names (`ruff`) and version specifiers (`ruff<0.5.0`).",
"type": [ "type": [
"array", "array",
"null" "null"