Earlier quoted context omitted.
That's where we are as well, but yes the problems you didn't sidestep with poetry+docker are still there: the pypi fecosystem out there does not stop quantum fluctuations just because you want it to. If you pin too much you're not getting security fixes and if you don't pin enough, you get bitten every time a tertiary dep changes that you never asked for. Oh yeah and there are now trojans upstream almost daily.
Does any FOSS package ecosystem have a good solution to this particular set of problems? I know Go has historically done something interesting with selecting the "minimum viable version number" for each dependency, but that's the only relevant idea that comes to mind. With PyPi, at least it's relatively trivial to self-host a pypi instance and self-manage dependency updates. In the Python ecosystem (vs e.g. Node), at…
How to improve Python packaging
171–180 of 204 posts
Re: How to improve Python packaging
#172Please allow me to vent on python packaging. I was working to debug a very weird error that was happening in my code only when my app was raising a warning through my `warnings.py`. My code was importing numpy, which in turn was trying to import its own `warnings.py`, but because of the python environment precedence, it was loading my own `warnings.py` which unfortunately had the same name. How on earth was this some…
By the way I think there is a convention to handle these issues but it appears numpy isn't using it. If I remember correctly, any module with __ infront will be called {package}.__{module}.
Re: How to improve Python packaging
#173Earlier quoted context omitted.
I'd be keen to read your blog post if you have a link?
https://cedwards.xyz/breaking-up-with-python/ Bear in mind this was not written for an audience, let alone a HN audience.
...and having read it, the only thing I'd yell is that "I AGREE WITH ALL YOUR PAIN POINTS". Especially around documentation and package management.
I do like type annotations for improving the reading experience of Python codebases, even if you're not using a type checker, but trying to get people to use them consistently for new code in an org that has a large pre-existing codebase involves either a lot of carrots, or some CI based sticks, and I don't quite have the organisational influence to just drop that on people... ...yet.
Re: How to improve Python packaging
#174Glad to see this getting discussion. I hate virtualenvs for several of the reasons mentioned in the article - extra state to keep track of, and potentially installing packages to the wrong location if I failed to keep track of it. I always just force my user packages to work. I usually only use numpy/scipy/matplotlib and occasionally a few others so its not that hard, but some sort of npm like experience would be wel…
As someone who has next to no experience with npm, which benefits of npm would you like to see in venv or package management in Python?
Mostly I just want to see venv eliminated. I really don't like the workflow it requires.
Re: How to improve Python packaging
#175> There are two tools for dealing with packages in the Node world, namely npm and Yarn. Not to mention pnpm. Or Bun. Or even Deno. All of which deal with packages, and make different choices. This isn't to be a pedant, but I think it's a reasonable example of why it's less important that there's a single way to do a thing, or even a single tool vs. multiple alternatives; instead, what I care about is that I don't hav…
Re: How to improve Python packaging
#176The main reason I have stayed away from Python. packaging is a mess!
And one of the reasons I moved away from it! My blog post on the subject was posted here and it was very unpopular despite having similar points and also making comparisons with Node. There's nothing special about Python that makes it worth enduring this pain. We have other languages with a better developer UX.
Re: How to improve Python packaging
#177Because of the insanity of python I run everything in Docker (through compose). No more issues with it not working on some dev's computer because of a missing wheel, or that they need to have X and Y c++ toolchain packages installed locally etc. No more trying to fix a broken setup after upgrading python or poetry versions, just "docker compose build" and you're up and running. No spending days getting a freshly clon…
.deb packages…
These are language agnostic and can get the job done.
Re: How to improve Python packaging
#178Trying to build Python under Nix (i.e. solid, not “close enough) is an education in how fucked up the Python packaging ecosystem is. Which is a shame because Python is an amazing scripting language, the de facto numerical computing standard, and probably a better bash for most bash use cases.
Re: How to improve Python packaging
#179Reading this is really depressing. I just want Cargo for Python. Poetry it is for now, but it has quirks, and it is dog slow...
I’m not trying to imply you’re one of those people, but this may provide some insight why “Cargo for Python” is not a more widely adopted workflow.
Re: How to improve Python packaging
#180Earlier quoted context omitted.
.deb packages…
Do you happen to have a link to a python application that ships it's own dependencies and has state-of-the art debian packaging?
You mean a link to a malformed .deb packages?
It's not difficult to do but it's also the wrong way to do it.