src.wrappers module

Wrappers for Cython and Nuitka compilers.

class src.wrappers.CompilerCommands

Bases: object

cython = 'cythonize {} -3 --inplace'
cython_bench = 'cythonize {} -3 --inplace --quiet 2>/dev/null'
nuitka = 'python -m nuitka --module {}'
nuitka_bench = 'python -m nuitka --quiet --module {} 2>/dev/null'
class src.wrappers.CompilerWrapper

Bases: ABC

abstract cleanup(file_path: Path) None
abstract property cmd: str
class src.wrappers.CythonWrapper(cmd: str = 'cythonize {} -3 --inplace')

Bases: CompilerWrapper

Cython is a programming language, a superset of the Python programming language, designed to give C-like performance with code that is written mostly in Python with optional additional C-inspired syntax. Cython is a compiled language that is typically used to generate CPython extension modules https://cython.org/

cleanup(file_path: Path) None

Deletes the `build`directory.

property cmd: str
class src.wrappers.NuitkaWrapper(cmd: str = 'python -m nuitka --module {}')

Bases: CompilerWrapper

Nuitka is a source-to-source compiler which compiles Python code to C source code, applying some compile-time optimizations in the process such as constant folding and propagation, built-in call prediction, type inference, and conditional statement execution. https://nuitka.net/

cleanup(file_path: Path) None

Deletes the build`directory alongside with the `file.pyi temp file.

property cmd: str