doc: tweak docs a bit

We also update the docs for flags like `--extra` to note that they may
result in an error if they try to enable extras that are conflicting.
This commit is contained in:
Andrew Gallant 2024-11-14 07:47:25 -05:00 committed by Andrew Gallant
parent c68e0d624e
commit e310dcc7c1
4 changed files with 39 additions and 24 deletions

View file

@ -2804,6 +2804,9 @@ pub struct SyncArgs {
///
/// May be provided more than once.
///
/// When multiple extras or groups are specified that appear in
/// `tool.uv.conflicts`, uv will report an error.
///
/// Note that all optional dependencies are always included in the resolution; this option only
/// affects the selection of packages to install.
#[arg(long, conflicts_with = "all_extras", value_parser = extra_name_with_clap_error)]
@ -2811,6 +2814,9 @@ pub struct SyncArgs {
/// Include all optional dependencies.
///
/// When two or more extras are declared as conflicting in
/// `tool.uv.conflicts`, using this flag will always result in an error.
///
/// Note that all optional dependencies are always included in the resolution; this option only
/// affects the selection of packages to install.
#[arg(long, conflicts_with = "extra")]
@ -2841,6 +2847,9 @@ pub struct SyncArgs {
/// Include dependencies from the specified dependency group.
///
/// When multiple extras or groups are specified that appear in
/// `tool.uv.conflicts`, uv will report an error.
///
/// May be provided multiple times.
#[arg(long, conflicts_with("only_group"))]
pub group: Vec<GroupName>,

View file

@ -462,23 +462,23 @@ pub struct ToolUv {
/// Conflicting extras or groups may be declared here.
///
/// It's useful to declare conflicting extras when the extras have mutually
/// incompatible dependencies. For example, extra `foo` might depend on
/// `numpy==2.0.0` while extra `bar` might depend on `numpy==2.1.0`. These
/// extras cannot be activated at the same time. This usually isn't a
/// problem for pip-style workflows, but when using uv project support
/// with universal resolution, it will try to produce a resolution that
/// satisfies both extras simultaneously.
/// It's useful to declare conflicts when, for example, two or more extras
/// have mutually incompatible dependencies. Extra `foo` might depend
/// on `numpy==2.0.0` while extra `bar` might depend on `numpy==2.1.0`.
/// These extras cannot be activated at the same time. This usually isn't
/// a problem for pip-style workflows, but when using projects in uv that
/// support with universal resolution, it will try to produce a resolution
/// that satisfies both extras simultaneously.
///
/// When this happens, resolution will fail, because one cannot install
/// both `numpy 2.0.0` and `numpy 2.1.0` into the same environment.
///
/// To work around this, you may specify `foo` and `bar` as conflicting
/// extras. When doing universal resolution in project mode, these extras
/// will get their own "forks" distinct from one another in order to permit
/// conflicting dependencies. In exchange, if one tries to install from the
/// lock file with both conflicting extras activated, installation will
/// fail.
/// extras (you can do the same with groups). When doing universal
/// resolution in project mode, these extras will get their own "forks"
/// distinct from one another in order to permit conflicting dependencies.
/// In exchange, if one tries to install from the lock file with both
/// conflicting extras activated, installation will fail.
#[cfg_attr(
feature = "schemars",
schemars(description = "A list sets of conflicting groups or extras.")

View file

@ -1390,6 +1390,8 @@ uv sync [OPTIONS]
<dl class="cli-reference"><dt><code>--all-extras</code></dt><dd><p>Include all optional dependencies.</p>
<p>When two or more extras are declared as conflicting in <code>tool.uv.conflicts</code>, using this flag will always result in an error.</p>
<p>Note that all optional dependencies are always included in the resolution; this option only affects the selection of packages to install.</p>
</dd><dt><code>--all-packages</code></dt><dd><p>Sync all packages in the workspace.</p>
@ -1462,6 +1464,8 @@ uv sync [OPTIONS]
<p>May be provided more than once.</p>
<p>When multiple extras or groups are specified that appear in <code>tool.uv.conflicts</code>, uv will report an error.</p>
<p>Note that all optional dependencies are always included in the resolution; this option only affects the selection of packages to install.</p>
</dd><dt><code>--extra-index-url</code> <i>extra-index-url</i></dt><dd><p>(Deprecated: use <code>--index</code> instead) Extra URLs of package indexes to use, in addition to <code>--index-url</code>.</p>
@ -1485,6 +1489,8 @@ uv sync [OPTIONS]
<p>May also be set with the <code>UV_FROZEN</code> environment variable.</p>
</dd><dt><code>--group</code> <i>group</i></dt><dd><p>Include dependencies from the specified dependency group.</p>
<p>When multiple extras or groups are specified that appear in <code>tool.uv.conflicts</code>, uv will report an error.</p>
<p>May be provided multiple times.</p>
</dd><dt><code>--help</code>, <code>-h</code></dt><dd><p>Display the concise help for this command</p>

View file

@ -3,23 +3,23 @@
Conflicting extras or groups may be declared here.
It's useful to declare conflicting extras when the extras have mutually
incompatible dependencies. For example, extra `foo` might depend on
`numpy==2.0.0` while extra `bar` might depend on `numpy==2.1.0`. These
extras cannot be activated at the same time. This usually isn't a
problem for pip-style workflows, but when using uv project support
with universal resolution, it will try to produce a resolution that
satisfies both extras simultaneously.
It's useful to declare conflicts when, for example, two or more extras
have mutually incompatible dependencies. Extra `foo` might depend
on `numpy==2.0.0` while extra `bar` might depend on `numpy==2.1.0`.
These extras cannot be activated at the same time. This usually isn't
a problem for pip-style workflows, but when using projects in uv that
support with universal resolution, it will try to produce a resolution
that satisfies both extras simultaneously.
When this happens, resolution will fail, because one cannot install
both `numpy 2.0.0` and `numpy 2.1.0` into the same environment.
To work around this, you may specify `foo` and `bar` as conflicting
extras. When doing universal resolution in project mode, these extras
will get their own "forks" distinct from one another in order to permit
conflicting dependencies. In exchange, if one tries to install from the
lock file with both conflicting extras activated, installation will
fail.
extras (you can do the same with groups). When doing universal
resolution in project mode, these extras will get their own "forks"
distinct from one another in order to permit conflicting dependencies.
In exchange, if one tries to install from the lock file with both
conflicting extras activated, installation will fail.
**Default value**: `[]`