[Cython] Static checker for cython extension dependencies?

Nathan Goldbaum nathan12343 at gmail.com
Fri Jun 10 12:18:19 EDT 2016


Hi all,

I'm working on a pretty large python/cython codebase (yt) that has many
interdependent C extensions written in cython.

I've found it to be pretty hit or miss to depend on contributors to
manually update cython dependency information in our setup.py file. The
dependency information seems to only be used by setuptools to trigger
recompilation, but critically setuptools will happily compile a C extension
for the first time if the depends information is incomplete. This means
that during development, if I update a cython routine, there's no way to
ensure that other cython routines that cimport the one I modified will be
recompiled unless I manually ensure the depends information is updated
whenever cython code gains or loses a cimport.

To make that more concrete, here's a pull request I just made to yt that
adds missing dependencies for a cython header. Without this pull request,
setuptools fails to recompile these routines when selection_routines.pxd
changes, causing a build failure.

https://bitbucket.org/yt_analysis/yt/pull-requests/2220

I think it should be possible to write a test for this by defining the
dependency information outside of setup.py and parsing grep and looking for
all cython files that cimport other cython files defined inside yt.
However, before I do that, I'm curious whether anyone has done something
similar, or if there is some other way of forcing the dependency
information to be complete on the first compilation, rather than just for
subsequent incremental recompilations during development.

Thanks for your help!

-Nathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cython-devel/attachments/20160610/148d0113/attachment.html>


More information about the cython-devel mailing list