[Cython] Support for .pxi files

Robert Bradshaw robertwb at gmail.com
Fri Mar 11 04:34:33 EST 2016


On Fri, Mar 11, 2016 at 1:13 AM, Jeroen Demeyer <jdemeyer at cage.ugent.be> wrote:
> Dear Cython developers,
>
> I'm writing this in response to Robert's "I'd really rather deprecate .pxi
> files completely".
>
> Can you please explain what you have against .pxi files?

They're neither necessary nor pythonic. Even C++ is trying to move
away from #includes to proper modules.

On a more pragmatic note, includes add complexities to dependency
tracking (among other things) and we still have cruft from abuse of
pxi files, e.g.

https://github.com/cython/cython/blob/16ad9e21da64c4de4f964980ad1b8c18ca70035b/Cython/Compiler/ExprNodes.py#L891

> I know they have
> been abused and 95% of the historic use cases should be replaced by other
> means. However, that alone is not sufficient reason to stop supporting them:
> there is still the 5% of cases where they are really useful.

Every single case I can think of would be better done by using
cimports or preprocessing via a proper templating (or at least
preprocessing) utility.

Now cysignals is the kind of package that might be doing something
tricky that makes this a special case, but even then I'd call that
0.5% not 5%. I need to dive into that deeper.

> I think that you should continue to support .pxi files on a same level as
> .pxd files. I still do not understand why
> https://github.com/cython/cython/pull/392 was refused and it seems that
> https://github.com/cython/cython/pull/483 is going to be refused too.
>
> Jeroen Demeyer.
> _______________________________________________
> cython-devel mailing list
> cython-devel at python.org
> https://mail.python.org/mailman/listinfo/cython-devel


More information about the cython-devel mailing list