Python packaging 2
Despite me having published Definitive Guide to Python packaging back in 2016 (a fact I’ve forgotten myself as far back as 2019, because since then I’ve been using cx_Freeze
for par2deep
), a better resource for Python packaging came across my screen today: “Why not tell people to “simply” use pyenv, poetry or anaconda”.
There is great wisdom in this post, and I recognize much of it, having worked with tinkerers before. I used to tinker much more than I do now, because tinkering costs time that I don’t have, something that is basically equivalent to the author’s observation that most are far too busy checking out your new toy. Today even more than before I work in a ‘hostile’ environment, where the sysadmin is very much not your ally, and you’re going to work around limitations and therefore appreciate solutions that keep their list of requirements short. No brew
for me, no conda
, no installing anything outside of pip
, and not even that (topic for another post). Failure modes cascade: indeed! For Arbor and my personal packages we decided to stick to solutions that require the least from the user, and I fought tooth and nail for wide Python-version support, neatly in line with the post, and worked hard to provide binary wheels. As any non-dev-dev knows: having to compile things is a recipe for quickly escalating problems.
I just wanted to add a few things:
- Not requiring something like
poetry
, but sticking to what comes out of PyPA, doesn’t mean your users can’t! - I dislike one-second-tricks precisely because you are creating pets, not cattle. They are basically extra requirements that you’ve just forced on all users (including your future self), with the wonderful addition of being informal (i.e. not in
pyproject.toml
) and most of the time: undocumented! The worst kind of requirement! - Something I hadn’t realized fully and will keep in mind:
-m
forces users to know what Python they use. - Putting the gest of the piece another way: refrain from teaching users to use non-defaults, non-default tooling and non-default procedures. These are one-second-trick (or dozens-of-hour-tricks). They bad!