Packaging and Publish

Publish your module on PyPI

Publish modules on PyPI is one of the easiest way for users to install your package. Please refer to related documentation and tutorials about PyPI and pip for publishing packages.

For EFB modules, the package is RECOMMENDED to have a name starts with efb-, or in the format of efb-platform-type, e.g. efb-irc-slave or efb-wechat-mp-filter-middleware. If there is a collision of name, you MAY adjust the package name accordingly while keeping the package name starting with efb-.

When you are ready, you may also want to add your module to the Modules Repository of EFB.

Module discovery

EH Forwarder Bot uses Setuptools’ Entry Point feature to discover and manage channels and middlewares. In your setup.py script or .egg-info/entry_points.txt, specify the group and object as follows:

  • Group for master channels: ehforwarderbot.master

  • Group for slave channels: ehforwarderbot.slave

  • Group for middlewares: ehforwarderbot.middleware

Convention for object names is <author>.<platform>, e.g. alice.irc. This MUST also be your module’s ID.

Object reference MUST point to your module’s class, which is a subclass of either Channel or Middleware.

Example

setup.py script

setup(
    # ...
    entry_points={
        "ehforwarderbot.slave": ['alice.irc = efb_irc_slave:IRCChannel']
    },
    # ...
)

.egg-info/entry_points.txt

[ehforwarderbot.slave]
alice.irc = efb_irc_slave:IRCChannel

Private modules

If you want to extend from, or make changes on existing modules for your own use, you can have your modules in the private modules directory.

For such modules, your channel ID MUST be the fully-qualified name of the class. For example, if your class is located at <EFB_BASE_PATH>/modules/bob_irc_mod/__init__.py:IRCChannel, the channel MUST have ID bob_ric_mod.IRCChannel for the framework to recognise it.