this post was submitted on 13 Oct 2023
292 points (80.9% liked)

Programmer Humor

31324 readers
28 users here now

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

Rules:

founded 4 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
[–] Ascyron@lemmy.one 8 points 9 months ago (2 children)

Bruh idk why the difference... Educate me?

[–] theFibonacciEffect@feddit.de 3 points 9 months ago (2 children)

Pip stores everything inside of some random txt file that doesn't differentiate between packages and dependencies.

[–] JakobDev@feddit.de 11 points 9 months ago (1 children)

Pip stores nothing in a text file

[–] theFibonacciEffect@feddit.de 2 points 9 months ago (2 children)

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

[–] JakobDev@feddit.de 4 points 9 months ago (1 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 9 months 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 9 months 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 .

[–] Vash63@lemmy.world 2 points 9 months ago

I work with python professionally and would never do that. I add my actual imports to the requirements and if I forget I do it later as the package fails CI/CD tests.

[–] farent@lemmy.scam-mail.me 4 points 9 months ago

Isn't it called a requirements.txt because it's used to export your project requirements (dependencies), not all packages installed in your local pip environment?

[–] SSUPII@sopuli.xyz 4 points 9 months ago (1 children)

Honestly its a simple and straightforward solution. What's wrong with it?

[–] theFibonacciEffect@feddit.de 1 points 9 months ago* (last edited 9 months ago)

If newer versions are released and dependencies change you would still install the old dependencies. And if the dependencies are not stored you can't reproduce the exact same environment.

[–] ExLisper@linux.community 0 points 9 months ago (1 children)

cargo just works, it's great and everyone loves it.

npm has a lot of issues but in general does the job. When docs say do 'npm install X' you do it and it works.

pip is a mess. In my experience doing 'pip install X' will maybe install something but it will not work because some dependencies will be screwed up. Using it to distribute software is pointless.

[–] krimson@feddit.nl 18 points 9 months ago (3 children)

I use pip extensively and have zero issues.

npm pulls in a million dependencies for even the simplest functionality.

[–] QuazarOmega@lemy.lol 8 points 9 months ago (2 children)

Is that really the fault of the package manager or is it of the libraries you decide to use?

[–] ninpnin@sopuli.xyz 5 points 9 months ago (1 children)

Fault of the libraries you decide to use, i.e. any and all node libraries

[–] QuazarOmega@lemy.lol 1 points 9 months ago

Well if that's the case, can't argue with that lol

[–] Theharpyeagle@lemmy.world 1 points 9 months ago

Really the fault of js since its standard library is so lacking (leftpad, anyone?), but js wasn't built to do half the stuff it's being asked to do, anyway.

[–] qaz@lemmy.world 4 points 9 months ago (1 children)

You’ve never had broken dependencies?

[–] krimson@feddit.nl 5 points 9 months ago (1 children)

Nope. I know mixing pip with python packages installed through your systems package manager can be a problem but that’s why I containerize everything.

[–] qaz@lemmy.world 1 points 9 months ago

I separate everything in virtual environments myself, but in my opinion you shouldn't need to that to simply avoid breaking your system.

[–] ExLisper@linux.community -2 points 9 months ago (1 children)

It probably works for your own local project. After using it for couple of days to install some 3rd party tool my conclusion is that it has no idea about dependencies. It just downloads some dependencies in some random versions and than it never works. Completely useless.

[–] TunaCowboy@lemmy.world 0 points 9 months ago

This is clearly a layer 8 issue lmao.