This repo contains an example of a timing service plugin for the Timing71 system.
Note that it relies on the livetiming-core
package which is not currently
available, but will be open-sourced towards the middle of 2020.
-
Clone this repo:
git clone https://github.com/timing71/livetiming-plugin-example.git cd livetiming-plugin-example
-
Set up a Python virtual environment (optional, but recommended):
python3 -m venv virtualenv source virtualenv/bin/activate pip install --upgrade pip setuptools
-
Set up this project and its dependencies:
pip install -e .
-
Examine
src/livetiming/service/plugins/example/__init__.py
: this demonstrates the basic code required to write a plugin.
Plugins don't get run by themselves, but instead via the livetiming-service
runner, and are identified by package name, for example:
livetiming-service -v example
will run the plugin found at livetiming.service.plugins.example.Service
.
The plugin's main class must be called Service
.
By default the plugin will try to connect to the Timing71 network (and fail, since it won't be able to authenticate). You can instead run the plugin in standalone mode, which will create a local websocket server through which the plugin will publish data:
livetiming-service -v --standalone example
You can also run the plugin through the Timing71 desktop client by configuring
it to search for plugins in the virtualenv/bin
directory you created above.
- You can (of course) install multiple plugins into one virtual environment.
- Note that the
livetiming/service/plugins
directories are all lacking the__init__.py
file you might expect. This makes it possible to install plugins from different source packages.