I moved away from Poetry for Python
usrme.xyz
usrme.xyz
Poetry struck me as one of those 80% solutions that might get in the way of a 100% solution. I used it for a number of little projects and felt it was good enough but my analysis was that its dependency resolution strategy was pretty slow and that I didn't believe it was 100% correct.
For my own Python projects I've been really slumming it lately. I make venv's with pycharm and let pycharm manage my dependencies. I also have written a number of "single file Python" programs that I use on my Linux server to do things like burn DTS CD-Rs with complete CD-Text information. For those ones I just stick to the standard library. One of these days I'm going to have to deploy a real python project to a server and I'll have to think of something then.
I convinced myself that the right way to resolve dependencies in Python is to do the same thing maven does and form a graph of the dependencies of all the software versions that could possibly satisfy the constraints.
For wheel files it is practical to do because you can download the metadata in 2 or 3 http range requests out of a wheel. eggs are a problem because you are expected to download and run the python scripts inside the egg before you know anything about the egg. fortunately (1) wheels have mostly replaced eggs and (2) you can build wheels as to the needs of your organization in a private "wheelhouse" used for builds in your organization.
Since it takes a long time to fetch that information it really does have to have a local cache like maven and maybe even a metadata database. It would be nice to see python build cleaned up.
I think part of the problem is that almost all the solutions in the Python ecosystem (yours included if, like you say, you ever need to deploy it) are 80% solutions. It's just each one handles a different 80% of the problem. The last company I worked at also has a reasonable solution involving manual venvs and a bit of scripting on the side that worked fine until we ran into a bug that we couldn't reproduce for ages because one of our dependencies had randomly updated at some point, and we had no way of locking them. 80% fine, 20% a nightmare that I never want to touch again with a bargepole. Even looking through this thread, most people are suggesting solutions with enormous caveats to practical use.
In Poetry's defence, I think the 80% that it caters for tends to be a pretty good 80% for the majority of people, so it's still a good recommendation if you're setting up a new project that's not going too far outside the norms. But I think the 80% thing is definitely a valid criticism of it and most of the rest of the Python packaging ecosystem.
From that point of view it is not pip vs poetry but pip vs gopm or pip vs rubygems, or...
Maven and npm are perceived as 100% solutions in the Java and Javascript worlds respectively. Sure there are gradle and yarn but both of those are trying to be 100% solutions that are better than the other 100% solutions.
That's the point at which you rewrite it in go
Working on a python gig targeting an airgapped windows server, different OS architecture from everything else on-hand, restrictions on building and deploying VM's, poor dev/prod workflows etc.
After a couple of months of app dev we ran into weeks of grinding through building a reproducible process (including a sneakernet step) for python dependency resolution and binary builds to get the payload dropped on the server. It was brittle and a bit overwhelming.
Go was "big enough" at the time to be a reasonable next step and after a few weeks of porting we had a cross-compilation process up and were done.
Go actually _shits me to tears_ as a language compared to python, rust, or even Lua, but as a back-end dev it's still where I do most of my work as I'm nearly guaranteed to be able to i) predictably solve something in a way i can share it with a team and ii) get it deployed without too much pain.
For very simply requirements you can just have a simple requirements file or setup.cfg that lists what packages you need and use pip install.
As your requirements get bigger you can start putting sensible lower bounds on everything. This can be achieved manually or if you're struggling to extend an existing environment run pip freeze and replace all the == with >=.
When you start wanting to have reproducible environments or you're having to keep multiple requirements in sync with each other such as prod requirements and development requirements you use a constraints file. Install all your requirements at once, run pip freeze and save the output as a constraints file, now always specify -c constraints.txt when you pip install in any environment unless you are updating the dependencies in your environment.
Better still, you want to add 1 package without changing an of your other dependencies, just run pip install new_package -c constraints.txt and you either install it or find out what it's not compatible with.
It's not perfect but in my experience other tools have always seemed to add a lot of complexity but only solve a narrow set of problems, which I can usually just workaround in some other way with Pip.
I’ve liked poetry in general, just takes a really long time and sometimes its solver gets stuck on a bad package.
Despite the shiny, I seem to always find my way back to standard tools and text files.
Recently I've ventured out to pdm. It is truly a sublime experience. It is everything poetry should have been and with a mere fraction of development team and effort, it really shows how much of a waste poetry is. Pdm has given me hope again. I only wish that more tools like Pycharm would support it, but really the experience isn't missing much at all. For those of you who are feeling the pain of poetry, I can't convey enough how much more pdm is, it's not perfect but if you try it in earnest and you won't be disappointed.
I haven't tried it, but I've suffered the state of other python tooling and whenever I rant about it to others they're always like "but we have poetry now, and it's good, you've just gotta use that and then everything's sunny and happy"
How did Poetry get so much momentum vs pip-tools and pipenv?
Pip-tools is also a bit lower level, offering flexibility and compatibility which I relish, but also requiring more attention from the user to set things up as they wish.
If you or anyone else enjoying pip-tools is a Zsh user and interested in trying out my higher level functions to ease interactive use of pip-tools, venvs, and also isolated app installs (like pipx), I would love some feedback on zpy: https://github.com/AndydeCleyre/zpy
I'm very happy to answer any questions about it right here or as GitHub issues.