News for hackers. Stuff that matters.
Re:Python and manually creating the requirements.txt vs. pip... by jmconfuzeus on Wednesday August 17, 2022 @10:26AM (#32496851)
Never use pip freeze.

Instead, install pip-tools[0] then use the pip-compile command.

Why?

pip freeze will also pin dependencies of your dependencies, which makes your requirements.txt hard to read and extend.

Never manually create requirements.txt either because a programmer's job is to automate boring tasks like dependency pinning.

[0] https://github.com/jazzband/pip-tools

Re:Python and manually creating the requirements.txt vs. pip... by robinweiss on Wednesday August 17, 2022 @01:09PM (#32499000)
What's bad about pinning the transitive dependencies? I feel otherwise this could lead to really hard to debug errors down the road if second-order dependency versions diverge between developers.

And I fully agree on the tools. I personally would always use something like pip-tools or poetry, but it's not always an option to use them, unfortunately.