Skip to content

Conversation

chriso
Copy link
Contributor

@chriso chriso commented Mar 21, 2024

This PR reworks the Registry class so that it can be used to register and dispatch calls to functions hosted on remote endpoints.

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.

@chriso chriso self-assigned this Mar 21, 2024
@chriso chriso merged commit 99b9ed6 into main Mar 21, 2024
@chriso chriso deleted the remote-functions branch March 21, 2024 23:50
This was referenced Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants