[Cython] Gsoc project

Robert Bradshaw robertwb at gmail.com
Wed Mar 28 21:57:10 CEST 2012


On Wed, Mar 28, 2012 at 12:52 AM, Stefan Behnel <stefan_ml at behnel.de> wrote:
> 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.

Perhaps the blacklist could be (in part) based on the hand-generated
.pxd file, and the generated .pxd file would simply not emit
re-declarations.

- Robert


More information about the cython-devel mailing list