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 Slide

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

    View Slide

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

    View Slide

  4. State of Python
    Packaging

    View Slide

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

    View Slide

  6. Setup Script

    View Slide

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

    View Slide

  8. Distributions
    ● Built distribution


    ● Source distribution

    View Slide

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


    View Slide

  10. Standalone
    Distribution

    View Slide

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

    View Slide

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

    View Slide

  13. Transcompilation
    ● Nuitka

    View Slide

  14. PyInstaller

    View Slide

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

    View Slide

  16. Getting PyInstaller
    ● On OS X:




    View Slide

  17. Getting PyInstaller
    ● On linux:






    View Slide

  18. Quickstart

    View Slide

  19. Specs
    ● Command:

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

    View Slide

  20. Specs

    View Slide

  21. Options


    View Slide

  22. Options


    View Slide

  23. Options


    View Slide

  24. Building
    ● Command:

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

    View Slide

  25. Compression
    ● UPX
    ● 5.8 MB:

    View Slide

  26. Demonstration

    View Slide

  27. View Slide

  28. Now you try!

    View Slide