from fastapi import FastAPI
from dispatch.fastapi import Endpoint
app = FastAPI()
dispatch = Endpoint(app)
@dispatch.function
def my_local_func(): ...
Previously you had from dispatch.fastapi import Dispatch for local endpoints, and from dispatch import Registry for remote endpoints (#134).
With this PR we avoid using the ambiguous Dispatch and Registry names, and the ambiguous top-level namespace (from dispatch import $thing).
I've maintained backward compatibility by creating a dispatch.fastapi.{Dispatch => Endpoint} alias (so from dispatch.fastapi import Dispatch continues to work).
This PR changes the import scheme so that the construction of local and remote endpoints is clearer.
For remote endpoints:
For local endpoints (e.g. using FastAPI):
Previously you had
from dispatch.fastapi import Dispatch
for local endpoints, andfrom dispatch import Registry
for remote endpoints (#134).With this PR we avoid using the ambiguous
Dispatch
andRegistry
names, and the ambiguous top-level namespace (from dispatch import $thing
).I've maintained backward compatibility by creating a
dispatch.fastapi.{Dispatch => Endpoint}
alias (sofrom dispatch.fastapi import Dispatch
continues to work).