python.rst 1.08 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
Python bindings for Ocarina
===========================

Ocarina Python bindings
#######################

Ocarina proposes Python bindings to its internal APIs. This binding is
available if configured properly, first at compile-time, then at
run-time.

yoogx's avatar
yoogx committed
11 12
At compile time, Ocarina must be configured with shared libraries
support. Refer to the :ref:`installation`;
13

yoogx's avatar
yoogx committed
14 15 16
At run-time, the following environment variables must be set up::

  % export PATH=`ocarina-config --prefix`/bin:$PATH
17 18 19 20 21 22 23
  % export OCARINA_PATH=`ocarina-config --prefix`
  % export LD_LIBRARY_PATH=$OCARINA_PATH/lib:$LD_LIBRARY_PATH
  % export PYTHONPATH=$OCARINA_PATH/include/ocarina/runtime/python:$OCARINA_PATH/lib:$PYTHONPATH

Example
#######

yoogx's avatar
yoogx committed
24
Here is a small examples illustrating Python API capabilities
25

yoogx's avatar
yoogx committed
26 27
.. literalinclude:: ../resources/runtime/python/test/visitor.py
   :language: python
28 29 30 31 32 33

Python API description
######################

The following lists all functions defined in the `ocarina` module

34 35 36 37 38 39 40
.. automodule:: ocarina.ocarina
   :members:

.. automodule:: lmp
   :members:

.. automodule:: ocarina_common_tools
41
   :members: