Packaging Python Software

This is a how-to for developers with directions on packaging their software in ways that enable a painless installation experience for end-users. Installing Python Software is the related end-user guide.

See also these other resources on the web…

Packaging PyPI Releases


Packaging Python EXecutables (PEX)

PEX files are Python Executable ZIP files, a format that contains a full distribution of a Python application in a single archive (just like exectable JARs for Java). PEX files can be targeted at a specific platform and Python version, but might also support multiple runtime environments. See Installation With PEX for details on how to use them, and PEP 441 for a formal description of the underlying mechanics and all the details.

The Rituals task library for Invoke offers a release.pex task that performs all the necessary steps to create a PEX file. If you want to do it ‘manually’ or integrate it into another task runner, this is a concrete example:

pex -r requirements.txt . -c nanny \
    -o bin/nanny-0.1.0.dev5-cp27-none-linux_x86_64.pex

At the time of this writing, you need to install pex directly from GitHub for the above to work.