It’s much easier to manage a bunch of services when they all have the same shape: the way they’re developed, the way they interact with the infrastructure they run on, and the way they interact with each other. Baseplate is reddit’s specification for the common shape of our services. This library,, is the Python implementation of that specification. integrates with existing application frameworks and provides battle-tested libraries to give you everything you need to build a well-behaving production service without having to reinvent the wheel.

Here’s a simple HTTP service built using the Pyramid web framework:

from baseplate import Baseplate
from baseplate.clients.sqlalchemy import SQLAlchemySession
from baseplate.frameworks.pyramid import BaseplateConfigurator
from pyramid.config import Configurator
from pyramid.view import view_config

@view_config(route_name="hello_world", renderer="json")
def hello_world(request):
    result = request.db.execute("SELECT date('now');")
    return {"Hello": "World", "Now": result.scalar()}

def make_wsgi_app(app_config):
    baseplate = Baseplate(app_config)
    baseplate.configure_context({"db": SQLAlchemySession()})

    configurator = Configurator(settings=app_config)
    configurator.add_route("hello_world", "/", request_method="GET")
    return configurator.make_wsgi_app()

Every request to this example service will automatically emit telemetry that allows you to dig into how the service is performing under the hood:

  • Timers for how long the whole request took and how long was spent talking to the database.

  • Counters for the success/failure of the whole request and each query to the database.

  • Distributed tracing spans (including carrying over trace metadata from upstream services and onwards to downstream ones).

  • Reporting of stack traces to Sentry on crash.

And you don’t have to write any of that.

To get started, dive into the tutorial. Or if you need an API reference, look below.

Table of Contents