17 points · by ceocoder · 12y ago · 25 comments
In this case I don't think either tool is needed - pip-sync is really trying to avoid tearing down and rebuilding cleanly a virtual env - which is the whole point of virtual environments anyway.
Anyway - yes we need to fix python package management. No there is not a clear solution. But then apt-get, Tuesday updates and gems don't work "right" either.
Even small projects get cluttered requirements.txt files very fast, causing unneeded packages to spread like viruses from venv to venv, requiring coordination from the whole team to definitely eradicate, because one member's sloppy hygiene spreads the contagion back to everyone.
I don't know if pip-compile is the right answer to that problem, but it certainly seems to go in the right direction, providing living documentation of your direct requirements in the requirements.in file.
IMHO we'd first need to standardize how dependencies are managed (requirements.txt, setup.py ...)and then build a solution off that. if you have requirements.txt-based setup, is easy to e.g. recursively download/parse to get the full list of dependencies.
The requirements.in file reminds me of automake.
Right at this moment, with Docker coming to the fore, it's easy to imagine a world where it doesn't matter anymore.
If I install an app/package for development, then I'd need development dependencies (like test-related packages etc.). I'm not supposed to know/care what the third party code needs for testing; just when I start testing the relevant code should "just work". Also, if I'm in production the testing-related packages should not pollute my environment...
I'd love to see Pip, Bundler/Rubygems, NPM, Cabal, Maven, etc. replaced by a single tool (or maybe two: dependency management and package installation).
To be more exact, how many times have you customised your setup.py file? edited its dependencies and so on..? Imagine doing that in a totally different system (like debian packaging).
You can even now manage your dependencies and install scripts with something like automake or a homemade solution. Not really portable but if you don't care about your code being a module part of a bigger system...
(Maybe I need to read the entire virtualenv documentation, to have a solid idea of how it works, and what it does exactly, but hen that will take time, and the PYTHONPATH option starts to look more appealing, as at least I do know how environmental variables work in Linux).