Plugins are pieces of software which are designed to extend the basic functionalities of the traffic library. Plugins can be implemented through a registration mechanism and selectively activated in the configuration file.

Some plugins are provided by the traffic library with visualisation facilities for Leaflet, and CesiumJS.

Plugin activation

You may activate plugins in the configuration file:

>>> import traffic
>>> traffic.config_file

Then edit the following line according to the plugins you want to activate:

enabled_plugins = Leaflet, Kepler, CesiumJS

Available plugins

The examples are provided using the data produced in the Quickstart page.

from import quickstart, lfbo_tma

def landing_trajectory(flight: "Flight") -> bool:
    return (
        flight.min("altitude") < 10_000 and
        flight.mean("vertical_rate") < -500

demo = (
    # non intersecting flights are discarded
    # intersecting flights are filtered
    # filtered flights not matching the condition are discarded
    # stay below 25000ft
    .query('altitude < 25000')
    # final multiprocessed evaluation (4 cores) through one iteration

Plugin registration

You may write your own plugins to monkey-patch the library and registrate them using entry points in your configuration.

Write your code in a my_traffic_plugin/ and use the following sample to registrate your plugin. Then edit the configuration file and add MyPlugin to the list of enabled plugins.

You may then python install your plugin. Put the monkey-patching in an _onload() function that will be called iff the plugin is enabled. (Check an example on the github repository)

from setuptools import setup

    description="My first traffic plugin",
        "traffic.plugins": [
            "MyPlugin = my_traffic_plugin.plugin"