mirror of
https://github.com/astral-sh/uv
synced 2026-01-21 05:20:09 -05:00
Clarify that uv run uses inexact syncing by default (#17366)
Closes #14230 Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -89,17 +89,25 @@ To opt-out of this behavior, use the `--no-editable` option.
|
||||
If the project does not define a build system, it will not be installed.
|
||||
See the [build systems](./config.md#build-systems) documentation for details.
|
||||
|
||||
### Retaining extraneous packages
|
||||
### Handling of extraneous packages
|
||||
|
||||
Syncing is "exact" by default, which means it will remove any packages that are not present in the
|
||||
lockfile.
|
||||
`uv sync` performs "exact" syncing by default, which means it will remove any packages that are not
|
||||
present in the lockfile.
|
||||
|
||||
To retain extraneous packages, use the `--inexact` option:
|
||||
To retain extraneous packages, use the `--inexact` flag:
|
||||
|
||||
```console
|
||||
$ uv sync --inexact
|
||||
```
|
||||
|
||||
In contrast, `uv run` uses "inexact" syncing by default, ensuring that all required packages are
|
||||
installed but not removing extraneous packages. To enable exact syncing with `uv run`, use the
|
||||
`--exact` flag:
|
||||
|
||||
```console
|
||||
$ uv run --exact ...
|
||||
```
|
||||
|
||||
### Syncing optional dependencies
|
||||
|
||||
uv reads optional dependencies from the `[project.optional-dependencies]` table. These are
|
||||
|
||||
@@ -198,8 +198,14 @@ version.
|
||||
|
||||
Prior to every `uv run` invocation, uv will verify that the lockfile is up-to-date with the
|
||||
`pyproject.toml`, and that the environment is up-to-date with the lockfile, keeping your project
|
||||
in-sync without the need for manual intervention. `uv run` guarantees that your command is run in a
|
||||
consistent, locked environment.
|
||||
in-sync without the need for manual intervention. `uv run` guarantees that your command is run in an
|
||||
environment with all required dependencies at their locked versions.
|
||||
|
||||
!!! note
|
||||
|
||||
`uv run` does not remove extraneous packages (those not in the lockfile) from the environment
|
||||
by default. See [handling of extraneous packages](../concepts/projects/sync.md#handling-of-extraneous-packages)
|
||||
for details.
|
||||
|
||||
For example, to use `flask`:
|
||||
|
||||
|
||||
@@ -88,6 +88,8 @@ document$.subscribe(function () {
|
||||
"concepts/projects/run/#legacy-scripts-on-windows",
|
||||
"concepts/projects/sync/#checking-if-the-lockfile-is-up-to-date":
|
||||
"concepts/projects/sync/#checking-the-lockfile",
|
||||
"concepts/projects/sync/#retaining-extraneous-packages":
|
||||
"concepts/projects/sync/#handling-of-extraneous-packages",
|
||||
"concepts/authentication/#git-authentication":
|
||||
"concepts/authentication/git/",
|
||||
"concepts/authentication/#git-credential-helpers":
|
||||
|
||||
Reference in New Issue
Block a user