Type object
Schema URL https://catalog.lintel.tools/schemas/schemastore/python-script-metadata/_shared/latest--uv.json
Parent schema python-script-metadata
Type: object

Metadata and configuration for uv.

Properties

add-bounds AddBoundsKind | null

The default version specifier when adding a dependency.

When adding a dependency to the project, if no constraint or URL is provided, a constraint is added based on the latest compatible version of the package. By default, a lower bound constraint is used, e.g., >=1.2.3.

When --frozen is provided, no resolution is performed, and dependencies are always added without constraints.

This option is in preview and may change in any future release.

allow-insecure-host array | null

Allow insecure connections to host.

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-host in a secure network with verified sources, as it bypasses SSL verification and could expose you to MITM attacks.

build-backend BuildBackendSettings | null

Configuration for the uv build backend.

Note that those settings only apply when using the uv_build backend, other build backends (such as hatchling) have their own configuration.

build-constraint-dependencies array | null

PEP 508-style requirements, e.g., ruff==0.5.0, or ruff @ <https://>....

cache-dir string | null

Path to the cache directory.

Defaults to $XDG_CACHE_HOME/uv or $HOME/.cache/uv on Linux and macOS, and %LOCALAPPDATA%\uv\cache on Windows.

cache-keys array | null

The keys to consider when caching builds for the project.

Cache keys enable you to specify the files or directories that should trigger a rebuild when modified. By default, uv will rebuild a project whenever the pyproject.toml, setup.py, or setup.cfg files in the project directory are modified, or if a src directory is added or removed, i.e.:

cache-keys = [{ file = "pyproject.toml" }, { file = "setup.py" }, { file = "setup.cfg" }, { dir = "src" }]

As an example: if a project uses dynamic metadata to read its dependencies from a requirements.txt file, you can specify cache-keys = [{ file = "requirements.txt" }, { file = "pyproject.toml" }] to ensure that the project is rebuilt whenever the requirements.txt file is modified (in addition to watching the pyproject.toml).

Globs are supported, following the syntax of the glob crate. For example, to invalidate the cache whenever a .toml file in the project directory or any of its subdirectories is modified, you can specify cache-keys = [{ file = "**/*.toml" }]. Note that the use of globs can be expensive, as uv may need to walk the filesystem to determine whether any files have changed.

