I have a Python project with many sub-modules that I package up with distutils. I would like to build some Python extensions in C to live in some of these sub-modules but I
Just change
Extension('c_extension', ...)
to
Extension('foo.bar.c_extension', ...)
You will need __init__.py
files in each of the foo
and bar
directories, as usual. To have these packaged with the module in your setup.py, you need to add
packages = ['foo', 'foo.bar'],
to your setup() call, and you will need the directory structure
setup.py
foo/
__init__.py
bar/
__init__.py
in your source directory.