Module

plugin

Plugin protocol — structural typing for reusable Chirp plugins.

A plugin is any object with aregister(app, prefix)method. No base class required.

Usage (plugin author)::

class BlogPlugin:
    def register(self, app: App, prefix: str) -> None:
        @app.route(f"{prefix}/")
        async def blog_index():
            return Template("blog/index.html")

Usage (plugin consumer)::

app = App()
app.mount("/blog", BlogPlugin())

Classes

ChirpPlugin 1
Protocol for Chirp plugins. Any object with a ``register`` method matching this signature is a val…

Protocol for Chirp plugins.

Any object with aregistermethod matching this signature is a valid plugin — no inheritance required.

Methods

register 2
def register(self, app: App, prefix: str) -> None
Parameters
Name Type Description
app
prefix