Cache keys can also include version control information. For example, if a project uses setuptools_scm to read its version from a Git commit, you can specify cache-keys = [{ git = { commit = true }, { file = "pyproject.toml" }] to include the current Git commit hash in the cache key (in addition to the pyproject.toml). Git tags are also supported via cache-keys = [{ git = { commit = true, tags = true } }].

Cache keys can also include environment variables. For example, if a project relies on MACOSX_DEPLOYMENT_TARGET or other environment variables to determine its behavior, you can specify cache-keys = [{ env = "MACOSX_DEPLOYMENT_TARGET" }] to invalidate the cache whenever the environment variable changes.

Cache keys only affect the project defined by the pyproject.toml in which they're specified (as opposed to, e.g., affecting all members in a workspace), and all paths and globs are interpreted as relative to the project directory.

check-url IndexUrl | null

Check an index URL for existing files to skip duplicate uploads.

This option allows retrying publishing that failed after only some, but not all files have been uploaded, and handles error due to parallel uploads of the same file.

Before uploading, the index is checked. If the exact same file already exists in the index, the file will not be uploaded. If an error occurred during the upload, the index is checked again, to handle cases where the identical file was uploaded twice in parallel.

The exact behavior will vary based on the index. When uploading to PyPI, uploading the same file succeeds even without --check-url, while most other indexes error.

The index must provide one of the supported hashes (SHA-256, SHA-384, or SHA-512).

compile-bytecode boolean | null

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.

concurrent-builds integer | null

The maximum number of source distributions that uv will build concurrently at any given time.

Defaults to the number of available CPU cores.

format=uintmin=1
concurrent-downloads integer | null

The maximum number of in-flight concurrent downloads that uv will perform at any given time.

format=uintmin=1
concurrent-installs integer | null

The number of threads used when installing and unzipping packages.

Defaults to the number of available CPU cores.

format=uintmin=1
config-settings ConfigSettings | null

Settings to pass to the PEP 517 build backend, specified as KEY=VALUE pairs.

config-settings-package PackageConfigSettings | null

Settings to pass to the PEP 517 build backend for specific packages, specified as KEY=VALUE pairs.

Accepts a map from package names to string key-value pairs.

conflicts SchemaConflicts | null

A list of sets of conflicting groups or extras.

constraint-dependencies array | null

PEP 508-style requirements, e.g., ruff==0.5.0, or ruff @ <https://>....

default-groups DefaultGroups | null

The list of dependency-groups to install by default.

Can also be the literal "all" to default enable all groups.

dependency-groups ToolUvDependencyGroups | null

Additional settings for dependency-groups.

Currently this can only be used to add requires-python constraints to dependency groups (typically to inform uv that your dev tooling has a higher python requirement than your actual project).

This cannot be used to define dependency groups, use the top-level [dependency-groups] table for that.

dependency-metadata array | null

Pre-defined static metadata for dependencies of the project (direct or transitive). When provided, enables the resolver to use the specified metadata instead of querying the registry or building the relevant package from source.

Metadata should be provided in adherence with the Metadata 2.3 standard, though only the following fields are respected:

  • name: The name of the package.
  • (Optional) version: The version of the package. If omitted, the metadata will be applied to all versions of the package.
  • (Optional) requires-dist: The dependencies of the package (e.g., werkzeug>=0.14).
  • (Optional) requires-python: The Python version required by the package (e.g., >=3.10).
  • (Optional) provides-extra: The extras provided by the package.
dev-dependencies array | null

PEP 508-style requirements, e.g., ruff==0.5.0, or ruff @ <https://>....

environments array | null

A list of environment markers, e.g., python_version >= '3.6'.

exclude-dependencies array | null

Package names to exclude, e.g., werkzeug, numpy.

exclude-newer ExcludeNewerValue | null

Limit candidate packages to those that were uploaded prior to the given date.

Accepts RFC 3339 timestamps (e.g., 2006-12-02T02:07:43Z), a "friendly" duration (e.g., 24 hours, 1 week, 30 days), or an ISO 8601 duration (e.g., PT24H, P7D, P30D).

Durations do not respect semantics of the local time zone and are always resolved to a fixed number of seconds assuming that a day is 24 hours (e.g., DST transitions are ignored). Calendar units such as months and years are not allowed.

exclude-newer-package ExcludeNewerPackage | null

Limit candidate packages for specific packages to those that were uploaded prior to the given date.

Accepts a dictionary format of PACKAGE = "DATE" pairs, where DATE is an RFC 3339 timestamp (e.g., 2006-12-02T02:07:43Z), a "friendly" duration (e.g., 24 hours, 1 week, 30 days), or a ISO 8601 duration (e.g., PT24H, P7D, P30D).

Durations do not respect semantics of the local time zone and are always resolved to a fixed number of seconds assuming that a day is 24 hours (e.g., DST transitions are ignored). Calendar units such as months and years are not allowed.

extra-build-dependencies ExtraBuildDependencies | null

Additional build dependencies for packages.

This allows extending the PEP 517 build environment for the project's dependencies with additional packages. This is useful for packages that assume the presence of packages like pip, and do not declare them as build dependencies.

extra-build-variables ExtraBuildVariables | null

Extra environment variables to set when building certain packages.

Environment variables will be added to the environment when building the specified packages.

extra-index-url array | null

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 or index with default = true. When multiple indexes are provided, earlier values take priority.

To control uv's resolution strategy when multiple indexes are present, see index_strategy.

(Deprecated: use index instead.)

fork-strategy ForkStrategy | null

The strategy to use when selecting multiple versions of a given package across Python versions and platforms.

By default, uv will optimize for selecting the latest version of each package for each supported Python version (requires-python), while minimizing the number of selected versions across platforms.

Under fewest, uv will minimize the number of selected versions for each package, preferring older versions that are compatible with a wider range of supported Python versions or platforms.

http-proxy ProxyUrl | null

The URL of the HTTP proxy to use.

https-proxy ProxyUrl | null

The URL of the HTTPS proxy to use.

index array | null

The indexes to use when resolving dependencies.

Accepts either a repository compliant with PEP 503 (the simple repository API), or a local directory laid out in the same format.

Indexes are considered in the order in which they're defined, such that the first-defined index has the highest priority. Further, the indexes provided by this setting are given higher priority than any indexes specified via index_url or extra_index_url. uv will only consider the first index that contains a given package, unless an alternative index strategy is specified.

If an index is marked as explicit = true, it will be used exclusively for the dependencies that select it explicitly via [tool.uv.sources], as in:

[[tool.uv.index]]
name = "pytorch"
url = "<https://download.pytorch.org/whl/cu121>"
explicit = true

[tool.uv.sources]
torch = { index = "pytorch" }

If an index is marked as default = true, it will be moved to the end of the prioritized list, such that it is given the lowest priority when resolving packages. Additionally, marking an index as default will disable the PyPI default index.

Default: null
index-strategy IndexStrategy | null

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-index). This prevents "dependency confusion" attacks, whereby an attacker can upload a malicious package under the same name to an alternate index.

