Distribute python modules/packages as binary files (compilation based on Cython)
Project description
The setuptools-cythonize provides distutils classes to compile Python source code into C code using Cython. The generated code is packaged into a platform dependent archive.
Install
$> pip install setuptools-cythonize
Setup configuration
Add the cmdclass keyword to the setup:
from setuptools import setup
from setuptools_cythonize import get_cmdclass
setup(
cmdclass=get_cmdclass(),
name="my_package",
version="2.0.5",
description="My custom library",
...
)
Some packages can be excluded from the cythonization by setting the exclude_cythonize option. The module names matching is done using the function fnmatch.fnmatchcase .
from setuptools import setup
from setuptools_cythonize import get_cmdclass
setup(
cmdclass=get_cmdclass(),
name="my_package",
...
options={
'build_py':
{'exclude_cythonize': ['my_package.subpack*']}
},
...
)
Packaging
Generate your package by executing the setup.py file, all Python modules (except the ones defined in exclude_cythonize) will be compiled and packaged:
$> python setup.py bdist --cythonize
A source package can still be generated by removing the --cythonize option:
$> python setup.py bdist
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for setuptools_cythonize-1.0.4-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 990544d7ac3b3b24b54e45ee0470a3c4396f940a128746fa2b85c11ab1c582e9 |
|
MD5 | 8cf80ca2188d24c7b4467dec18538ce3 |
|
BLAKE2b-256 | e764e70a90838dc921769a141b7dff52de040d20d10638732f0ce6ae3c534cfe |