DEV Community


Posted on

Create Errbot backend/storage plugin as PyPI package

In develoving some Errbot plugins, I am thinking that storage and backend plugins have better managed as package (if possible, should be register at PyPI)

1. In bootstrapping, Errbot does not install dependencies of backend and backend.

To run bot, I call errbot command. In this command, load plugins in order of storage, backend and bot-plugins.
When bootstrap load storage and backend plugin, it does not check dependencies.

Actually some plugins let to install dependencies by command-line.


If plugins have dependencies and need to install manually these, I think better to define as module and package.

2. In running, Errbot does not change dynamically storage and backend.

Errbot is running as daemon generally. for that reason, storage and backend plugin will not almost be changed in running.

Therefore, these can be managed as requirements together with Errbot core.
If this, pip install -r requirements.txt in your local repository can install all dependencies.

ex: (these plugins are not registered in PyPI)


Create as project

List of files

Project structure is same to standard python package.

  • setup.cfg
  • README.rst
  • errbot_backend_demo
    • demo.plug


It can write simply.

#!/usr/bin/env python
from setuptools import setup



Currently, all metadata can write in setup.cfg.
Please define options.package_data section and include_package_data key to include .plug file as installation resource.

name = errbot-backend-demo
version = attr:errbot_backend_demo.__version__
author = Kazuya Takei
author_email =
description = Demo backend plugin for Errbot
long_description = file:README.rst

install_requires = YOUR_DEPENDENCIES
packages = find:
include_package_data = True

errbot_backend_demo = *.plug


Write normally.

As same as setup.cfg, define .plug as include file.

include errbot_backend_demo/*.plug

Define version of package here. And define function to return path of installation path.

from pathlib import Path

__version__ = '0.0.1-alpha.1'

def get_plugin_dir() -> str:
    module_dir = Path(__file__).parent
    return str(module_dir) and demo.plug

Write normally as plugin.

Use in Errbot

If plugin define as package by these, you can write to use plugin.

import errbot_backend_demo

BOT_EXTRA_BACKEND_DIR = errbot_backend_demo.get_plugin_dir()
BACKEND = 'Demo'

Top comments (0)