[Pyrex] Why were .pxd files invented?

Leif Strand leif at geodynamics.org
Mon Apr 2 19:17:07 UTC 2007


Still, it seems to me that .pxd files should at least be generated, so I 
don't have to think about them. Like this:

# -- Makefile snippet --

Landscaping.c: Landscaping.pyx
    pyrexc $<

# dependencies such as this one could be output by Pyrex itself, using
# "pyrex -M" or "pyrex -MM" (like GCC's equivalent option), and the
# generated dependency file included here
Landscaping.c: Shrubbing.pxd

# generate .pxd automatically from .pyx file
Shrubbing.pxd: Shrubbing.pyx
    pyrexc -pxd $<

# -- end Makefile snippet --

Generating the .pxd file would also give you the opportunity to insert 
the version timestamp.

--Leif

Greg Ewing wrote:
> Leif Strand wrote:
>
>> I can't figure out why .pxd files were invented.
>
> Because I want to be able to write a Makefile that can
> tell whether the C-level interface of a Pyrex module has
> changed, thus necessitating a recompile of any other
> Pyrex modules that cimport it. With the interface and
> implementation munged into a single file, that would
> be much more difficult.
>
> Also, one day I may want to attach version timestamps
> to extension types so that interface mismatches can
> be detected at import time instead of a crash occuring.
>
>




More information about the Pyrex mailing list