I have multiple .pyx files, is there a way to import them into a single pyx file and compile that file into a shared library, instead of having to compile 15 independent modules?
The Cython compiler will convert it into C code which makes equivalent calls to the Python/C API. But Cython is much more than that, because parameters and variables can be declared to have C data types.
What is a PYX file? A PYX file is a source code written in the Python-like language Pyrex. It may contain code that references existing C modules. Pyrex is a programming language that is used for creating Python modules PYD and is based on C-like syntax.
Linux The GNU C Compiler (gcc) is usually present, or easily available through the package system. On Ubuntu or Debian, for instance, it is part of the build-essential package. Next to a C compiler, Cython requires the Python header files.
At the moment, it seems the only way is to create a master .pyx
file that uses include
directives to create a monolithic .C file.
See project structure for wrapping many c++ classes in cython to a single shared object.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With