this post was submitted on 13 Oct 2023
326 points (81.6% liked)

Programmer Humor

32430 readers
1092 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 

Sorry Python but it is what it is.

you are viewing a single comment's thread
view the rest of the comments
[–] theFibonacciEffect@feddit.de 1 points 1 year ago (5 children)

If you want to export your local environment, isn't usually a requirements.txt used?

[–] JakobDev@feddit.de 5 points 1 year ago (3 children)

Yes, but this file is created by you and not pip. It's not like package.json from npm. You don't even need to create this file.

[–] theFibonacciEffect@feddit.de 2 points 1 year ago (2 children)

Well if the file would be created by hand, that's very cumbersome.

But what is sometimes done to create it automatically is using

pip freeze > requirements. txt

inside your virtual environment.

You said I don't need to create this file? How else will I distribute my environment so that it can be easily used? There are a lot of other standard, like setup.py etc, so it's only one possibility. But the fact that there are multiple competing standard shows that how pip handles this is kinds bad.

[–] JakobDev@feddit.de 2 points 1 year ago

If you try to keep your depencies low, it's not very cumbersome. I usually do that.

A setup.py/pyproject.toml can replace requirements. txt, but it is for creating packages and does way more than just installing dependencies, so they are not really competing.

For scripts which have just 1 or 2 packges as depencies it's also usuall to just tell people to run pip install .

load more comments (1 replies)
load more comments (1 replies)
load more comments (2 replies)