CythonBuilder; automated compiling and packaging of Cython code
Version | |
---|---|
Package | |
Status | |
Stats | |
Social |
pip install cythonbuilder
CythonBuilder makes it easy to use Cython in your Python project by automating the compilation, building and packaging process. You can use CythonBuilder from the commandline or import it as a package in Python.
-
Initialize
In your project directory, callcybuilder init
. This creates the/ext
folder. -
Organize
Place all of your Cython files in/ext/pyxfiles
-
Compile and package
Simply callcybuilder build
to build all Cythonfiles in/ext/pyxfiles
. Alternatively callcybuilder build filename
to package specific files (no .pyx needed) -
Import All packages en up in
/ext
so you can simplyfrom ext import yourfilename
.
import cythonbuilder as cybuilder
cybuilder.init()
cybuilder.just_build(targetfilenames=["my_cy_package"])
from ext import my_cy_package
my_cy_package.some_function()
I've written a few articles that explain why Python is slow, why we need Cython and how CythonBuilder helps us develop fast code easily: