Add a --only-deps flag for pip install et al. (#13895)
This commit follows the agreed interface in [1]:
pip install . --only-deps # project.dependencies
pip install .[doc] --only-deps # project.dependencies and
project.optional-dependencies
If --only-deps or its longform --only-dependencies is provided, neither
the explicitly requested packages nor the build dependencies are
installed, instead only the "runtime" dependencies are used. In other
words, no user supplied packages will be installed, only their
dependencies. --only-deps and --no-deps are mutually exclusive and pip
will refuse to install anything if both are specified. Similarly,
--only-deps is mutually exclusive to -r / --requirements,
the legacy-resolver, and --group. Relevant explanations can be found
in the user guide, which now includes a section regarding --only-deps.
This also adds the --only-deps flag to wheel, lock, and download,
indicating a user only wants to handle dependencies of a package.
To test the changes more easily, the commit adds
PipTestResult.assert_not_installed and tests for it.
It's worth noting that no optimizations to read dependency metadata from
pyproject.toml directly are included. This is left as a possible future
enhancement if desired. S
Sebastian Höffner committed
790ae56bb6820ab0764ae2f311dddbaf4b4f7e3b
Parent: d4dfb8b
Committed by GitHub <noreply@github.com>
on 7/24/2026, 7:59:01 PM