Broadway would be nothing without extensions. Extensions allow broadway to load and configure flask extensions using environment variables.

Registering Extensions

Install extensions from PyPI then load them into your application using Factory.add_extension(). You can load many extensions at once using Factory.add_extensions().

$ pip install broadway-sqlalchemy

Extensions will generally add to the factory’s config schema and initialise third-party code. The factory will initialise applications it creates using the extensions in registration order.

Creating Extensions

Extensions are python objects or modules that provide the following methods:


A hook to register the extension with a factory. Do any setup here, such as adding to the factories config schema.

def register(factory):
Parameters:factory (Factory) – the calling factory

A hook called to initialise an application. Do any initialisation here, such as calling init_app() on a flask extensions.

def init_app(application):
Parameters:application (flask.Flask) – the flask application

When the extension wraps a flask extension, extension should provide an instance of the original flask extension.

Do not create libraries dependent on broadway. Instead create reusable libraries, and then flask/broadway bindings on top of them.

Example Extension

Most broadway extensions should be simple wrappers to existing libraries and flask extensions. The following is an example broadway extension. It wraps the SQLite3 extension in the Flask documentation.

from flask_sqlite3 import SQLite3

    'type': str,
    'default': ':memory:'

extension = SQLite3()

def register(factory):

def init_app(application):