I am developing a package containing Cython extensions.
According to https://github.com/pypa/pip/issues/1958 I shall use setup_requires
and postpone import of Cython
.
The best solution I came up with is to call setup()
twice in setup.py
:
... # initial imports
setup(setup_requires=['cython'])
from Cython.Build import cythonize
bar = Extension('foo.bar', sources = ['bar.pyx'])
setup(name = 'foo',
... # parameters
ext_modules = cythonize([bar]),
... # more parameters
)
However I have a feeling that the name of setup()
suggests it shall be called only once. Is it safe to call it several times like I do?
I can not just distribute wheels because the package shall be available also for Linux users.
[EDIT]
Also I see the question as more general than dealing with compiler-dependencies. One may want to import some package (eg. sphinx
or pweave
) to preprocess the description of ones package.