Convert folder containing python source code to a single executable file
A version of Python in your path, preferably Python 3
Clone repository
git clone [email protected]:iamogbz/pyex.git
Build pyex
from src using pyex src into your /usr/local/bin
directory
DEST='/usr/local/bin' make build
$ pyex -h
usage: pyex [-h] --output OUTPUT [--install] [--ignore [IGNORE [IGNORE ...]]]
path
positional arguments:
path path to the python script (folder with __main__.py
entry point)
optional arguments:
-h, --help show this help message and exit
-O OUTPUT, --output OUTPUT
filename of built executable
-I, --install install requirements.txt and include in executable
-G [IGNORE [IGNORE ...]], --ignore [IGNORE [IGNORE ...]]
glob pattern of src files to ignore
First check your code can be executed
python /path/to/directory
If satisfied, build single executable file
pyex /path/to/directory -O /path/to/executable -G "__tests__" "__pycache__" "*.pyc"
- Requires a
__main__.py
file in the directory being coverted. - Limited to nix enviroments. See pyinstaller for other usecases.