Directory layout for a Python project with C extension modules
Posted
by Kamil Kisiel
on Stack Overflow
See other posts from Stack Overflow
or by Kamil Kisiel
Published on 2010-03-19T21:03:37Z
Indexed on
2010/03/19
21:31 UTC
Read the original article
Hit count: 199
We have numerous projects in our organization that are mixed Python/C. Currently we're trying to standardize on a directory layout for our projects and are trying to come up with a convenient scheme. One point of contention is where to put C extension modules in the tree.
We're tossing around a couple of options (relative to project root):
./src/package/subpackage/module.c
or alongside the python modules in the package tree:
./package/subpackage/module.c
or in a src
directory in the subpackage:
./package/subpackage/src/module.c
One reason for keeping them out of the package directories could be because it will lead to clutter, especially if there are other .c and .h files which aren't themselves modules but still need to be compiled. Also in the "integrated" scheme, what do you do with headers and files that are used by more than one module? Put them in a common top-level directory?
I'd be interested to know what other people are using, or if there are any established best practices for this.
© Stack Overflow or respective owner