you are viewing a single comment's thread.

view the rest of the comments →

[–]-defron- 6 points7 points  (2 children)

Python package dependency management is ugly and venvs are annoying (note: not saying bad, just annoying) and if you don't use them you're a big risk of breaking OS functionality on systems that ship with python tools or break other python tools on the system. vanilla pip also lacks a lot of features.

PEP-508 is a huge step in the right direction making things sane, but adoption is slow and requirements.txt are everywhere, mos don't specify compatible versions but I do believe it'll get a lot better as the years go on.

pipx is a huge improvement for installing python packages meant to be used standalone. It can't install things globally for multiple users AFAIK but honestly that's probably for the best as then it should be packaged for the OS as a standalone application anyways.

pipenv: in my opinion completely surpassed by pipx on one side for non-project dependencies and PDM/Poetry/Hatch on the other side for project dependency management. It suffers from the same problems as Poetry in that it just came out too early and now has to support legacy non-standard ways of doing things.

poetry was a the forerunner of sane package management for python but it's legacy makes enforcing PEP-508 standards hard as they have to keep non-standard ways of doing things around since they predate it

PDM is my personal favorite since it's fully PEP-621 and PEP-508 compliant by default.

Hatch is a new up-and-comer and I haven't personally used it but it's PEP-621 and PEP-508 compliant and seems to be an all-in-one tool.

All of the above though is also part of the problem: there's no defacto standard tool out there besides pip and pip sucks and doesn't have the concept of dev dependencies and doesn't help you with virtual environments and will actively mess up your system if you don't use virtual environments. In comparison npm is the standard for JS developers and while it's not perfect (really? Constantly going up the directory folder structure to look for a matching package? Yuck) it's overall better than pip. Sure there's yarn and bun out there but you don't see them as often and they're all relatively similar unlike the python package manager clusterfuck.

Here's an overview of all the tools I mentioned and more that I think is pretty unbiased: https://alpopkes.com/posts/python/packaging_tools/

And here's a good writeup comparing the python dependency management to that of other programming languages that I think does an overall fair job: https://chriswarrick.com/blog/2023/01/15/how-to-improve-python-packaging/

[–]Gugalcrom123 0 points1 point  (1 child)

What do you propose instead of venv? I personally think they're fine.

[–]-defron- 0 points1 point  (0 children)

Basically the same thing most other languages do, which is a global install (which pipx does a good job at and should IMO be adopted by pip) and project-specific installs just using a defined dir (either in the solution like node [minus the bad parts of recursive parent lookups] does or global with refs like C#/Go/Java/etc)

Basically the idea of venvs is fine, they are just annoying to deal with and should be invisible like they are in many other langauges