docs: separate project from configuration settings (#7053)

<!--
Thank you for contributing to uv! To help us out with reviewing, please
consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

Part of https://github.com/astral-sh/uv/issues/7007.

Settings documentation reference currently doesn't separate "project
metadata" and "configuration" options, implying that it's possible to
set things like `dev-dependencies` in `uv.toml` while it's not. This is
an attempt at better separating those options, by having 2 different
sections:
- `Project metadata`, that holds configuration that can only be set in
`pyproject.toml`
- `Configuration`, that holds configuration that can be set both in
`pyproject.toml` and `uv.toml`

Here are some screenshots to show what this looks like (note that I
don't have code highlighting in the right navigation, which makes them
clunky, as first item is always bigger because of the missing "span" --
I think that's because it's an `mkdocs-material` insider feature, since
I have the same thing on `main` branch):

- Right side navigation:

<img width="241" alt="Screenshot 2024-09-05 at 01 19 50"
src="https://github.com/user-attachments/assets/012f64a4-8d34-4e34-a506-8d02dc1fbf98">

<img width="223" alt="Screenshot 2024-09-05 at 01 20 01"
src="https://github.com/user-attachments/assets/0b0fb71d-c9c3-4ee3-8f6e-cf35180b1a99">

- An option from "Project metadata" section that only applies to
`pyproject.toml`:

<img width="788" alt="Screenshot 2024-09-05 at 01 20 11"
src="https://github.com/user-attachments/assets/64349fbb-8623-4b81-a475-d6ff38c658f1">

- An option from "Configuration" section that applies both to
`pyproject.toml` and `uv.toml`:

<img width="787" alt="Screenshot 2024-09-05 at 01 20 33"
src="https://github.com/user-attachments/assets/732e43d3-cc64-4f5a-8929-23a5555d4c53">

## Test Plan

Local run of the documentation.

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
This commit is contained in:
Mathieu Kniewallner 2024-09-14 02:57:51 +02:00 committed by GitHub
parent 54f171c80a
commit 211fa91c2a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 304 additions and 322 deletions

View file

@ -93,12 +93,29 @@ pub(crate) fn main(args: &Args) -> Result<()> {
Ok(()) Ok(())
} }
enum OptionType {
Configuration,
ProjectMetadata,
}
fn generate() -> String { fn generate() -> String {
let mut output = String::new(); let mut output = String::new();
generate_set( generate_set(
&mut output, &mut output,
Set::Global(CombinedOptions::metadata()), Set::Global {
set: WorkspaceOptions::metadata(),
option_type: OptionType::ProjectMetadata,
},
&mut Vec::new(),
);
generate_set(
&mut output,
Set::Global {
set: SettingsOptions::metadata(),
option_type: OptionType::Configuration,
},
&mut Vec::new(), &mut Vec::new(),
); );
@ -107,8 +124,12 @@ fn generate() -> String {
fn generate_set(output: &mut String, set: Set, parents: &mut Vec<Set>) { fn generate_set(output: &mut String, set: Set, parents: &mut Vec<Set>) {
match &set { match &set {
Set::Global(_) => { Set::Global { option_type, .. } => {
output.push_str("## Global\n"); let header = match option_type {
OptionType::Configuration => "## Configuration\n",
OptionType::ProjectMetadata => "## Project metadata\n",
};
output.push_str(header);
} }
Set::Named { name, .. } => { Set::Named { name, .. } => {
let title = parents let title = parents
@ -116,7 +137,7 @@ fn generate_set(output: &mut String, set: Set, parents: &mut Vec<Set>) {
.filter_map(|set| set.name()) .filter_map(|set| set.name())
.chain(std::iter::once(name.as_str())) .chain(std::iter::once(name.as_str()))
.join("."); .join(".");
writeln!(output, "## `{title}`\n").unwrap(); writeln!(output, "### `{title}`\n").unwrap();
if let Some(documentation) = set.metadata().documentation() { if let Some(documentation) = set.metadata().documentation() {
output.push_str(documentation); output.push_str(documentation);
@ -158,28 +179,34 @@ fn generate_set(output: &mut String, set: Set, parents: &mut Vec<Set>) {
} }
enum Set { enum Set {
Global(OptionSet), Global {
Named { name: String, set: OptionSet }, option_type: OptionType,
set: OptionSet,
},
Named {
name: String,
set: OptionSet,
},
} }
impl Set { impl Set {
fn name(&self) -> Option<&str> { fn name(&self) -> Option<&str> {
match self { match self {
Set::Global(_) => None, Set::Global { .. } => None,
Set::Named { name, .. } => Some(name), Set::Named { name, .. } => Some(name),
} }
} }
fn metadata(&self) -> &OptionSet { fn metadata(&self) -> &OptionSet {
match self { match self {
Set::Global(set) => set, Set::Global { set, .. } => set,
Set::Named { set, .. } => set, Set::Named { set, .. } => set,
} }
} }
} }
fn emit_field(output: &mut String, name: &str, field: &OptionField, parents: &[Set]) { fn emit_field(output: &mut String, name: &str, field: &OptionField, parents: &[Set]) {
let header_level = if parents.is_empty() { "###" } else { "####" }; let header_level = if parents.len() > 1 { "####" } else { "###" };
let parents_anchor = parents.iter().filter_map(|parent| parent.name()).join("_"); let parents_anchor = parents.iter().filter_map(|parent| parent.name()).join("_");
if parents_anchor.is_empty() { if parents_anchor.is_empty() {
@ -233,6 +260,22 @@ fn emit_field(output: &mut String, name: &str, field: &OptionField, parents: &[S
} }
output.push('\n'); output.push('\n');
output.push_str("**Example usage**:\n\n"); output.push_str("**Example usage**:\n\n");
match parents[0] {
Set::Global {
option_type: OptionType::ProjectMetadata,
..
} => {
output.push_str(&format_code(
"pyproject.toml",
&format_header(field.scope, parents, ConfigurationFile::PyprojectToml),
field.example,
));
}
Set::Global {
option_type: OptionType::Configuration,
..
} => {
output.push_str(&format_tab( output.push_str(&format_tab(
"pyproject.toml", "pyproject.toml",
&format_header(field.scope, parents, ConfigurationFile::PyprojectToml), &format_header(field.scope, parents, ConfigurationFile::PyprojectToml),
@ -243,6 +286,9 @@ fn emit_field(output: &mut String, name: &str, field: &OptionField, parents: &[S
&format_header(field.scope, parents, ConfigurationFile::UvToml), &format_header(field.scope, parents, ConfigurationFile::UvToml),
field.example, field.example,
)); ));
}
_ => {}
}
output.push('\n'); output.push('\n');
} }
@ -255,6 +301,10 @@ fn format_tab(tab_name: &str, header: &str, content: &str) -> String {
) )
} }
fn format_code(file_name: &str, header: &str, content: &str) -> String {
format!("```toml title=\"{file_name}\"\n{header}\n{content}\n```\n")
}
/// Format the TOML header for the example usage for a given option. /// Format the TOML header for the example usage for a given option.
/// ///
/// For example: `[tool.uv.pip]`. /// For example: `[tool.uv.pip]`.

View file

@ -1,5 +1,203 @@
## Global ## Project metadata
#### [`allow-insecure-host`](#allow-insecure-host) {: #allow-insecure-host } ### [`constraint-dependencies`](#constraint-dependencies) {: #constraint-dependencies }
Constraints to apply when resolving the project's dependencies.
Constraints are used to restrict the versions of dependencies that are selected during
resolution.
Including a package as a constraint will _not_ trigger installation of the package on its
own; instead, the package must be requested elsewhere in the project's first-party or
transitive dependencies.
!!! note
In `uv lock`, `uv sync`, and `uv run`, uv will only read `constraint-dependencies` from
the `pyproject.toml` at the workspace root, and will ignore any declarations in other
workspace members or `uv.toml` files.
**Default value**: `[]`
**Type**: `list[str]`
**Example usage**:
```toml title="pyproject.toml"
[tool.uv]
# Ensure that the grpcio version is always less than 1.65, if it's requested by a
# transitive dependency.
constraint-dependencies = ["grpcio<1.65"]
```
---
### [`dev-dependencies`](#dev-dependencies) {: #dev-dependencies }
The project's development dependencies. Development dependencies will be installed by
default in `uv run` and `uv sync`, but will not appear in the project's published metadata.
**Default value**: `[]`
**Type**: `list[str]`
**Example usage**:
```toml title="pyproject.toml"
[tool.uv]
dev-dependencies = ["ruff==0.5.0"]
```
---
### [`environments`](#environments) {: #environments }
A list of supported environments against which to resolve dependencies.
By default, uv will resolve for all possible environments during a `uv lock` operation.
However, you can restrict the set of supported environments to improve performance and avoid
unsatisfiable branches in the solution space.
These environments will also respected when `uv pip compile` is invoked with the
`--universal` flag.
**Default value**: `[]`
**Type**: `str | list[str]`
**Example usage**:
```toml title="pyproject.toml"
[tool.uv]
# Resolve for macOS, but not for Linux or Windows.
environments = ["sys_platform == 'darwin'"]
```
---
### [`managed`](#managed) {: #managed }
Whether the project is managed by uv. If `false`, uv will ignore the project when
`uv run` is invoked.
**Default value**: `true`
**Type**: `bool`
**Example usage**:
```toml title="pyproject.toml"
[tool.uv]
managed = false
```
---
### [`override-dependencies`](#override-dependencies) {: #override-dependencies }
Overrides to apply when resolving the project's dependencies.
Overrides are used to force selection of a specific version of a package, regardless of the
version requested by any other package, and regardless of whether choosing that version
would typically constitute an invalid resolution.
While constraints are _additive_, in that they're combined with the requirements of the
constituent packages, overrides are _absolute_, in that they completely replace the
requirements of any constituent packages.
!!! note
In `uv lock`, `uv sync`, and `uv run`, uv will only read `override-dependencies` from
the `pyproject.toml` at the workspace root, and will ignore any declarations in other
workspace members or `uv.toml` files.
**Default value**: `[]`
**Type**: `list[str]`
**Example usage**:
```toml title="pyproject.toml"
[tool.uv]
# Always install Werkzeug 2.3.0, regardless of whether transitive dependencies request
# a different version.
override-dependencies = ["werkzeug==2.3.0"]
```
---
### [`package`](#package) {: #package }
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).
**Default value**: `true`
**Type**: `bool`
**Example usage**:
```toml title="pyproject.toml"
[tool.uv]
package = false
```
---
### `workspace`
#### [`exclude`](#workspace_exclude) {: #workspace_exclude }
<span id="exclude"></span>
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](https://docs.rs/glob/latest/glob/struct.Pattern.html).
**Default value**: `[]`
**Type**: `list[str]`
**Example usage**:
```toml title="pyproject.toml"
[tool.uv.workspace]
exclude = ["member1", "path/to/member2", "libs/*"]
```
---
#### [`members`](#workspace_members) {: #workspace_members }
<span id="members"></span>
Packages to include as workspace members.
Supports both globs and explicit paths.
For more information on the glob syntax, refer to the [`glob` documentation](https://docs.rs/glob/latest/glob/struct.Pattern.html).
**Default value**: `[]`
**Type**: `list[str]`
**Example usage**:
```toml title="pyproject.toml"
[tool.uv.workspace]
members = ["member1", "path/to/member2", "libs/*"]
```
---
## Configuration
### [`allow-insecure-host`](#allow-insecure-host) {: #allow-insecure-host }
Allow insecure connections to host. Allow insecure connections to host.
@ -31,7 +229,7 @@ bypasses SSL verification and could expose you to MITM attacks.
--- ---
#### [`cache-dir`](#cache-dir) {: #cache-dir } ### [`cache-dir`](#cache-dir) {: #cache-dir }
Path to the cache directory. Path to the cache directory.
@ -59,7 +257,7 @@ Linux, and `%LOCALAPPDATA%\uv\cache` on Windows.
--- ---
#### [`cache-keys`](#cache-keys) {: #cache-keys } ### [`cache-keys`](#cache-keys) {: #cache-keys }
The keys to consider when caching builds for the project. The keys to consider when caching builds for the project.
@ -112,7 +310,7 @@ globs are interpreted as relative to the project directory.
--- ---
#### [`compile-bytecode`](#compile-bytecode) {: #compile-bytecode } ### [`compile-bytecode`](#compile-bytecode) {: #compile-bytecode }
Compile Python files to bytecode after installation. Compile Python files to bytecode after installation.
@ -146,7 +344,7 @@ ignore errors.
--- ---
#### [`concurrent-builds`](#concurrent-builds) {: #concurrent-builds } ### [`concurrent-builds`](#concurrent-builds) {: #concurrent-builds }
The maximum number of source distributions that uv will build concurrently at any given The maximum number of source distributions that uv will build concurrently at any given
time. time.
@ -174,7 +372,7 @@ Defaults to the number of available CPU cores.
--- ---
#### [`concurrent-downloads`](#concurrent-downloads) {: #concurrent-downloads } ### [`concurrent-downloads`](#concurrent-downloads) {: #concurrent-downloads }
The maximum number of in-flight concurrent downloads that uv will perform at any given The maximum number of in-flight concurrent downloads that uv will perform at any given
time. time.
@ -200,7 +398,7 @@ time.
--- ---
#### [`concurrent-installs`](#concurrent-installs) {: #concurrent-installs } ### [`concurrent-installs`](#concurrent-installs) {: #concurrent-installs }
The number of threads used when installing and unzipping packages. The number of threads used when installing and unzipping packages.
@ -227,7 +425,7 @@ Defaults to the number of available CPU cores.
--- ---
#### [`config-settings`](#config-settings) {: #config-settings } ### [`config-settings`](#config-settings) {: #config-settings }
Settings to pass to the [PEP 517](https://peps.python.org/pep-0517/) build backend, Settings to pass to the [PEP 517](https://peps.python.org/pep-0517/) build backend,
specified as `KEY=VALUE` pairs. specified as `KEY=VALUE` pairs.
@ -253,108 +451,7 @@ specified as `KEY=VALUE` pairs.
--- ---
#### [`constraint-dependencies`](#constraint-dependencies) {: #constraint-dependencies } ### [`exclude-newer`](#exclude-newer) {: #exclude-newer }
Constraints to apply when resolving the project's dependencies.
Constraints are used to restrict the versions of dependencies that are selected during
resolution.
Including a package as a constraint will _not_ trigger installation of the package on its
own; instead, the package must be requested elsewhere in the project's first-party or
transitive dependencies.
!!! note
In `uv lock`, `uv sync`, and `uv run`, uv will only read `constraint-dependencies` from
the `pyproject.toml` at the workspace root, and will ignore any declarations in other
workspace members or `uv.toml` files.
**Default value**: `[]`
**Type**: `list[str]`
**Example usage**:
=== "pyproject.toml"
```toml
[tool.uv]
# Ensure that the grpcio version is always less than 1.65, if it's requested by a
# transitive dependency.
constraint-dependencies = ["grpcio<1.65"]
```
=== "uv.toml"
```toml
# Ensure that the grpcio version is always less than 1.65, if it's requested by a
# transitive dependency.
constraint-dependencies = ["grpcio<1.65"]
```
---
#### [`dev-dependencies`](#dev-dependencies) {: #dev-dependencies }
The project's development dependencies. Development dependencies will be installed by
default in `uv run` and `uv sync`, but will not appear in the project's published metadata.
**Default value**: `[]`
**Type**: `list[str]`
**Example usage**:
=== "pyproject.toml"
```toml
[tool.uv]
dev-dependencies = ["ruff==0.5.0"]
```
=== "uv.toml"
```toml
dev-dependencies = ["ruff==0.5.0"]
```
---
#### [`environments`](#environments) {: #environments }
A list of supported environments against which to resolve dependencies.
By default, uv will resolve for all possible environments during a `uv lock` operation.
However, you can restrict the set of supported environments to improve performance and avoid
unsatisfiable branches in the solution space.
These environments will also respected when `uv pip compile` is invoked with the
`--universal` flag.
**Default value**: `[]`
**Type**: `str | list[str]`
**Example usage**:
=== "pyproject.toml"
```toml
[tool.uv]
# Resolve for macOS, but not for Linux or Windows.
environments = ["sys_platform == 'darwin'"]
```
=== "uv.toml"
```toml
# Resolve for macOS, but not for Linux or Windows.
environments = ["sys_platform == 'darwin'"]
```
---
#### [`exclude-newer`](#exclude-newer) {: #exclude-newer }
Limit candidate packages to those that were uploaded prior to the given date. Limit candidate packages to those that were uploaded prior to the given date.
@ -383,7 +480,7 @@ system's configured time zone.
--- ---
#### [`extra-index-url`](#extra-index-url) {: #extra-index-url } ### [`extra-index-url`](#extra-index-url) {: #extra-index-url }
Extra URLs of package indexes to use, in addition to `--index-url`. Extra URLs of package indexes to use, in addition to `--index-url`.
@ -417,7 +514,7 @@ To control uv's resolution strategy when multiple indexes are present, see
--- ---
#### [`find-links`](#find-links) {: #find-links } ### [`find-links`](#find-links) {: #find-links }
Locations to search for candidate distributions, in addition to those found in the registry Locations to search for candidate distributions, in addition to those found in the registry
indexes. indexes.
@ -449,7 +546,7 @@ formats described above.
--- ---
#### [`index-strategy`](#index-strategy) {: #index-strategy } ### [`index-strategy`](#index-strategy) {: #index-strategy }
The strategy to use when resolving against multiple index URLs. The strategy to use when resolving against multiple index URLs.
@ -483,7 +580,7 @@ same name to a secondary.
--- ---
#### [`index-url`](#index-url) {: #index-url } ### [`index-url`](#index-url) {: #index-url }
The URL of the Python package index (by default: <https://pypi.org/simple>). The URL of the Python package index (by default: <https://pypi.org/simple>).
@ -514,7 +611,7 @@ The index provided by this setting is given lower priority than any indexes spec
--- ---
#### [`keyring-provider`](#keyring-provider) {: #keyring-provider } ### [`keyring-provider`](#keyring-provider) {: #keyring-provider }
Attempt to use `keyring` for authentication for index URLs. Attempt to use `keyring` for authentication for index URLs.
@ -542,7 +639,7 @@ use the `keyring` CLI to handle authentication.
--- ---
#### [`link-mode`](#link-mode) {: #link-mode } ### [`link-mode`](#link-mode) {: #link-mode }
The method to use when installing packages from the global cache. The method to use when installing packages from the global cache.
@ -575,33 +672,7 @@ Windows.
--- ---
#### [`managed`](#managed) {: #managed } ### [`native-tls`](#native-tls) {: #native-tls }
Whether the project is managed by uv. If `false`, uv will ignore the project when
`uv run` is invoked.
**Default value**: `true`
**Type**: `bool`
**Example usage**:
=== "pyproject.toml"
```toml
[tool.uv]
managed = false
```
=== "uv.toml"
```toml
managed = false
```
---
#### [`native-tls`](#native-tls) {: #native-tls }
Whether to load TLS certificates from the platform's native certificate store. Whether to load TLS certificates from the platform's native certificate store.
@ -634,7 +705,7 @@ included in your system's certificate store.
--- ---
#### [`no-binary`](#no-binary) {: #no-binary } ### [`no-binary`](#no-binary) {: #no-binary }
Don't install pre-built wheels. Don't install pre-built wheels.
@ -662,7 +733,7 @@ pre-built wheels to extract package metadata, if available.
--- ---
#### [`no-binary-package`](#no-binary-package) {: #no-binary-package } ### [`no-binary-package`](#no-binary-package) {: #no-binary-package }
Don't install pre-built wheels for a specific package. Don't install pre-built wheels for a specific package.
@ -687,7 +758,7 @@ Don't install pre-built wheels for a specific package.
--- ---
#### [`no-build`](#no-build) {: #no-build } ### [`no-build`](#no-build) {: #no-build }
Don't build source distributions. Don't build source distributions.
@ -716,7 +787,7 @@ distributions will exit with an error.
--- ---
#### [`no-build-isolation`](#no-build-isolation) {: #no-build-isolation } ### [`no-build-isolation`](#no-build-isolation) {: #no-build-isolation }
Disable isolation when building source distributions. Disable isolation when building source distributions.
@ -744,7 +815,7 @@ are already installed.
--- ---
#### [`no-build-isolation-package`](#no-build-isolation-package) {: #no-build-isolation-package } ### [`no-build-isolation-package`](#no-build-isolation-package) {: #no-build-isolation-package }
Disable isolation when building source distributions for a specific package. Disable isolation when building source distributions for a specific package.
@ -772,7 +843,7 @@ are already installed.
--- ---
#### [`no-build-package`](#no-build-package) {: #no-build-package } ### [`no-build-package`](#no-build-package) {: #no-build-package }
Don't build source distributions for a specific package. Don't build source distributions for a specific package.
@ -797,7 +868,7 @@ Don't build source distributions for a specific package.
--- ---
#### [`no-cache`](#no-cache) {: #no-cache } ### [`no-cache`](#no-cache) {: #no-cache }
Avoid reading from or writing to the cache, instead using a temporary directory for the Avoid reading from or writing to the cache, instead using a temporary directory for the
duration of the operation. duration of the operation.
@ -823,7 +894,7 @@ duration of the operation.
--- ---
#### [`no-index`](#no-index) {: #no-index } ### [`no-index`](#no-index) {: #no-index }
Ignore all registry indexes (e.g., PyPI), instead relying on direct URL dependencies and Ignore all registry indexes (e.g., PyPI), instead relying on direct URL dependencies and
those provided via `--find-links`. those provided via `--find-links`.
@ -849,7 +920,7 @@ those provided via `--find-links`.
--- ---
#### [`no-sources`](#no-sources) {: #no-sources } ### [`no-sources`](#no-sources) {: #no-sources }
Ignore the `tool.uv.sources` table when resolving dependencies. Used to lock against the 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 standards-compliant, publishable package metadata, as opposed to using any local or Git
@ -876,7 +947,7 @@ sources.
--- ---
#### [`offline`](#offline) {: #offline } ### [`offline`](#offline) {: #offline }
Disable network access, relying only on locally cached data and locally available files. Disable network access, relying only on locally cached data and locally available files.
@ -901,83 +972,7 @@ Disable network access, relying only on locally cached data and locally availabl
--- ---
#### [`override-dependencies`](#override-dependencies) {: #override-dependencies } ### [`prerelease`](#prerelease) {: #prerelease }
Overrides to apply when resolving the project's dependencies.
Overrides are used to force selection of a specific version of a package, regardless of the
version requested by any other package, and regardless of whether choosing that version
would typically constitute an invalid resolution.
While constraints are _additive_, in that they're combined with the requirements of the
constituent packages, overrides are _absolute_, in that they completely replace the
requirements of any constituent packages.
!!! note
In `uv lock`, `uv sync`, and `uv run`, uv will only read `override-dependencies` from
the `pyproject.toml` at the workspace root, and will ignore any declarations in other
workspace members or `uv.toml` files.
**Default value**: `[]`
**Type**: `list[str]`
**Example usage**:
=== "pyproject.toml"
```toml
[tool.uv]
# Always install Werkzeug 2.3.0, regardless of whether transitive dependencies request
# a different version.
override-dependencies = ["werkzeug==2.3.0"]
```
=== "uv.toml"
```toml
# Always install Werkzeug 2.3.0, regardless of whether transitive dependencies request
# a different version.
override-dependencies = ["werkzeug==2.3.0"]
```
---
#### [`package`](#package) {: #package }
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).
**Default value**: `true`
**Type**: `bool`
**Example usage**:
=== "pyproject.toml"
```toml
[tool.uv]
package = false
```
=== "uv.toml"
```toml
package = false
```
---
#### [`prerelease`](#prerelease) {: #prerelease }
The strategy to use when considering pre-release versions. The strategy to use when considering pre-release versions.
@ -1012,7 +1007,7 @@ declared specifiers (`if-necessary-or-explicit`).
--- ---
#### [`preview`](#preview) {: #preview } ### [`preview`](#preview) {: #preview }
Whether to enable experimental, preview features. Whether to enable experimental, preview features.
@ -1037,7 +1032,7 @@ Whether to enable experimental, preview features.
--- ---
#### [`python-downloads`](#python-downloads) {: #python-downloads } ### [`python-downloads`](#python-downloads) {: #python-downloads }
Whether to allow Python downloads. Whether to allow Python downloads.
@ -1066,7 +1061,7 @@ Whether to allow Python downloads.
--- ---
#### [`python-preference`](#python-preference) {: #python-preference } ### [`python-preference`](#python-preference) {: #python-preference }
Whether to prefer using Python installations that are already present on the system, or Whether to prefer using Python installations that are already present on the system, or
those that are downloaded and installed by uv. those that are downloaded and installed by uv.
@ -1097,7 +1092,7 @@ those that are downloaded and installed by uv.
--- ---
#### [`reinstall`](#reinstall) {: #reinstall } ### [`reinstall`](#reinstall) {: #reinstall }
Reinstall all packages, regardless of whether they're already installed. Implies `refresh`. Reinstall all packages, regardless of whether they're already installed. Implies `refresh`.
@ -1122,7 +1117,7 @@ Reinstall all packages, regardless of whether they're already installed. Implies
--- ---
#### [`reinstall-package`](#reinstall-package) {: #reinstall-package } ### [`reinstall-package`](#reinstall-package) {: #reinstall-package }
Reinstall a specific package, regardless of whether it's already installed. Implies Reinstall a specific package, regardless of whether it's already installed. Implies
`refresh-package`. `refresh-package`.
@ -1148,7 +1143,7 @@ Reinstall a specific package, regardless of whether it's already installed. Impl
--- ---
#### [`resolution`](#resolution) {: #resolution } ### [`resolution`](#resolution) {: #resolution }
The strategy to use when selecting between the different compatible versions for a given The strategy to use when selecting between the different compatible versions for a given
package requirement. package requirement.
@ -1180,7 +1175,7 @@ By default, uv will use the latest compatible version of each package (`highest`
--- ---
#### [`upgrade`](#upgrade) {: #upgrade } ### [`upgrade`](#upgrade) {: #upgrade }
Allow package upgrades, ignoring pinned versions in any existing output file. Allow package upgrades, ignoring pinned versions in any existing output file.
@ -1205,7 +1200,7 @@ Allow package upgrades, ignoring pinned versions in any existing output file.
--- ---
#### [`upgrade-package`](#upgrade-package) {: #upgrade-package } ### [`upgrade-package`](#upgrade-package) {: #upgrade-package }
Allow upgrades for a specific package, ignoring pinned versions in any existing output Allow upgrades for a specific package, ignoring pinned versions in any existing output
file. file.
@ -1233,7 +1228,7 @@ Accepts both standalone package names (`ruff`) and version specifiers (`ruff<0.5
--- ---
## `pip` ### `pip`
Settings that are specific to the `uv pip` command-line interface. Settings that are specific to the `uv pip` command-line interface.
@ -2794,66 +2789,3 @@ include them.
--- ---
## `workspace`
#### [`exclude`](#workspace_exclude) {: #workspace_exclude }
<span id="exclude"></span>
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](https://docs.rs/glob/latest/glob/struct.Pattern.html).
**Default value**: `[]`
**Type**: `list[str]`
**Example usage**:
=== "pyproject.toml"
```toml
[tool.uv.workspace]
exclude = ["member1", "path/to/member2", "libs/*"]
```
=== "uv.toml"
```toml
[workspace]
exclude = ["member1", "path/to/member2", "libs/*"]
```
---
#### [`members`](#workspace_members) {: #workspace_members }
<span id="members"></span>
Packages to include as workspace members.
Supports both globs and explicit paths.
For more information on the glob syntax, refer to the [`glob` documentation](https://docs.rs/glob/latest/glob/struct.Pattern.html).
**Default value**: `[]`
**Type**: `list[str]`
**Example usage**:
=== "pyproject.toml"
```toml
[tool.uv.workspace]
members = ["member1", "path/to/member2", "libs/*"]
```
=== "uv.toml"
```toml
[workspace]
members = ["member1", "path/to/member2", "libs/*"]
```
---