Skip to content

Commit 0fc04d2

Browse files
authored
Merge pull request #809 from python-cmd2/docs_packaging
Added a docs section on packaging cmd2 applications for distribution
2 parents 2cf4d87 + bd4880d commit 0fc04d2

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

docs/features/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Features
1818
misc
1919
multiline_commands
2020
os
21+
packaging
2122
plugins
2223
prompt
2324
redirection

docs/features/packaging.rst

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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

Comments
 (0)