zipapp turns a source directory into a ZIP archive that Python can execute. The .pyz format works well for internal tools and pure-Python applications with a clear entry point.
Package an application
python -m zipapp my_app -m "cli:main" -p "/usr/bin/env python3" -o my_app.pyz
python my_app.pyz --help
Define a stable entry point
The -m option creates __main__.py to import and call the selected function. If the directory already contains that file, keep one strategy. Exclude secrets, caches, and virtual environments from the source tree.
Understand distribution limits
The archive does not embed an interpreter or automatically solve native extensions. Dependencies must exist in the environment or support inclusion in the archive. Record the minimum Python version and test on each target system.
Keep learning
Continue with building command-line interfaces. The official Python documentation, accessed July 22, 2026, explains entry points, shebang lines, and copying existing archives.