4 ms·
The design of requirements.txt is a bit outdated -- it commits the first sin of developer tooling, which is to mix manually edited and automatically generated (
by sunshowers 2y ago
The design of requirements.txt is a bit outdated -- it commits the first sin of developer tooling, which is to mix manually edited and automatically generated (via pip freeze) files. Newer systems use separate lockfiles for that reason, and uv brings this state of the art to Python.
- otteromkram 2y agoThat's why I have a requirements folder with separate files (eg - dev.txt, prod.txt) for various installation needs. If you want to include test dependencies in development, just add it into the file like you're installing a regular requirements file: -r test.txt And, to double-down, if you read the pip documentation (the second sin of software development?), you can use things other than pip freeze. Like, python -m pip list --not-required That option flag is pretty nice because it excludes packages that aren't dependencies (aka - the primary packages that you need). If you do that you don't to worry about dependency management as much.
- janice1999 2y agoI think 'pip freeze' was introduced later and requirements.txt was not designed with such a use in mind. pipenv and other tools have lockfile equivalents for a while.
- askonomm 2y agoAnd that makes this, what, the 100th package management solution for Python? A big reason why Python package management sucks is because there are as many package managers as there are frameworks in JavaScript. Nobody ever knows what is the standard, and by the time that information propagates, it is no longer the standard.
- sunshowers 2y agoI believe and hope that uv settles this discussion.
- mmcnl 2y agoIs it really such a big deal that there are multiple "good enough" solutions available? I understand it is suboptimal, especially for beginners, but dependency management in Python is a solved problem for a while now. And also there are not that many solutions. Previously Poetry was the best, now uv is looking to take its place. Not 100 different solutions imo.
- TZubiri 2y agoYou 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 ago
- deleted 2y ago[deleted]