Skip to content
/ zapp Public

Build zipapp single file Python applications easily.

License

Notifications You must be signed in to change notification settings

sinoroc/zapp

Repository files navigation

Introduction

Build zipapp (PEP 441) single file Python applications easily.

Repositories

Distributions:

Source code:

Usage

Standalone application

$ zapp --help
usage: zapp [-h] [--version] [--requirements requirements.txt]
            output_file entry_point [requirement [requirement ...]]

positional arguments:
  output_file
  entry_point
  requirement

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  --requirements requirements.txt, -r requirements.txt
zapp ~/bin/myapp myapp.cli:main 'myapp==1.2.3' 'mylib==3.2.1'
zapp ~/bin/myapp myapp.cli:main --requirements A.txt --requirements B.txt

python3 -m zapp ~/bin/myapp myapp.cli:main 'myapp==1.2.3' 'mylib==3.2.1'

zapp toolmaker.pyz toolmaker.cli:main toolmaker
zapp pipdeptree.pyz pipdeptree:main pipdeptree
zapp ~/bin/httpie httpie.__main__:main httpie

# Without requirements (use an entry point from Python's standard library)
zapp zipfile.pyz zipfile:main

Library

import zapp

zapp.core.build_zapp(
    'myapp.pyz',  # output_file
    'myapp.cli:main',  # entry_point
    requirements=[
        'myapp==1.2.3',
        'mylib==3.2.1',
    ],
    requirements_txts=[
        'A.txt',
        'B.txt',
    ],
)

Setuptools command

python3 setup.py bdist_zapp --entry-point myapp.cli:main

Details

Similar applications