Creating a PyCVF Package
PyCVF is a glue in-between lego-bricks.
The question is then how to link libraries to pycvf.
The first important part of the work is to make the datatype used
by your library compatible with the datatypes defined in PyCVF,
or eventually to define a new datatype.
Then the second point is to declare the processing elements that
you want to make accessible to PyCVF.
Creating a PyCVF Extension
- The first step is to create pycvfext package::
- pycvf-admin start-package mylib
Linking with C code
For creating the compatibility with pycvf datatypes,
the simplest solution is generally to write a C wrapper
that provide an numpy array interface. Since most pycvf
datatypes are numpy based it is generally the simplest
and the most efficient.
Linking with Python code
When the library is based on C function it is generally quite easy to
create wrapper for all the functions of the library.
The basic approach consists of course in using pycvf_node_function for
declaring the function.
Wrap_f is generally not exactly the exact function from the initial
library as the argument are often reordered to match PyCVF standards,
and also if some datatype wrapping/unwrapping is necessary it will be
performed at this step.
Often, as all libraries have quite well defined design it is possible
to write decorators function and declaration list that makes the
creation of the wrapper much simple.
Making your module PyCVF compatible
If you have normal python module, the simplest way to make it pycvf
compatible is to add a “pycvfext” directory inside of the module.
The advatange of this solution is that is does not require the user to
install a bridge package.
There would be inside of this directory the classical subdirectories
As usual a demo folder, and a documentation would also be welcome.