|
| 1 | + |
| 2 | +Packaging a cmd2 application for distribution |
| 3 | +============================================= |
| 4 | + |
| 5 | +As a general-purpose tool for building interactive command-line applications, |
| 6 | +``cmd2`` is designed to be used in many ways. How you distribute your ``cmd2`` |
| 7 | +application to customers or end users is up to you. See the |
| 8 | +`Overview of Packaging for Python`_ from the Python Packaging Authority for a |
| 9 | +thorough discussion of the extensive options within the Python ecosystem. |
| 10 | + |
| 11 | +For developers wishing to package a ``cmd2`` application into a single binary |
| 12 | +image or compressed file, we can recommend all of the following based on |
| 13 | +personal and professional experience: |
| 14 | + |
| 15 | +* Deploy your ``cmd2`` Python app using Docker_ |
| 16 | + * Powerful and flexible - allows you to control entire user space and |
| 17 | + setup other applications like databases |
| 18 | + * As long as it isn't problematic for your customers to have Docker |
| 19 | + installed, then this is probably the best option |
| 20 | +* PyInstaller_ |
| 21 | + * Quick and easy - it "just works" and everything you need is installable |
| 22 | + via ``pip`` |
| 23 | + * Packages up all of the dependencies into a single directory which you can |
| 24 | + then zip up |
| 25 | +* Nuitka_ |
| 26 | + * Converts your Python to C and compiles it to a native binary file |
| 27 | + * This can be particularly convenient if you wish to obfuscate the Python |
| 28 | + source code behind your application |
| 29 | + * Recommend invoking with ``--follow-imports`` flag like: |
| 30 | + ``python3 -m nuitka --follow-imports your_app.py`` |
| 31 | +* `Conda Constructor`_ |
| 32 | + * Allows you to create a custom Python distro based on Miniconda_ |
| 33 | + |
| 34 | +.. _`Overview of Packaging for Python`: https://packaging.python.org/overview/ |
| 35 | +.. _Docker: https://djangostars.com/blog/what-is-docker-and-how-to-use-it-with-python/ |
| 36 | +.. _PyInstaller: https://www.pyinstaller.org |
| 37 | +.. _Nuitka: https://nuitka.net |
| 38 | +.. _`Conda Constructor`: https://github.com/conda/constructor |
| 39 | +.. _Miniconda: https://docs.conda.io/en/latest/miniconda.html |
0 commit comments