index-url IndexUrl | null

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 or index.

(Deprecated: use index instead.)

keyring-provider KeyringProviderType | null

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.

managed boolean | null

Whether the project is managed by uv. If false, uv will ignore the project when uv run is invoked.

native-tls boolean | null

Whether to load TLS certificates from the platform's native certificate store.

By default, uv loads certificates from the bundled webpki-roots crate. The webpki-roots are 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.

no-binary boolean | null

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.

no-binary-package array | null

Don't install pre-built wheels for a specific package.

no-build boolean | null

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.

no-build-isolation boolean | null

Disable isolation when building source distributions.

Assumes that build dependencies specified by PEP 518 are already installed.

no-build-isolation-package array | null

Disable isolation when building source distributions for a specific package.

Assumes that the packages' build dependencies specified by PEP 518 are already installed.

no-build-package array | null

Don't build source distributions for a specific package.

no-cache boolean | null

Avoid reading from or writing to the cache, instead using a temporary directory for the duration of the operation.

no-index boolean | null

Ignore all registry indexes (e.g., PyPI), instead relying on direct URL dependencies and those provided via --find-links.

no-proxy array | null

A list of hosts to exclude from proxying.

no-sources boolean | null

Ignore the tool.uv.sources table when resolving dependencies. Used to lock against the standards-compliant, publishable package metadata, as opposed to using any local or Git sources.

no-sources-package array | null

Ignore tool.uv.sources for the specified packages.

offline boolean | null

Disable network access, relying only on locally cached data and locally available files.

override-dependencies array | null

PEP 508-style requirements, e.g., ruff==0.5.0, or ruff @ <https://>....

package boolean | null

Whether the project should be considered a Python package, or a non-package ("virtual") project.

Packages are built and installed into the virtual environment in editable mode and thus require a build backend, while virtual projects are not built or installed; instead, only their dependencies are included in the virtual environment.

Creating a package requires that a build-system is present in the pyproject.toml, and that the project adheres to a structure that adheres to the build backend's expectations (e.g., a src layout).

pip PipOptions | null
prerelease PrereleaseMode | null

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).

preview boolean | null

Whether to enable experimental, preview features.

publish-url DisplaySafeUrl | null

