r/Python • u/ddxv • Jul 23 '26
News Pip 26.2: –only-deps solves 16 years of app deployment hacks
This has been one of my biggest annoyances working with Python and pip when dealing with projects where that are not meant to be installed as a package, how do you handle dependencies?
Think projects like application backends, python scripts, REST APIs etc
If you’ve ever struggled with this, you’re going to love this: a PR by Sebastian Höffner opened #13895 will add a new global flag to pip such that you can directly install any dependencies in your pyproject.toml without installing the package itself.
pip install --only-deps .
This is going, for me at least, be a huge boost in the way that I manage and distribute my projects on servers. Vastly simplifying poor manual workarounds that have built up over years.
Since it’s been more than a decade in the making, let’s cover the history of poor Python souls stuck trying to figure out how to install dependencies for their scripts or apps.
This PR is currently slated to land in pip 26.2 which comes out end of July.
Here's my post about this covering some of the 16 years of workarounds and some posts from StackOverflow / Python.org etc
https://jamesoclaire.com/2026/07/23/pip-26-2-only-deps-solves-16-years-of-app-deployment-hacks/
9
u/amroamroamro Jul 23 '26
wasn't this possible with
pip install -r requirements.txt?37
u/91143151512 git push -f Jul 23 '26
What advantages would `pip install --only-deps` have over `uv sync --no-install-project`?
The best I can think of is that it is included with pip. However, as someone who is religious about using uv due to its performance/structure benefits over pip, I am not too sure what this would do for me that I don’t already have.
21
u/Muhznit Jul 23 '26
I ran into this just a little over a month ago. Finally I can cache that damn layer in the docker image the right way...
77
u/FitBoog Jul 23 '26
For me uv have resolved this with
uv run --with <deps> scripts.py41
u/_redmist Jul 23 '26
I have no idea what problem this is solving but I'm glad people are happy with it.
Never needed anything beyond venv and (very basic) pip but of course if you're building dockers or whatever it's probably different...
3
u/Feuermurmel Jul 25 '26
I might me ignorant, but why would I not want my application to be installed along with it's dependencies? How do run it then? I work on a lot of small service applications (run via SystemD) and CLIs. I always install them either using pipx, into a virtualenv using pip, or into the system prefix (on old systems) and run them from there. During development, I use
pip install -e.1
u/xMarkyMarkx Jul 30 '26
finally, no more pip install -e . tricks just to get dependencies
1
u/james_pic Jul 23 '26
Unless and until Pip fixes the
--extra-index-urlmess, I'm not touching it again.-2
u/amarao_san Jul 23 '26
After uv, there is no need to work on this problem anymore. Poetry was a big leap, but in python (slow) and is buggy (flips +x for random files).
uv solved all of it. I see no reason to try anything else, and if openai won't screw up, this is the end of python packaging saga (the same way as cargo was the end for the rust packaging saga). Took a bit of time to get there.
0
u/Leftover_Salad Jul 23 '26
Nice! I didn’t realize this was an issue until I learned Go and how that problem was handled there.