Examples

There are a few examples bundled with bonobo.

You’ll find them under the bonobo.examples package, and you can run them directly as modules:

$ bonobo run -m bonobo.examples…module

Datasets

The bonobo.examples.datasets package contains examples that generates datasets locally for other examples to use. As of today, we commit the content of those datasets to git, even if that may be a bad idea, so all the examples are easily runnable. Later, we’ll see if we favor a “missing dependency exception” approach.

Coffeeshops

Extracts a list of parisian bars where you can buy a coffee for a reasonable price, and store them in a flat text file.

digraph { rankdir = LR; stylesheet = "../_static/graphs.css"; BEGIN [shape="point"]; BEGIN -> "ODS()" -> "transform" -> "FileWriter()"; }

Fablabs

Extracts a list of fablabs in the world, restrict to the ones in france, then format it both for a nice console output and a flat txt file.

digraph { rankdir = LR; stylesheet = "../_static/graphs.css"; BEGIN [shape="point"]; BEGIN -> "ODS()" -> "normalize" -> "filter_france" -> "Tee()" -> "JsonWriter()"; }

bonobo.examples.datasets.fablabs.display(row)[source]
bonobo.examples.datasets.fablabs.normalize(row)[source]

Types

Strings

Example on how to use symple python strings to communicate between transformations.

digraph { rankdir = LR; stylesheet = "../_static/graphs.css"; BEGIN [shape="point"]; BEGIN -> "extract()" -> "transform(s: str)" -> "load(s: str)"; }

bonobo.examples.types.strings.extract()[source]
bonobo.examples.types.strings.transform(s: str)[source]
bonobo.examples.types.strings.load(s: str)[source]

Dicts

Example on how to use symple python dictionaries to communicate between transformations.

digraph { rankdir = LR; stylesheet = "../_static/graphs.css"; BEGIN [shape="point"]; BEGIN -> "extract()" -> "transform(row: dict)" -> "load(row: dict)"; }

bonobo.examples.types.dicts.extract()[source]
bonobo.examples.types.dicts.transform(row: dict)[source]
bonobo.examples.types.dicts.load(row: dict)[source]

Bags

Example on how to use bonobo.Bag instances to pass flexible args/kwargs to the next callable.

digraph { rankdir = LR; stylesheet = "../_static/graphs.css"; BEGIN [shape="point"]; BEGIN -> "extract()" -> "transform(...)" -> "load(...)"; }

bonobo.examples.types.bags.extract()[source]
bonobo.examples.types.bags.transform(topic: str)[source]
bonobo.examples.types.bags.load(topic: str, title: str, rand: int)[source]

Utils

Count

Simple example of bonobo.count() usage.

digraph { rankdir = LR; stylesheet = "../_static/graphs.css"; BEGIN [shape="point"]; BEGIN -> "range()" -> "count" -> "print"; }