3 ms·
You can use 2 separate requirements files no? Pip install -f requirements.txt Pip freeze > requirements.lock.txt Pip install -f requirements.lock.txt
by TZubiri 2y ago
You can use 2 separate requirements files no?
Pip install -f requirements.txt
Pip freeze > requirements.lock.txt
Pip install -f requirements.lock.txt
- deleted 2y ago[deleted]
- sunshowers 2y agoThat's a bad developer experience. I'd rather just use uv.
- TZubiri 2y agoGood developers don't care about developer experience, we care about user experience. Get it done and move on. Write the 3 commands in a shell file called "build.sh" if it's too much trouble. Boom done.
- sunshowers 2y agoI'm a builder of, among other things, developer tools. From my perspective, the developer experience is the user experience I'm delivering. From the perspective of someone new to programming, the developer experience we deliver is the user experience they encounter. It is extraordinarily important that it be good. Again, I would simply rather use uv -- I really appreciate the thoughtful engineering that's gone into it. It solves this problem completely, along with many others. (For example, uv.lock is platform-independent.) I'm okay with the occasional workaround, but I think we should generally expect, and aim for, excellence with our tools.
- from-nibly 2y agoNo good developers know and understand their tools. They care for them and they learn about them. Wood carvers don't use butter knives because "good woodcarvers don't care about their experience while woodcarving".
- bdangubic 2y agogood developers do not care, great ones do
- zahlman 2y agoA few lines of shell script remedies that rather nicely. And there will be times when you need to choose between installing from fully resolved, pinned dependencies versus abstract immediate ones.
- sunshowers 2y agouv solves this better, including supporting Windows, and with significantly better error reporting. It even installs Python for you. uv also has platform-independent lockfiles and a number of other features. Oh, and it's a lot faster as well. Have higher standards for your devtools.
- instig007 2y agoNix solves this better, including supporting Windows, and with significantly better error reporting. It even installs Python for you. Nix also has platform-independent lockfiles and a number of other features. Oh, and it's a lot faster as well. Have higher standards for your devtools.
- sunshowers 2y agoNix is quite a bit harder to use, and absolutely does not support Windows. (WSL is nice, but does not count as supporting Windows.) Nix is also what I like to call "totalizing" — in order to use Nix you must fit everything into the Nix world. This has many advantages (as do Buck2 and Bazel which are similarly totalizing), but is also quite onerous and might not be desirable. Further, I believe Nix makes pinning to old versions of a dependency, and maintaining custom patches on top of a dependency, somewhat difficult.
- Too 2y agoYes, except they should be used together, like this. pip install -r requirements.txt -c requirements.lock.txt (Typically you would call that file constraints.txt) It must be done within one single install command. If you do it twice you can end up with version conflicts during the first install and the second install will either fail or start uninstalling stuff before it retries to find a compatible version. Rants that pip does not support lockfiles are mostly uneducated, no judgement in that, because it's so easy to miss when it's not the default and the documentation doesn't mention this crucial feature until very late in the chapters. 99% of all pip complaints would be resolved if they only introduced a convention that constraints.txt was automatically detected and installation failed if not found, unless providing a --i-dont-care-about-lockfiles argument.
- sunshowers 2y agoIs the same constraints.txt file generated across platforms? That not being the case makes it much harder—impossible in many cases—to check them in. uv solves this problem by generating lockfiles for the superset of all platforms, as do most other modern package managers.