How to package a Python command line app?
Mats Wichmann
mats at wichmann.us
Thu Dec 9 15:51:00 EST 2021
On 12/9/21 11:35, Manfred Lotz wrote:
> I played with pyinstaller which worked fine. However, it builds a
> dynamic executable and thus it is glibc version dependent. Means, I
> have to build different executables for differen glibc versions.
>
> So, it seems I will have to check how executable zip archives are
> supposed to work.
>
For me at least, I'm still not sure what you are trying to accomplish.
"A Python command line app which requires some packages which are not in
the standard library."
If your code and its dependencies are "pure python" then you only need
to build a wheel package and you should be good to go. If you think you
have Python version issues, most of the good checkers will take a
version argument, so if you think you need to be compatible with
3.6-3.10 you give it a version of 3.6 to check against, and it should
spot things that don't work all the way back to that base version, and
then you can find ways to code around it.
If the things you call on are binary, it gets a little more complicated.
Wheels that contain compiled bits need to match the version of Python
that's going to run them (unless they use the stable ABI, but that's not
terribly common yet).
You shouldn't run into glibc versioning problems. Most of glibc has
been extraordinarily stable for nearly two decades, and within the range
of distributions you've mentioned there should not be problems unless
something is reaching into very esoteric areas. Other system libraries
- maybe not so much. If you really think you're going to have this
level of binary-compatibility problem, the flavor-of-the-month technique
is to build a self-contained bundle, such as a Snap or Flatpak, or...
Quote:
> New packaging formats like Snap, Flatpak and AppImage are providing
distribution agnostic packages that work on most Linux distributions.
But that's no longer a Python-specific question at that point...
As I said, I can't really deduce the details of what you're trying to
accomplish, just hoping you don't buy yourself more trouble than you
actually need to - this might be easier than you think.
More information about the Python-list
mailing list