Skip to content

Instantly share code, notes, and snippets.

@carlos-jenkins
Created July 1, 2017 00:46
Show Gist options
  • Save carlos-jenkins/5e77957261014d7e130470eab4dbf507 to your computer and use it in GitHub Desktop.
Save carlos-jenkins/5e77957261014d7e130470eab4dbf507 to your computer and use it in GitHub Desktop.
Cythonization of a pure Python package in setup.py
# Run me with:
# python3 setup.py bdist_wheel --cythonize
# ...
if '--cythonize' in argv:
from Cython.Build import cythonize
packaging = {
'ext_modules': cythonize('lib/**/*.py'),
}
argv.remove('--cythonize')
else:
packaging = {
'package_dir': {'': 'lib'},
'packages': find_packages('lib'),
}
setup(
# ....
**packaging
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment