Correct way to setup a package with both compiled C code and Python code?
Christian Gollwitzer
auriocus at gmx.de
Tue Feb 8 16:43:53 EST 2022
Am 08.02.22 um 18:57 schrieb Dieter Maurer:
> Christian Gollwitzer wrote at 2022-2-7 20:33 +0100:
>> we've developed a Python pacakge which consists of both a compiled
>> extension module and some helper functions in Python. Is there a
>> tutorial on how to package such an extension?
>
> Look at "https://package.python.org",
> especially "https://packaging.python.org/en/latest/guides/packaging-binary-extensions/".
Thank you, but that page is more like a high-level description, it talks
a lot about the differences between C code and Python and how it can be
combined using SWIG etc, but I already have a working extension.
My question was more targeted at how to write the setup.py file in this
case such that both the compiled code and the Python code gets loaded.
In the meantime, I found a similar example for C++ code with CMake and
pybind11 here:
https://github.com/benjaminjack/python_cpp_example
That gave me enough to create a similar thing for a pure CPython extension:
https://github.com/auriocus/python_setuptools_sandbox
Now, I still have to figure out how to get this on PyPI and how to
enable OpenMP during compilation.
Christian
More information about the Python-list
mailing list