Hacker News new | ask | show | jobs
by hobofan 547 days ago
> What I don't understand - what makes this so difficult to solve in Python?

I think there are many answers to this, and there are many factors contributing to it, but if I had to pick one: The setup.py file. It needs to be executed to determine the dependencies of a project. Since it's a script, that allows any maintainer of any package you are using to do arbitrarily complex/dumb stuff in it like e.g. conditionally adding dependencies based on host system specific environment markers, or introduce assumptions on the environment it is being installed to. That makes trying to achieve all the things you'f want from a modern package manager so much harder.

This also means that the problem isn't just concentrated in 1-2 central package management projects, but scattered throughout the ecosystem (and some of the worst offenders are some of Python's most popular sub-ecosystems).

There is some light with the introduction of the pyproject.toml, and now uv as a tool taking advantage of it.

2 comments

> The setup.py file. It needs to be executed to determine the dependencies of a project.

Yes, this should never have been allowed. It solved a problem in the short term but in the long term has caused no end of pain.

setup.py allowed arbitrary things, but at least it always went through setuptools (or closely related predecessors, such as distribute or distlib). There is now pyproject.toml, but at the same time, there are tons of build backends that can do different things. And one of the most popular modern packaging tools, poetry, uses a non-standard section for the package data.