setup_requires with Cython?

前端 未结 3 994
时光说笑
时光说笑 2020-12-01 10:29

I\'m creating a setup.py file for a project with some Cython extension modules.

I\'ve already gotten this to work:

from setuptools impor         


        
3条回答
  •  余生分开走
    2020-12-01 11:10

    Starting from 18.0 release of setuptools (released on 2015-06-23) it is possible to specify Cython in setup_requires and pass *.pyx modules sources for regular setuptools.Extension:

    from setuptools import setup, Extension
    
    
    setup(
        # ...
        setup_requires=[
            # Setuptools 18.0 properly handles Cython extensions.
            'setuptools>=18.0',
            'cython',
        ],
        ext_modules=[
            Extension(
                'mylib',
                sources=['src/mylib.pyx'],
            ),
        ],
    )
    

提交回复
热议问题