Pip 26.2 Gets a --only-deps Flag: The End of a 16-Year Dependency Saga

Translated by a model; the original is in Russian.

· Программы
After nearly two decades of workarounds, pip is finally getting an option to install a project's dependencies without installing the project itself.

cover.svg

The upcoming pip 26.2, expected to ship in July 2026, is set to introduce a new --only-deps flag. It lets you install all of a project's dependencies as listed in pyproject.toml without installing the project itself as a package:

pip install --only-deps .
pip install --only-deps .[doc]

The second form additionally pulls in optional dependencies. Pull request #13895, which implements the feature, was opened by Sebastian Höffner on April 8, 2026; it builds on a long-running discussion in issue #11440, first raised back in September 2022.

Why this matters

The task sounds simple, yet for decades it had no clean solution. It concerns projects that aren't meant to be installed as a library: application backends, REST APIs, ordinary scripts. They need their dependencies, but not to have their own code installed as a package.

The author recalls the familiar hacks. The classic pip freeze pins the exact versions of every package, including dependencies of dependencies — but the result ends up tied to a specific machine, Python version and OS, and in a different environment the install often breaks. Hence recipes like pip freeze --local | grep -v '^\-e' | cut -d = -f 1 that strip out the version numbers, and eventually just maintaining requirements.txt by hand.

The command pip install -e . has worked ever since pip first appeared in 2008 and remains a quick way to install a list of dependencies, but it installs the package itself as well. For applications that's unnecessary, and editable installs are, on top of that, not considered good practice for deployment.

A long road for the community

The author traces a chain of StackOverflow questions: 16 years ago the advice was pip install -e ., later it was the third-party tools pip-chill, pipreqs, then poetry and hatch, and a year ago uv. Each successive tool solved the problem a little better than the last.

The groundwork was laid by standards: PEP 517 (2017) added build-system hooks to pyproject.toml, and PEP 735 (2023) introduced dependency groups, making it possible to choose exactly which sets to install.

The author singles out the role of uv — a tool whose speed and thoughtful interface (for instance, uv sync --no-install-project) showed just how much pent-up demand there was, and, it seems, nudged long-stuck changes in pip itself into motion.

The author sizes up the outcome without fanfare: a small but pleasant quality-of-life improvement that the Python community spent nearly twenty years reaching — through the work of PEP authors, pip maintainers and third-party package developers.


Source: Lobsters

Comments

Sign in, to comment.

  • No comments yet.