Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions docs/concepts/projects/sync.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions docs/guides/projects.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`:

Expand Down
2 changes: 2 additions & 0 deletions docs/js/extra.js
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
Loading