Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Standalone Python Programs using PyInstaller

Standalone Python Programs using PyInstaller

A talk on Python packaging and PyInstaller given at GRPUG.

Jace Browning

September 19, 2016
Tweet

More Decks by Jace Browning

Other Decks in Programming

Transcript

  1. Standalone Programs
    using PyInstaller
    @JaceBrowning

    View full-size slide

  2. Outline
    ● State of Python Packaging
    ● Standalone Distribution
    ● PyInstaller Overview
    ● Demonstration
    ● Work Time!

    View full-size slide

  3. Interpreted Languages 101
    ● Code
    ○ Modules
    ○ Packages
    ● Interpreter
    ○ CPython aka “Python”
    ○ Jython
    ○ IronPython

    View full-size slide

  4. State of Python
    Packaging

    View full-size slide

  5. The Pieces
    ● setuptools
    ● wheel
    ● twine
    ● pip

    View full-size slide

  6. Setup Script

    View full-size slide

  7. Setup Script
    https://packaging.python.org/distributing
    https://github.com/pypa/sampleproject

    View full-size slide

  8. Distributions
    ● Built distribution


    ● Source distribution

    View full-size slide

  9. Upload
    ● Python Package Index
    ○ https://pypi.python.org
    ○ https://pypi.io (“warehouse”)
    ● Upload distributions


    View full-size slide

  10. Standalone
    Distribution

    View full-size slide

  11. So why do it?
    ● Making work tools accessible
    ● Sharing projects with non-programmers
    ● It’s fun!

    View full-size slide

  12. Interpreter Embedding
    ● py2exe and py2app
    ● cx_Freeze
    ● PyInstaller

    View full-size slide

  13. Transcompilation
    ● Nuitka

    View full-size slide

  14. Getting PyInstaller
    ● http://www.pyinstaller.org
    ● In general:

    View full-size slide

  15. Getting PyInstaller
    ● On OS X:




    View full-size slide

  16. Getting PyInstaller
    ● On linux:






    View full-size slide

  17. Specs
    ● Command:

    ● https://pyinstaller.readthedocs.io/en/stable/spec-files.html

    View full-size slide

  18. Options


    View full-size slide

  19. Options


    View full-size slide

  20. Options


    View full-size slide

  21. Building
    ● Command:

    ● https://github.com/pyinstaller/pyinstaller/wiki/Supported-Packages

    View full-size slide

  22. Compression
    ● UPX
    ● 5.8 MB:

    View full-size slide

  23. Demonstration

    View full-size slide

  24. Now you try!

    View full-size slide