News for hackers. Stuff that matters.
Re:Why not tell people to “simply” use pyenv, poetry or anac... by heywhatupboys on Tuesday June 13, 2023 @07:22AM (#36308500)
Python's package ecosystem is probably the worst in the world
Re:Why not tell people to “simply” use pyenv, poetry or anac... by rcfox on Tuesday June 13, 2023 @07:31AM (#36308600)
Worse than Javascript's 5+ different types of mostly incompatible module formats, transpilers for different version targets, megalithic node_modules directories and the community's love of importing new packages for one-line functions that can disappear and take down the internet?
Re:Why not tell people to “simply” use pyenv, poetry or anac... by linkdd on Tuesday June 13, 2023 @07:35AM (#36308656)
How is `node_modules` different from `/path/to/venv/lib/python3.X/site-packages` ?

Are PyPI, cargo, Maven, etc... all immune to supply chain attacks?

Re:Why not tell people to “simply” use pyenv, poetry or anac... by rcfox on Tuesday June 13, 2023 @07:57AM (#36308931)
One major difference is a venv doesn't allow nested dependencies. With npm, you might install version 2.3 of a package, only to find that some other package has installed version 1.4 under itself.

Python also has "wheels", which are pre-compiled distributions, rather than full-source distributions. These are often smaller and install faster.

Re:Why not tell people to “simply” use pyenv, poetry or anac... by heywhatupboys on Tuesday June 13, 2023 @04:59PM (#36317235)
> One major difference is a venv doesn't allow nested dependencies. With npm, you might install version 2.3 of a package, only to find that some other package has installed version 1.4 under itself.

a feature not a bug. Anyone who ahs built a sufficiently large project and had to abandon some dependencies know this pain

Re:Why not tell people to “simply” use pyenv, poetry or anac... by jeltz on Tuesday June 13, 2023 @07:44AM (#36308778)
Yes. Which is quite impressive.
Re:Why not tell people to “simply” use pyenv, poetry or anac... by whywhywhywhy on Tuesday June 13, 2023 @08:11AM (#36309076)
As much as we all have criticized the npm ecosystem, after seeing what exists in the python world I actually came round to it and consider it very good.
Re:Why not tell people to “simply” use pyenv, poetry or anac... by wongarsu on Tuesday June 13, 2023 @07:33AM (#36308628)
In Python at least you "only" have to figure out venv, pip and conda and you're mostly set. In C/C++ world adding a dependency is such a pain that most projects have less than five dependencies. Most of the time it's simpler to just quickly write and debug a worse version yourself than to figure out how to find and integrate a library. Until you reach sufficient scale, at which point the sane thing seems to be to make your own build system instead
Re:Why not tell people to “simply” use pyenv, poetry or anac... by logicchains on Tuesday June 13, 2023 @07:39AM (#36308713)
>In Python at least you "only" have to figure out venv, pip and conda and you're mostly set. In C/C++ world adding a dependency is such a pain that most projects have less than five dependencies. Most of the time it's simpler to just quickly write and debug a worse version yourself than to figure out how to find and integrate a library.

That's from the developer's perspective, not the user's. The user of a C++ project doesn't have to care about any of that; they just run the binary, or ./configure && make to build from source. The user of a Python project has to struggle through worst case days of pain depending on how many dependencies are randomly broken.

Re:Why not tell people to “simply” use pyenv, poetry or anac... by wongarsu on Tuesday June 13, 2023 @07:43AM (#36308764)
If your user is interacting with the package ecosystem, you already failed multiple steps. Which python projects are routinely doing, but that's a cultural issue about packaging.

For "users" that have to touch the code: well, those get the full developer's perspective. And I've lost more hours than I would like to admit trying to get C++ projects to build. A project has to be really small or packaged really well to make it as simple as ./configure && make

Re:Why not tell people to “simply” use pyenv, poetry or anac... by artemonster on Tuesday June 13, 2023 @07:26AM (#36308548)
Can you elaborate what this system lacks or what are the key properties that make it „the worst“? I know its a mess, but I cant pinpoint the reason why.
Re:Why not tell people to “simply” use pyenv, poetry or anac... by throwawaaarrgh on Tuesday June 13, 2023 @07:35AM (#36308668)
The non-hierarchical, not-reused, reinvented package convention. The most popular package repository being incredibly hard to find one package you want among a sea of crap. The lack of a single standard solution to the most common problems. Frequent backwards compatibility issues.

It's definitely not the worst. But it's hilarious how bad it is considering how popular it is and how long it's been around

Re:Why not tell people to “simply” use pyenv, poetry or anac... by linkdd on Tuesday June 13, 2023 @07:33AM (#36308625)
Is the fact that there are multiple package managers for the same package fornat/spec the reason why people say it's a mess?

Genuine question: How is PyPI different from NPM, Maven, crates.io, etc..?

Why "Python packaging is a mess" and not the others?

Re:Why not tell people to “simply” use pyenv, poetry or anac... by kristofferR on Tuesday June 13, 2023 @07:33AM (#36308637)
That so many things doesn't run on the latest stable version is one of them. Python 3.11 was published in all the way back in October, and it's still not stable and well supported.
Re:Why not tell people to “simply” use pyenv, poetry or anac... by j16sdiz on Tuesday June 13, 2023 @07:29AM (#36308581)
try ruby.
Re:Why not tell people to “simply” use pyenv, poetry or anac... by Alifatisk on Tuesday June 13, 2023 @07:35AM (#36308657)
What's wrong with bundler / gem?
Re:Why not tell people to “simply” use pyenv, poetry or anac... by vocworker on Tuesday June 13, 2023 @07:45AM (#36308791)
System Ruby basically breaks "gem install", right? However once you install your own Ruby as a user, it's easy to use.

Interestingly, Ruby was the first language to improve on Perl's CPAN. Maven 2 was inspired by it.

For their age, bundler/gem do quite well.

Re:Why not tell people to “simply” use pyenv, poetry or anac... by jeltz on Tuesday June 13, 2023 @07:48AM (#36308837)
Yes, it is way better which is why many layer package managers, e.g. cargo and composer, took the ideas from Ruby to improve on. Ruby has issues but the package management is not one of them.