Babeltrace 1.5 Python bindings

Generated on March 03, 2020.


Welcome to Babeltrace’s Python bindings’ documentation!

Babeltrace is a trace format converter. It is able to read and write different trace formats, such as the Common Trace Format (CTF). Babeltrace also acts as the CTF reference implementation.

The Babeltrace Python bindings rely on the libbabeltrace library, the current public C API of Babeltrace.


The Python bindings may be enabled when configuring Babeltrace’s build:

./configure --enable-python-bindings

On Debian and Ubuntu, the Python bindings are available in the python3-babeltrace package.


Currently, the Babeltrace Python bindings only works with Python 3.


The Babeltrace Python bindings are available as a single Python package, babeltrace.

The Babeltrace Python bindings’ API is divided into two parts:

  • The reader API is exposed by the babeltrace.reader module, a set of classes used to open a collection of different traces and iterate on their events.
  • The CTF writer API is exposed by the babeltrace.writer module, which makes it possible to write a complete CTF trace from scratch.


For backward compatibility reasons, the reader API is imported in the package itself. The CTF writer API is imported in the package itself too, as CTFWriter. It is, however, strongly recommended to import and use the three modules (babeltrace.common, babeltrace.reader, and babeltrace.writer) explicitly, since there is no long-term plan to maintain the compatibility layer.