I am building a Python package after compilation using Cython and cythonize.
Here is an example of how my setup.py looks like:
from setuptools import setup, find_packages, Extension
from Cython.Build import cythonize
setup(
name="My_Pkg",
version="0.0",
ext_modules=cythonize('lib/my_pkg/my_mod.py'),
)
And here is and example of how my project directory tree looks like:
.
├── lib
│ └── my_pkg
│ ├── __init__.py
│ └── my_mod.py
└── setup.py
When executing setuptools, everithing works fine:
MACOSX_DEPLOYMENT_TARGET=10.15.1 python setup.py build_ext bdist_wheel
My modules are correctly converted to '.c' and compiled to '.so' in the 'build' directory. When everything is completed, wheel is created in 'dist':
.
├── My_Pkg.egg-info
│ ├── PKG-INFO
│ ├── SOURCES.txt
│ ├── dependency_links.txt
│ └── top_level.txt
├── build
│ ├── bdist.macosx-10.7-x86_64
│ ├── lib.macosx-10.7-x86_64-3.7
│ │ └── my_pkg
│ │ └── my_mod.cpython-37m-darwin.so
│ └── temp.macosx-10.7-x86_64-3.7
│ └── lib
│ └── my_pkg
│ └── my_mod.o
├── dist
│ └── My_Pkg-0.0-cp37-cp37m-macosx_10_7_x86_64.whl
├── lib
│ └── my_pkg
│ ├── __init__.py
│ ├── my_mod.c
│ └── my_mod.py
└── setup.py
My problem is the I'd like the '__init__.py' to be copied in the 'build' as well (without being compiled) during the setuptools build phase. I also would like it to be packaged in the generated wheel as a part of the distribution.
Any idea?