diff --git a/crates/uv-cli/src/lib.rs b/crates/uv-cli/src/lib.rs index 68d8a4d0d..f88334471 100644 --- a/crates/uv-cli/src/lib.rs +++ b/crates/uv-cli/src/lib.rs @@ -625,6 +625,14 @@ pub enum PipCommand { )] Compile(PipCompileArgs), /// Sync an environment with a `requirements.txt` file. + /// + /// When syncing an environment, any packages not listed in the `requirements.txt` file will + /// be removed. To retain extraneous packages, use `uv pip install` instead. + /// + /// The `requirements.txt` file is presumed to be the output of a `pip compile` or `uv export` + /// operation, in which it will include all transitive dependencies. If transitive dependencies + /// are not present in the file, they will not be installed. Use `--strict` to warn if any + /// transitive dependencies are missing. #[command( after_help = "Use `uv help pip sync` for more details.", after_long_help = "" diff --git a/docs/reference/cli.md b/docs/reference/cli.md index 95f0ebde9..293a41e6c 100644 --- a/docs/reference/cli.md +++ b/docs/reference/cli.md @@ -6111,7 +6111,11 @@ uv pip compile [OPTIONS] > ### uv pip sync -Sync an environment with a `requirements.txt` file +Sync an environment with a `requirements.txt` file. + +When syncing an environment, any packages not listed in the `requirements.txt` file will be removed. To retain extraneous packages, use `uv pip install` instead. + +The `requirements.txt` file is presumed to be the output of a `pip compile` or `uv export` operation, in which it will include all transitive dependencies. If transitive dependencies are not present in the file, they will not be installed. Use `--strict` to warn if any transitive dependencies are missing.

Usage