💾 Archived View for idiomdrottning.org › fpm-python captured on 2023-12-28 at 15:23:46. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
Used to be that whenever I saw a Python code repository of an app I wanted to hack on and install I’d get a pit of fear in my stomach.😰 It’s so difficult to install with all the pips and venvs and what not.
But fpm to the rescue! At least if there’s a setup.py in the repo.
In a temp directory,
fpm -s python --python-package-name-prefix python3 \ --python-bin python3 --python-internal-pip -t deb /path/to/repo
Problem one is that sometimes there might be dependencies. Go install them first (if they’re in apt, use that) and then add --python-disable-dependency for each one. For example, I’ve been compiling a package that depends on click which I already have installed from Debian’s own repos so I would:
fpm -s python --python-package-name-prefix python3 \ --python-bin python3 --python-internal-pip \ --python-disable-dependency click -t deb /path/to/repo
There can be multiple instances of the --python-disable-dependency flag.
Problem two is that that turns into a kinda janky deb because all the paths are relative, so I need to be in / when I install it. But I just cd to / and then install ‘em with the path to the temp directory where the deb is with gdebi.
The awesomest part is that they don’t go in their own venvs or dockers or chroots or their own li’l boring & redundant worlds. Instead it’s all according to traditional Debian philosophy, all part of the same file system with no redundancy. Straight into /usr/lib/python3/dist-packages so other packages you install can use them.
You can also install things from python’s package repos without having the repo locally; just put the package name instead of the path to the repository. Look at those debs carefully before installing ‘em so you don’t get malware and stuff. It’s not something I do a lot since what I want is usually something that’s in apt already (in which case no need to use fpm at all) or it’s something I wanna hack on (in which case I did need the repo, so I could make changes & patches).
fpm - packaging made simple — fpm - packaging made simple 1.9.0 documentation