Common Tasks¶
Test whether aloha is properly installed¶
This displays package version information.
Start a function from the main function entrypoint¶
Note: this module_name must include a function named main().
Compile Python code into binary¶
Sometimes you need to distribute Python code without shipping the raw .py files. This command turns most Python modules into compiled extension libraries (.so files on Linux/macOS), which can help with source-code protection and reduce direct readability of implementation details.
Aloha uses Cython for this workflow:
How it works:
- Scan the source tree under
--base. - Skip hidden folders, the output folder, excluded paths,
.pycfiles, and.pyxfiles. - Copy non-Python files directly into the target tree.
- Convert regular
.pymodules into compiled extension modules. - Keep files listed in
--keepas plain Python files. - Move the final build result into
--distand clean up intermediate Cython artifacts.
Notes:
__init__.pyfiles are copied as plain Python files.- All python submodule folders MUST contain a
__init__.pyfile, otherwise python files in this submodule/folder will be compiled and built to root folder. - Files passed through
--keepare not compiled. Cythonmust be installed first.- The command writes a temporary build tree under
/tmp/build/<project-name>before moving the result to--dist.
Available options:
--base: root folder that includes source code to build--dist: (default=build) target folder for binary code--exclude: files/folders to exclude; pass one or more paths after the flag--keep: source files to keep as-is instead of converting to dynamic libraries; pass one or more paths after the flag