[Cython] Gsoc project

Stefan Behnel stefan_ml at behnel.de
Wed Mar 28 09:52:38 CEST 2012


Stefan Behnel, 28.03.2012 09:20:
> Dag Sverre Seljebotn, 28.03.2012 05:05:
>>  - Very often one is not interested in the full header file. One really
>> wants "the API", not a translation of the C header. This probably requires
>> a) some heuristics, and b) the possibility for, as easily as possible,
>> write some selectors/configuration for what should be included and not.
>> Making that end-user-friendly is perhaps a challenge, I'm not sure.
> 
> It's usually not a problem when there's too much declared in a .pxd, but
> users may want to leave specific things out. So I think a simple blacklist
> configuration file would work just fine.

Adding a bit to this: The other side of the use case, that you want to
override a specific definition that was auto-generated into a .pxd file, is
trivial in the sense that you can always add a hand-written .pxd file next
to it and use that instead. And for declarations that you need to override
but that are used in the .pxd file itself, a blacklist entry plus a cimport
from a hand-written .pxd file would do the trick.

So, basically, the generator would start by creating two .pxd files: one to
be manually edited and one that contains the generated declarations and
that cimports (or, maybe even better, includes) the editable file at the
top. From that point on, it only changes the generated file and uses a
blacklist to keep out certain declarations. It's then up to the user to
provide them in the hand written file (or not at all).

Sounds easy enough.

Stefan


More information about the cython-devel mailing list