When writing your Cython modules, you may want to encapsulate generic functions and types in a separate file. Cython allows you to reuse those components with the
cimport statement by writing a definition file.
Let's say we have a module with the functions
min, and we want to reuse those functions in multiple Cython programs. If we simply write a
.pyx file—also called implementation file—the functions declared are confined in the same module.
Definition files are also used to interface Cython with an external C code. The idea is to copy the types and function prototypes in the definition file and leave the implementation to the external C code.
To share those functions we need to write a definition file, with a ...