How to package a Python command line app?

Manfred Lotz ml_news at posteo.de
Thu Dec 9 13:39:36 EST 2021


On Thu, 9 Dec 2021 18:18:26 +0100
"Dieter Maurer" <dieter at handshake.de> wrote:

> Manfred Lotz wrote at 2021-12-8 12:31 +0100:
> >The are many possibilities to package a Python app, and I have to
> >admit I am pretty confused.
> >
> >Here is what I have:
> >
> >A Python command line app which requires some packages which are not
> >in the standard library.  
> 
> Are they on PyPI or can they be downloaded to PyPI?
> In this case, you could install it via `pip` and
> a "requirements" file (describing what is necessary).
> 

Acutally, those packages are on pypi.

I created a minimal example where I have two files

hello.py
========

#!/usr/bin/python3

from message import hello
import typer

def main():
    hello()

if __name__ == "__main__":
    typer.run(main)

message.py 
==========

def hello():
    print("hello world")

pyinstaller worked fine taking care of message.py and typer module. But
as said in my other reply it is glibc version dependent.


> You could also build an archive (e.g. `tar`, `zip`)
> and create small installer script which unpacks and installs as
> necessary. You could put the archive at the end of the script (such
> that you have a single file which gets executed to do everything).

This I will try next.


-- 
Manfred






More information about the Python-list mailing list