[Distutils] setuptools special case Pyrex and break Cython

Stefan Behnel stefan_ml at behnel.de
Wed Sep 5 23:14:13 CEST 2007

Phillip J. Eby wrote:
> ``setuptools`` includes transparent support for building Pyrex
> extensions, as
> long as you define your extensions using ``setuptools.Extension``, *not*
> ``distutils.Extension``.  You must also not import anything from Pyrex in
> your setup script.

I did that with lxml a while ago and then switched back to special casing
various situations to avoid any hard dependency on setuptools. Forcing users
to install and use setuptools is nothing you really want as a distributor, so
you automatically end up doing these things by hand in your own script. Maybe
that's why I missed that part of the docs.

>> Maybe I should really consider adding a Pyrex replacement to Cython...
>> but that needs to be discussed on the cython-dev list.
>> I still wouldn't mind having a few additional
>> if-Pyrex-import-fails-try-Cython
>> lines in setuptools for now...
> Well, does that need to be done for the actual build_ext command, too? 
> (See setuptools.command.build_ext)

Cython currently uses the same setup as Pyrex, so the same procedure is
required here.


More information about the Distutils-SIG mailing list