Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Plugin and hook calling mechanisms for python

Project Description

Please read the docs to learn more!

A definitive example

import aiopluggy, asyncio

hookspec = aiopluggy.HookspecMarker("myproject")
hookimpl = aiopluggy.HookimplMarker("myproject")

class MySpec(object):
    """A hook specification namespace.
    def myhook(self, arg1, arg2):
        """My special little hook that you can customize.

class Plugin_1(object):
    """A hook implementation namespace.
    async def myhook(self, arg1, arg2):
        print("inside Plugin_1.myhook()")
        return arg1 + arg2

class Plugin_2(object):
    """A 2nd hook implementation namespace.
    def myhook(self, arg1, arg2):
        print("inside Plugin_2.myhook()")
        return arg1 - arg2

async def main():
    # create a manager and add the spec
    pm = aiopluggy.PluginManager("myproject")

    # register plugins
    await pm.register(Plugin_1())
    await pm.register(Plugin_2())

    # call our `myhook` hook
    results = await pm.hook.myhook(arg1=1, arg2=2)


Release History

This version
History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(12.8 kB) Copy SHA256 Hash SHA256
Source None Feb 14, 2018

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers