---
source: https://iinventedlight.com/library/notes/python-zipapp.md
title: "zipapp: build executable zip archives of Python code"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "PSF License Version 2 (Python Software Foundation); PSF License Version 2 (CPython); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: Python Software Foundation, zipapp — Manage executable Python zip archives; CPython, zipapp documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-23
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-23
as_of: 2026-11-23
confidence: medium
untested: "Not reproduced (2026-11-23). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-python: python-zipapp"
tags: [python, zipapp, zip, executable, stdlib]
client: Librarian
sources:
  - id: S1
    title: "zipapp — Manage executable Python zip archives"
    publisher: Python Software Foundation
    url: https://docs.python.org/3/library/zipapp.html
    accessed: 2026-11-23
    license: "PSF License Version 2"
  - id: S2
    title: "zipapp documentation (source)"
    publisher: CPython
    url: https://raw.githubusercontent.com/python/cpython/main/Doc/library/zipapp.rst
    accessed: 2026-11-23
    license: "PSF License Version 2"
---
# zipapp: build executable zip archives of Python code
**Answer:** This module provides tools to manage zip files containing Python code. Those archives can be executed directly by the Python interpreter. The --main option writes a __main__.py file to the archive that executes mainfn.

## Executable zip archives

This module provides tools to manage zip files containing Python code.

Those archives can be executed directly by the Python interpreter.

The interpreter argument specifies the name of the Python interpreter.

That is the interpreter with which the archive will be executed.

The --main option writes a __main__.py file to the archive that executes mainfn.

## The same options in the source docs

The module also provides tools to manage the creation of zip files containing Python code.

The interpreter can execute those archives directly.

The --main option writes a __main__.py file to the archive that executes mainfn.

## See also

- [python-zipfile](https://iinventedlight.com/library/notes/python-zipfile/)
- [python-runpy](https://iinventedlight.com/library/notes/python-runpy/)

## Claims

- id: C1
  claim: zipapp manages zip files of Python code that the interpreter can run directly.
  source: S1
  evidence: "executed directly by the Python interpreter"

- id: C2
  claim: --main writes a __main__.py file that executes a given function.
  source: S1
  evidence: "Write a __main__.py file to the archive that executes"

- id: C3
  claim: The module manages creation of zip files containing Python code.
  source: S2
  evidence: "creation of zip files containing Python code"

## Sources

- [S1] zipapp — Manage executable Python zip archives. Python Software Foundation. https://docs.python.org/3/library/zipapp.html . License: PSF License Version 2. Accessed 2026-11-23.

- [S2] zipapp documentation (source). CPython. https://raw.githubusercontent.com/python/cpython/main/Doc/library/zipapp.rst . License: PSF License Version 2. Accessed 2026-11-23.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Python Software Foundation, zipapp — Manage executable Python zip archives; CPython, zipapp documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
