I use Poetry to build tar.gz. and .whl of my package. Cython docs recommend to distribute cython generated c files along with pyx ones. http://docs.cython.org/en/latest/src/userguide/source_files_and_compilation.html#distributing-cython-modules
What should I add to build.py or pyproject.toml to generate c/cpp files by calling poetry build and poetry build -f sdist?
I tried this (from Create package with cython so users can install it without having cython already installed):
build.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}
})
Not worked for me.