this post was submitted on 13 Oct 2023
324 points (81.4% liked)

Programmer Humor

32721 readers
312 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
[–] ExLisper@linux.community 15 points 1 year ago (2 children)

This article someone linked is not 14 years old and it perfectly describes the mess python and pip are: https://chriswarrick.com/blog/2023/01/15/how-to-improve-python-packaging/

My favorite part is:

Most importantly: which tool should a beginner use? The PyPA has a few guides and tutorials, one is using pip + venv, another is using pipenv (why would you still do that?), and another tutorial that lets you pick between Hatchling (hatch’s build backend), setuptools, Flit, and PDM, without explaining the differences between them

But yes, following old blog post is the issue.

[–] GBU_28@lemm.ee 6 points 1 year ago (1 children)

Why not read the official python docs?

[–] NBJack@reddthat.com 2 points 1 year ago (1 children)

Hahaha!....

Oh shit, you're serious.

[–] GBU_28@lemm.ee 5 points 1 year ago (1 children)

They pretty simply describe how to handle a venv, pip, reqs, etc.

[–] NBJack@reddthat.com 4 points 1 year ago

Friend, while I appreciate the time and effort on the docs, it has a rather tiny section on one of the truly worst aspects of pip (and the only one that really guts usability): package conflicts.

Due to the nature of Python as an interpreted language, there is little that you can check in advance via automation around "can package A and package B coexist peacefully with the lowest common denominator of package X"? Will it work? Will it fail? Run your tool/code and hope for the best!

Pip is a nightmare with larger, spawling package solutions (i.e. a lot of the ML work out there). But even with the freshest of venv creations, things still go remarkably wrong rather quick in my experience. My favorite is when someone, somewhere in the dependency tree forgets to lock their version, which ends up blossoming into a ticking time bomb before it abruptly stops working.

Hopefully, your experiences have been far more pleasant than mine.

[–] jjjalljs@ttrpg.network 3 points 1 year ago (1 children)

If you’re using a manually managed venv, you need to remember to activate it, or to use the appropriate Python.

That really doesn't seem like a big ask.

I've been using python professionally for like 10 years and package management hasn't really been a big problem.

If you're doing professional work, you should probably be using docker or something anyway. Working on the host machine is just asking for "it works on my machine what do you mean it doesn't work in production?" issues.

[–] ExLisper@linux.community 0 points 1 year ago

No, actually most devs don't use docker like that. Not java devs, not JS devs, not rust devs. That is because maven, npm and cargo manage dependencies per project. You use it for python exactly because pip does it the wrong way and python has big compatibility issues.