Closed chriso closed 9 months ago
I've been thinking about namings, what if we were following the same model as FastAPI and have the main object called Dispatch?
from fastapi import FastAPI
from dispatch.fastapi import Dispatch
app = FastAPI()
dispatch = Dispatch(app)
I don't know how the model scales to supporting other frameworks that may have different conventions, but maybe we'll just adopt a different convention for each so it feels more native.
That's cleaner, I like it. edit: updated
dispatch.fastapi.configure
now returns a function registry that provides a decorator to register functions.Previously, we were adding attributes to the FastAPI
app
:Now, the new
Dispatch
constructor returns adispatch.Registry
instance which provides the decorator:This is better because:
dispatch
variable above has a concreteRegistry
type. Previously, tooling had trouble accessing and checking types since we were dynamically storing attributes on thefastapi.FastAPI()
instance (app
)