tech.lgbt is one of the many independent Mastodon servers you can use to participate in the fediverse.
We welcome all marginalized identities. This Mastodon instance is generally for folks who are LGBTQIA+ and Allies with an interest in tech work, academics, or technology in general.

Server stats:

2.9K
active users

Public

Looking for ways to install #Python programs on #Debian 11 and 12 systems, globally (as would normally be in /usr/local/bin/ for executables, elsewhere in /usr/local/ for additional files), to run periodically or as daemons (later setting systemd services for those). "Easy install" is deprecated, pip points at the externally managed environment and wants a virtual environment, pipx also installs into a venv in the user's home directory. Executable scripts are available to other users then, but sitting in a user directory, which is unconventional, contrary to the FHS. Packaging into .deb must be possible, apparently using dh-python, though so far I have not found a complete guide to follow, possibly will have to dig deeper into it. Single-file scripts could be simply copied into /usr/local/bin/, but there can be multi-file programs as well. I wonder whether I am missing something: this looks surprisingly tricky for such a task, with a very popular language and a popular Linux distribution. How do you package and install custom Python programs on Debian?

@defanor My preference is to create a virtualenv under /opt and install the Python package(s) inside that. This follows FHS and plays nicely with systemd's security options. And since systemd units require an absolute executable path, saying /opt/yourvenv/bin/tool is no big loss compared to /usr/local/bin/tool.

Public

@CyrikCroc Thanks, /opt/ does look more appropriate than someone's $HOME, indeed, though not quite as conventional and unsurprising as /usr/bin/ and /usr/lib/. Fortunately (as mentioned in a nearby toot) I managed to build a Debian package with dh-python now, but going to aim using /opt/ in case if there will be issues with that in the future.