【发布时间】:2020-06-11 09:51:22
【问题描述】:
我使用 Poetry 来构建 tar.gz。和我的包裹的.whl。 Cython 文档建议将 cython 生成的 c 文件与 pyx 文件一起分发。 http://docs.cython.org/en/latest/src/userguide/source_files_and_compilation.html#distributing-cython-modules
我应该在build.py 或pyproject.toml 中添加什么来通过调用poetry build 和poetry build -f sdist 生成c/cpp 文件?
我试过这个(来自Create package with cython so users can install it without having cython already installed):
构建.py:
from setuptools.command.build_ext import build_ext
from setuptools.command.sdist import sdist as _sdist
...
class sdist(_sdist):
def run(self):
# Make sure the compiled Cython files in the distribution are up-to-date
self.run_command("build_ext")
_sdist.run(self)
def build(setup_kwargs):
setup_kwargs.update({
...
'cmdclass': {'sdist': sdist,
'build_ext': build_ext}
})
不适合我。
【问题讨论】:
标签: python cython setuptools python-packaging python-poetry