Generates a Cython wrappers from description dictionaries. This module relies heavily on the type system to convert between C/C++, Cython, and Python types in a seamless way. While this module does not explicitly rely on the auto-describer, it sure helps! The functions in this module are conceptually easy to understand – given class descriptions they generate strings of Cython code – their implementations do a lot of heavy lifting.
This module is available as an xdress plugin by the name xdress.cythongen. Note that while the module does not rely on the autodescriber, the plugin does.
| author: | Anthony Scopatz <scopatz@gmail.com> |
|---|
The main cython generator plugin.
The __init__() method may take no arguments or keyword arguments.
This plugin requires autodescribe.
Generates a cpp_*.pxd Cython header snippet for exposing a C/C++ class or struct to other Cython wrappers based off of a dictionary description of the class or struct.
| Parameters : | desc : dict
exceptions : bool or str, optional
ts : TypeSystem, optional
|
|---|---|
| Returns : | cimport_tups : set of tuples
cpppxd : str
|
Generates a *pxd Cython header snippet for exposing a C/C++ class to other Cython wrappers based off of a dictionary description.
| Parameters : | desc : dict
classes : sequence, optional
ts : TypeSystem, optional
max_callbacks : int, optional
|
|---|---|
| Returns : | cimport_tups : set of tuples
pxd : str
|
Generates a *.pyx Cython wrapper implementation for exposing a C/C++ class based off of a dictionary description. The environment is a dictionary of all class names known to their descriptions.
| Parameters : | desc : dict
classes : dict, optional
ts : TypeSystem, optional
max_callbacks : int, optional
|
|---|---|
| Returns : | pyx : str
|
Sorts the variable names in a cpp_*.pxd module so that C/C++ declarations happen in the proper order.
Generates a cpp_*.pxd Cython header snippet for exposing a C/C++ function to other Cython wrappers based off of a dictionary description.
| Parameters : | desc : dict
exceptions : bool or str, optional
ts : TypeSystem, optional
|
|---|---|
| Returns : | cimport_tups : set of tuples
cpppxd : str
|
Generates a *.pyx Cython wrapper implementation for exposing a C/C++ function based off of a dictionary description.
| Parameters : | desc : dict
ts : TypeSystem, optional
|
|---|---|
| Returns : | pyx : str
|
Generates all cpp_*.pxd Cython header files for an environment of modules.
| Parameters : | env : dict
exceptions : bool or str, optional
ts : TypeSystem, optional
|
|---|---|
| Returns : | cpppxds : dict
|
Generates all pxd Cython header files for an environment of modules.
| Parameters : | env : dict
classes : sequence, optional
ts : TypeSystem, optional
max_callbacks : int, optional
|
|---|---|
| Returns : | pxds : str
|
Generates all pyx Cython implementation files for an environment of modules.
| Parameters : | env : dict
classes : dict, optional
ts : TypeSystem, optional
max_callbacks : int, optional
|
|---|---|
| Returns : | pyxs : str
|
Generates a cpp_*.pxd Cython header file for exposing a C/C++ module to other Cython wrappers based off of a dictionary description of the module.
| Parameters : | mod : dict
exceptions : bool or str, optional
ts : TypeSystem, optional
|
|---|---|
| Returns : | cpppxd : str
|
Generates a pxd Cython header file for exposing C/C++ data to other Cython wrappers based off of a dictionary description.
| Parameters : | mod : dict
classes : sequence, optional
ts : TypeSystem, optional
max_callbacks : int, optional
|
|---|---|
| Returns : | pxd : str
|
Generates a pyx Cython implementation file for exposing C/C++ data to other Cython wrappers based off of a dictionary description.
| Parameters : | mod : dict
classes : dict, optional
ts : TypeSystem, optional
max_callbacks : int, optional
|
|---|---|
| Returns : | pyx : str
|
Sorts the names in a module to make sure that pxd declarations happen in the proper order.
Generates a cpp_*.pxd Cython header snippet for exposing a C/C++ variable to other Cython wrappers based off of a dictionary description.
| Parameters : | desc : dict
exceptions : bool or str, optional
ts : TypeSystem, optional
|
|---|---|
| Returns : | cimport_tups : set of tuples
cpppxd : str
|
Generates a *.pyx Cython wrapper implementation for exposing a C/C++ variable based off of a dictionary description.
| Parameters : | desc : dict
ts : TypeSystem, optional
|
|---|---|
| Returns : | pyx : str
|