The URL for publishing packages to the Python package index (by default: https://upload.pypi.org/legacy/).

pypy-install-mirror string | null

Mirror URL to use for downloading managed PyPy installations.

By default, managed PyPy installations are downloaded from downloads.python.org. This variable can be set to a mirror URL to use a different source for PyPy installations. The provided URL will replace <https://downloads.python.org/pypy> in, e.g., <https://downloads.python.org/pypy/pypy3.8-v7.3.7-osx64.tar.bz2>.

Distributions can be read from a local directory by using the file:// URL scheme.

python-downloads PythonDownloads | null

Whether to allow Python downloads.

python-downloads-json-url string | null

URL pointing to JSON of custom Python installations.

python-install-mirror string | null

Mirror URL for downloading managed Python installations.

By default, managed Python installations are downloaded from python-build-standalone. This variable can be set to a mirror URL to use a different source for Python installations. The provided URL will replace <https://github.com/astral-sh/python-build-standalone/releases/download> in, e.g., <https://github.com/astral-sh/python-build-standalone/releases/download/20240713/cpython-3.12.4%2B20240713-aarch64-apple-darwin-install_only.tar.gz>.

Distributions can be read from a local directory by using the file:// URL scheme.

python-preference PythonPreference | null

Whether to prefer using Python installations that are already present on the system, or those that are downloaded and installed by uv.

reinstall boolean | null

Reinstall all packages, regardless of whether they're already installed. Implies refresh.

reinstall-package array | null

Reinstall a specific package, regardless of whether it's already installed. Implies refresh-package.

required-environments array | null

A list of environment markers, e.g., `sys_platform == 'darwin'.

required-version RequiredVersion | null

Enforce a requirement on the version of uv.

If the version of uv does not meet the requirement at runtime, uv will exit with an error.

Accepts a PEP 440 specifier, like ==0.5.0 or >=0.5.0.

resolution ResolutionMode | null

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).

sources ToolUvSources | null

The sources to use when resolving dependencies.

tool.uv.sources enriches the dependency metadata with additional sources, incorporated during development. A dependency source can be a Git repository, a URL, a local path, or an alternative registry.

See Dependencies for more.

torch-backend TorchMode | null

The backend to use when fetching packages in the PyTorch ecosystem.

When set, uv will ignore the configured index URLs for packages in the PyTorch ecosystem, and will instead use the defined backend.

For example, when set to cpu, uv will use the CPU-only PyTorch index; when set to cu126, uv will use the PyTorch index for CUDA 12.6.

The auto mode will attempt to detect the appropriate PyTorch index based on the currently installed CUDA drivers.

This setting is only respected by uv pip commands.

This option is in preview and may change in any future release.

trusted-publishing TrustedPublishing | null

Configure trusted publishing.

By default, uv checks for trusted publishing when running in a supported environment, but ignores it if it isn't configured.

uv's supported environments for trusted publishing include GitHub Actions and GitLab CI/CD.

upgrade boolean | null

Allow package upgrades, ignoring pinned versions in any existing output file.

upgrade-package array | null

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).

workspace ToolUvWorkspace | null

The workspace definition for the project, if any.

Definitions

AddBoundsKind string | string | string | string

The default version specifier when adding a dependency.

AnnotationStyle string | string

Indicate the style of annotation comments, used to indicate the dependencies that requested each package.

AuthPolicy string | string | string

When to use authentication.

BuildBackendSettings object

Settings for the uv build backend (uv_build).

Note that those settings only apply when using the uv_build backend, other build backends (such as hatchling) have their own configuration.

All options that accept globs use the portable glob patterns from PEP 639.

data

Data includes for wheels.

Each entry is a directory, whose contents are copied to the matching directory in the wheel in <name>-<version>.data/(purelib|platlib|headers|scripts|data). Upon installation, this data is moved to its target location, as defined by https://docs.python.org/3.12/library/sysconfig.html#installation-paths. Usually, small data files are included by placing them in the Python module instead of using data includes.

  • scripts: Installed to the directory for executables, <venv>/bin on Unix or <venv>\Scripts on Windows. This directory is added to PATH when the virtual environment is activated or when using uv run, so this data type can be used to install additional binaries. Consider using project.scripts instead for Python entrypoints.

  • data: Installed over the virtualenv environment root.

    Warning: This may override existing files!

  • headers: Installed to the include directory. Compilers building Python packages with this package as build requirement use the include directory to find additional header files.

  • purelib and platlib: Installed to the site-packages directory. It is not recommended to use these two options.

Default:
{
  "data": null,
  "headers": null,
  "platlib": null,
  "purelib": null,
  "scripts": null
}
All of: WheelDataIncludes object
default-excludes boolean

If set to false, the default excludes aren't applied.

Default excludes: __pycache__, *.pyc, and *.pyo.

Default: true
module-name ModuleName | null

The name of the module directory inside module-root.

The default module name is the package name with dots and dashes replaced by underscores.

Package names need to be valid Python identifiers, and the directory needs to contain a __init__.py. An exception are stubs packages, whose name ends with -stubs, with the stem being the module name, and which contain a __init__.pyi file.

For namespace packages with a single module, the path can be dotted, e.g., foo.bar or foo-stubs.bar.

For namespace packages with multiple modules, the path can be a list, e.g., ["foo", "bar"]. We recommend using a single module per package, splitting multiple packages into a workspace.

Note that using this option runs the risk of creating two packages with different names but the same module names. Installing such packages together leads to unspecified behavior, often with corrupted files or directory trees.

Default: null
module-root string

The directory that contains the module directory.

Common values are src (src layout, the default) or an empty path (flat layout).

Default: "src"
namespace boolean

Build a namespace package.

Build a PEP 420 implicit namespace package, allowing more than one root __init__.py.

Use this option when the namespace package contains multiple root __init__.py, for namespace packages with a single root __init__.py use a dotted module-name instead.

To compare dotted module-name and namespace = true, the first example below can be expressed with module-name = "cloud.database": There is one root __init__.py database. In the second example, we have three roots (cloud.database, cloud.database_pro, billing.modules.database_pro), so namespace = true is required.

src
└── cloud
    └── database
        ├── __init__.py
        ├── query_builder
        │   └── __init__.py
        └── sql
            ├── parser.py
            └── __init__.py
src
├── cloud
│   ├── database
│   │   ├── __init__.py
│   │   ├── query_builder
│   │   │   └── __init__.py
│   │   └── sql
│   │       ├── __init__.py
│   │       └── parser.py
│   └── database_pro
│       ├── __init__.py
│       └── query_builder.py
└── billing
    └── modules
        └── database_pro
            ├── __init__.py
            └── sql.py
Default: false
source-exclude string[]

Glob expressions which files and directories to exclude from the source distribution.

These exclusions are also applied to wheels to ensure that a wheel built from a source tree is consistent with a wheel built from a source distribution.

Default:
[]
source-include string[]

Glob expressions which files and directories to additionally include in the source distribution.

pyproject.toml and the contents of the module directory are always included.

Default:
[]
wheel-exclude string[]

Glob expressions which files and directories to exclude from the wheel.

Default:
[]
CacheKey string | object | object | object | object
ConfigSettingValue string | string[]
ConfigSettings Record<string, string | string[]>

Settings to pass to a PEP 517 build backend, structured as a map from (string) key to string or list of strings.

See: https://peps.python.org/pep-0517/#config-settings

DefaultGroups string | GroupName[]

Either the literal "all" or a list of groups

DependencyGroupSettings object
requires-python string | null

Version of python to require when installing this group

DisplaySafeUrl string

A [Url] wrapper that redacts credentials when displaying the URL.

DisplaySafeUrl wraps the standard [url::Url] type, providing functionality to mask secrets by default when the URL is displayed or logged. This helps prevent accidental exposure of sensitive information in logs and debug output.

Examples

use uv_redacted::DisplaySafeUrl;
use std::str::FromStr;

// Create a `DisplaySafeUrl` from a `&str`
let mut url = DisplaySafeUrl::parse("<https://user:[email protected]>").unwrap();

// Display will mask secrets
assert_eq!(url.to_string(), "<https://user:****@example.com/>");

// You can still access the username and password
assert_eq!(url.username(), "user");
assert_eq!(url.password(), Some("password"));

// And you can still update the username and password
let _ = url.set_username("new_user");
let _ = url.set_password(Some("new_password"));
assert_eq!(url.username(), "new_user");
assert_eq!(url.password(), Some("new_password"));

// It is also possible to remove the credentials entirely
url.remove_credentials();
assert_eq!(url.username(), "");
assert_eq!(url.password(), None);
ExcludeNewerPackage Record<string, boolean | ExcludeNewerValue>
ExcludeNewerValue string

Exclude distributions uploaded after the given timestamp.

Accepts both RFC 3339 timestamps (e.g., 2006-12-02T02:07:43Z) and local dates in the same format (e.g., 2006-12-02), as well as relative durations (e.g., 1 week, 30 days, 6 months). Relative durations are resolved to a timestamp at lock time.

ExtraBuildDependencies Record<string, ExtraBuildDependency[]>
ExtraBuildDependency Requirement | object
ExtraBuildVariables Record<string, object>

Extra environment variables to set during builds, on a per-package basis.

ExtraName string

The normalized name of an extra dependency.

Converts the name to lowercase and collapses runs of -, _, and . down to a single -. For example, ---, ., and __ are all converted to a single -.

See:

ForkStrategy string | string
GitPattern boolean | GitSet
GitSet object
commit boolean | null
tags boolean | null
Index object
url required

The URL of the index.

Expects to receive a URL (e.g., <https://pypi.org/simple>) or a local path.

All of: IndexUrl string
authenticate

When uv should use authentication for requests to the index.

[[tool.uv.index]]
name = "my-index"
url = "<https://<omitted>>/simple"
authenticate = "always"
Default: "auto"
All of: AuthPolicy string | string | string
cache-control IndexCacheControl | null

Cache control configuration for this index.

When set, these headers will override the server's cache control headers for both package metadata requests and artifact downloads.

[[tool.uv.index]]
name = "my-index"
url = "<https://<omitted>>/simple"
cache-control = { api = "max-age=600", files = "max-age=3600" }
Default: null
default boolean

Mark the index as the default index.

By default, uv uses PyPI as the default index, such that even if additional indexes are defined via [[tool.uv.index]], PyPI will still be used as a fallback for packages that aren't found elsewhere. To disable the PyPI default, set default = true on at least one other index.

Marking an index as default will move it to the front of the list of indexes, such that it is given the highest priority when resolving packages.

Default: false
explicit boolean

Mark the index as explicit.

Explicit indexes will only be used when explicitly requested via a [tool.uv.sources] definition, as in:

[[tool.uv.index]]
name = "pytorch"
url = "<https://download.pytorch.org/whl/cu121>"
explicit = true

[tool.uv.sources]
torch = { index = "pytorch" }
Default: false
format

The format used by the index.

Indexes can either be PEP 503-compliant (i.e., a PyPI-style registry implementing the Simple API) or structured as a flat list of distributions (e.g., --find-links). In both cases, indexes can point to either local or remote resources.

Default: "simple"
All of: IndexFormat string | string
ignore-error-codes array | null

Status codes that uv should ignore when deciding whether to continue searching in the next index after a failure.

[[tool.uv.index]]
name = "my-index"
url = "<https://<omitted>>/simple"
ignore-error-codes = [401, 403]
Default: null
name IndexName | null

The name of the index.

Index names can be used to reference indexes elsewhere in the configuration. For example, you can pin a package to a specific index by name:

[[tool.uv.index]]
name = "pytorch"
url = "<https://download.pytorch.org/whl/cu121>"

[tool.uv.sources]
torch = { index = "pytorch" }
publish-url DisplaySafeUrl | null

The URL of the upload endpoint.

When using uv publish --index <name>, this URL is used for publishing.

A configuration for the default index PyPI would look as follows:

[[tool.uv.index]]
name = "pypi"
url = "<https://pypi.org/simple>"
publish-url = "<https://upload.pypi.org/legacy/>"
IndexCacheControl object

Cache control configuration for an index.

api string | null

Cache control header for Simple API requests.

files string | null

Cache control header for file downloads.

IndexFormat string | string
IndexName string

The normalized name of an index.

Index names may contain letters, digits, hyphens, underscores, and periods, and must be ASCII.

IndexStrategy string | string | string
IndexUrl string

The URL of an index to use for fetching packages (e.g., <https://pypi.org/simple>), or a local path.

KeyringProviderType string | string

Keyring provider type to use for credential lookup.

LinkMode string | string | string | string

The method to use when linking.

Defaults to Clone on macOS and Linux (which support copy-on-write on APFS and btrfs/xfs/bcachefs respectively), and Hardlink on other platforms.

MarkerTree string

A PEP 508-compliant marker expression, e.g., sys_platform == 'Darwin'

ModuleName string | string[]

Whether to include a single module or multiple modules.

PackageConfigSettings Record<string, object>

Settings to pass to PEP 517 build backends on a per-package basis.

PackageExcludeNewer boolean | ExcludeNewerValue
PackageName string

The normalized name of a package.

Converts the name to lowercase and collapses runs of -, _, and . down to a single -. For example, ---, ., and __ are all converted to a single -.

See: https://packaging.python.org/en/latest/specifications/name-normalization/

PackageNameSpecifier string

The name of a package, or :all: or :none: to select or omit all packages, respectively.

PipGroupName object

The pip-compatible variant of a [GroupName].

Either or :. If is omitted it defaults to "pyproject.toml".

path string | null
PipOptions object

Settings that are specific to the uv pip command-line interface.

These values will be ignored when running commands outside the uv pip namespace (e.g., uv lock, uvx).

all-extras boolean | null

Include all optional dependencies.

Only applies to pyproject.toml, setup.py, and setup.cfg sources.

allow-empty-requirements boolean | null

Allow uv pip sync with empty requirements, which will clear the environment of all packages.

annotation-style AnnotationStyle | null

The style of the annotation comments included in the output file, used to indicate the source of each package.

break-system-packages boolean | null

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).

compile-bytecode boolean | null

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.

config-settings ConfigSettings | null

Settings to pass to the PEP 517 build backend, specified as KEY=VALUE pairs.

config-settings-package PackageConfigSettings | null

Settings to pass to the PEP 517 build backend for specific packages, specified as KEY=VALUE pairs.

custom-compile-command string | null

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.

dependency-metadata array | null

Pre-defined static metadata for dependencies of the project (direct or transitive). When provided, enables the resolver to use the specified metadata instead of querying the registry or building the relevant package from source.

Metadata should be provided in adherence with the Metadata 2.3 standard, though only the following fields are respected:

  • name: The name of the package.
  • (Optional) version: The version of the package. If omitted, the metadata will be applied to all versions of the package.
  • (Optional) requires-dist: The dependencies of the package (e.g., werkzeug>=0.14).
  • (Optional) requires-python: The Python version required by the package (e.g., >=3.10).
  • (Optional) provides-extra: The extras provided by the package.
emit-build-options boolean | null

Include --no-binary and --only-binary entries in the output file generated by uv pip compile.

emit-find-links boolean | null

Include --find-links entries in the output file generated by uv pip compile.

emit-index-annotation boolean | null

Include comment annotations indicating the index used to resolve each package (e.g., # from <https://pypi.org/simple>).

emit-index-url boolean | null

Include --index-url and --extra-index-url entries in the output file generated by uv pip compile.

emit-marker-expression boolean | null

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.

exclude-newer ExcludeNewerValue | null

Limit candidate packages to those that were uploaded prior to a given point in time.

Accepts a superset of RFC 3339 (e.g., 2006-12-02T02:07:43Z). A full timestamp is required to ensure that the resolver will behave consistently across timezones.

exclude-newer-package ExcludeNewerPackage | null

Limit candidate packages for specific packages to those that were uploaded prior to the given date.

Accepts package-date pairs in a dictionary format.

extra array | null

Include optional dependencies from the specified extra; may be provided more than once.

Only applies to pyproject.toml, setup.py, and setup.cfg sources.

extra-build-dependencies ExtraBuildDependencies | null

Additional build dependencies for packages.

This allows extending the PEP 517 build environment for the project's dependencies with additional packages. This is useful for packages that assume the presence of packages like pip, and do not declare them as build dependencies.

extra-build-variables ExtraBuildVariables | null

Extra environment variables to set when building certain packages.

Environment variables will be added to the environment when building the specified packages.

extra-index-url array | null

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. When multiple indexes are provided, earlier values take priority.

To control uv's resolution strategy when multiple indexes are present, see index_strategy.

find-links array | null

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 (e.g., .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.

fork-strategy ForkStrategy | null

The strategy to use when selecting multiple versions of a given package across Python versions and platforms.

By default, uv will optimize for selecting the latest version of each package for each supported Python version (requires-python), while minimizing the number of selected versions across platforms.

Under fewest, uv will minimize the number of selected versions for each package, preferring older versions that are compatible with a wider range of supported Python versions or platforms.

generate-hashes boolean | null

Include distribution hashes in the output file.

group array | null

Include the following dependency groups.

index-strategy IndexStrategy | null

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-index). This prevents "dependency confusion" attacks, whereby an attacker can upload a malicious package under the same name to an alternate index.

index-url IndexUrl | null

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.

keyring-provider KeyringProviderType | null

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.

link-mode LinkMode | null

The method to use when installing packages from the global cache.

Defaults to clone (also known as Copy-on-Write) on macOS and Linux, and hardlink on Windows.

WARNING: The use of symlink link mode is discouraged, as they create tight coupling between the cache and the target environment. For example, clearing the cache (uv cache clean) will break all installed packages by way of removing the underlying source files. Use symlinks with caution.

no-annotate boolean | null

Exclude comment annotations indicating the source of each package from the output file generated by uv pip compile.

no-binary array | null

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:.

no-build boolean | null

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:.

no-build-isolation boolean | null

Disable isolation when building source distributions.

Assumes that build dependencies specified by PEP 518 are already installed.

no-build-isolation-package array | null

Disable isolation when building source distributions for a specific package.

Assumes that the packages' build dependencies specified by PEP 518 are already installed.

no-deps boolean | null

Ignore package dependencies, instead only add those packages explicitly listed on the command line to the resulting requirements file.

no-emit-package array | null

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.

no-extra array | null

Exclude the specified optional dependencies if all-extras is supplied.

no-header boolean | null

Exclude the comment header at the top of output file generated by uv pip compile.

no-index boolean | null

Ignore all registry indexes (e.g., PyPI), instead relying on direct URL dependencies and those provided via --find-links.

no-sources boolean | null

Ignore the tool.uv.sources table when resolving dependencies. Used to lock against the standards-compliant, publishable package metadata, as opposed to using any local or Git sources.

no-sources-package array | null

Ignore tool.uv.sources for the specified packages.

no-strip-extras boolean | null

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.

no-strip-markers boolean | null

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.

only-binary array | null

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:.

output-file string | null

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.

prefix string | null

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.

prerelease PrereleaseMode | null

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).

python string | null

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 in the registry on Windows (see py --list-paths), 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.
python-platform TargetTriple | null

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 aarch64-apple-darwin.

python-version PythonVersion | null

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.

reinstall boolean | null

Reinstall all packages, regardless of whether they're already installed. Implies refresh.

reinstall-package array | null

Reinstall a specific package, regardless of whether it's already installed. Implies refresh-package.

require-hashes boolean | null

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 installations 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.
resolution ResolutionMode | null

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).

strict boolean | null

Validate the Python environment, to detect packages with missing dependencies and other issues.

system boolean | null

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.

target string | null

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.

torch-backend TorchMode | null

The backend to use when fetching packages in the PyTorch ecosystem.

When set, uv will ignore the configured index URLs for packages in the PyTorch ecosystem, and will instead use the defined backend.

For example, when set to cpu, uv will use the CPU-only PyTorch index; when set to cu126, uv will use the PyTorch index for CUDA 12.6.

The auto mode will attempt to detect the appropriate PyTorch index based on the currently installed CUDA drivers.

This setting is only respected by uv pip commands.

This option is in preview and may change in any future release.

universal boolean | null

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.

upgrade boolean | null

Allow package upgrades, ignoring pinned versions in any existing output file.

upgrade-package array | null

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).

verify-hashes boolean | null

Validate any hashes provided in the requirements file.

Unlike --require-hashes, --verify-hashes does not require that all requirements have hashes; instead, it will limit itself to verifying the hashes of those requirements that do include them.

PortablePathBuf string
PrereleaseMode string | string | string | string | string
ProxyUrl string

A proxy URL (e.g., <http://proxy.example.com:8080>).

PythonDownloads string | string | string
PythonPreference string | string | string | string
PythonVersion string

A Python version specifier, e.g. 3.11 or 3.12.4.

RequiredVersion string

A version specifier, e.g. >=0.5.0 or ==0.5.0.

Requirement string

A PEP 508 dependency specifier, e.g., ruff >= 0.6.0

ResolutionMode string | string | string
SchemaConflictItem object

A single item in a conflicting set.

Each item is a pair of an (optional) package and a corresponding extra or group name for that package.

extra ExtraName | null
Default: null
group GroupName | null
Default: null
package PackageName | null
Default: null
SchemaConflictSet SchemaConflictItem[]

Like [ConflictSet], but for deserialization in pyproject.toml.

The schema format is different from the in-memory format. Specifically, the schema format does not allow specifying the package name (or will make it optional in the future), where as the in-memory format needs the package name.

SchemaConflicts SchemaConflictSet[]

Like [Conflicts], but for deserialization in pyproject.toml.

The schema format is different from the in-memory format. Specifically, the schema format does not allow specifying the package name (or will make it optional in the future), where as the in-memory format needs the package name.

N.B. Conflicts is still used for (de)serialization. Specifically, in the lock file, where the package name is required.

SerdePattern string
Source object | object | object | object | object

A tool.uv.sources value.

Sources Source | Source[]
StaticMetadata object

A subset of the Python Package Metadata 2.3 standard as specified in https://packaging.python.org/specifications/core-metadata/.

name string required

The normalized name of a package.

Converts the name to lowercase and collapses runs of -, _, and . down to a single -. For example, ---, ., and __ are all converted to a single -.

See: https://packaging.python.org/en/latest/specifications/name-normalization/

provides-extra ExtraName[]
Default:
[]
requires-dist Requirement[]
Default:
[]
requires-python string | null

PEP 508-style Python requirement, e.g., >=3.10

version string | null

PEP 440-style package version, e.g., 1.2.3

StatusCode number

HTTP status code (100-599)

TargetTriple string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string

The supported target triples. Each triple consists of an architecture, vendor, and operating system.

See: https://doc.rust-lang.org/nightly/rustc/platform-support.html

ToolUvDependencyGroups Record<string, object>
ToolUvSources Record<string, Source | Source[]>
ToolUvWorkspace object
exclude array | null

Packages to exclude as workspace members. If a package matches both members and exclude, it will be excluded.

Supports both globs and explicit paths.

For more information on the glob syntax, refer to the glob documentation.

members array | null

Packages to include as workspace members.

Supports both globs and explicit paths.

For more information on the glob syntax, refer to the glob documentation.

TorchMode string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string

The strategy to use when determining the appropriate PyTorch index.

TrustedHost string

A host or host-port pair.

TrustedPublishing string | string
WheelDataIncludes object

Data includes for wheels.

See BuildBackendSettings::data.

data string | null
Default: null
headers string | null
Default: null
platlib string | null
Default: null
purelib string | null
Default: null
scripts string | null
Default: null