Closed chriso closed 6 months ago
This PR reworks the Registry class so that it can be used to register and dispatch calls to functions hosted on remote endpoints.
Registry
from dispatch import Registry remote = Registry("http://some.foreign.endpoint/") @remote.function def foo(bar: int) -> str: ...
You only need to register a stub for remote functions. You can then dispatch calls to them (e.g. foo.dispatch(bar)), and also use them within a local function/coroutine (e.g. await foo(bar)). Type checking works as expected in both cases.
foo.dispatch(bar)
await foo(bar)
This PR reworks the
Registry
class so that it can be used to register and dispatch calls to functions hosted on remote endpoints.You only need to register a stub for remote functions. You can then dispatch calls to them (e.g.
foo.dispatch(bar)
), and also use them within a local function/coroutine (e.g.await foo(bar)
). Type checking works as expected in both cases.