🍵️

2021-09-24

Python Packaging Solutions (or Thank You, dece!)

After I wrote about having issues with python packaging I had a discussion with dece on IRC where I expressed my frustration with not understanding the official packaging documentation or even if it covered my issues. They were super understanding, and even more helpful!

Within short they sent me a link to a WIP guide about python packaging, addressing all my problems in one fell swoop (off topic: I almost wrote "one swell woop" just there).

I took some time just now to follow it and convert the legacy packaging format with setup.py to the newer with static declarations in a setup.cfg file for gemcall and sparty, and it just worked. Like magic. If you install any of them with pip now you'll get an executable in ~/.local/bin/ as well. No more "python3 -m gemcall", just "gemcall".

As a bonus I tried building a package that does absolutely nothing but depend on sparty, putting this in the setup.cfg:

[options]
install_requires =
  sparty @ git+https://notabug.org/tinyrabbit/sparty.git#egg=sparty

And, magic upon magic, when I installed it with pip without having sparty installed before it installed sparty too!

This clears a bunch of hurdles for me. Now I can write python programs that depend on packages that aren't published in PyPI. Which I guess is one of those things that only a loony bin like myself would want to, but I don't care.

Thank you so much, dece!

Links

My "Python Packaging Woes"

dece's capsule.

dece's superb guide.

Sparty

Gemcall

-- CC0 Björn Wärmedal