Skip to main content

rpc and node backbone

Project description

rekuest-next

codecov PyPI version Maintenance Maintainer PyPI pyversions PyPI status

self-documenting asynchronous scalable RPC based on provisionable untrusted actors

Idea

rekuest is the python client for the rekuest server, it provides a simple interface both register and provide actions (functionality) and call other actions in async and synchronous manner. Contrary to most RPC services, Rekuest is focussed on providing functionaly on the Client, and is especially tailored for scenarios where apps can be developed to perform tasks on users behalves, therefore requiring fine grained access control.

Prerequesits

Requires a running instance of a rekuest server (e.g in an arkitekt deployment).

Install

Currently the usage of rekeust is heavily tied to the arkitekt platform, which provides a simple way to deploy and manage the rekuest server. Please install the arkitekt-next package to get started. This installation will also install the rekuest-next package.

pip install arkitekt-next

If you are working in image analysis checkout the arkitekt platform that also provides data structures for image analysis (composed in the arkitekt platform)

Get started

from arkitekt_next import register

@register
def rpc_function(x: int, name: str) -> str
    """
    A rpc function that we can
    simple call from anywhere

    """
    print(str)



with easy("other_app") as app:
    # this will register the function on the app
    app.run()

Run example:

arkitekt-next run dev

This node is now register under the application and signed in user and can be provisioned and called to by other apps. By default users are only able to asign to their own apps. This can be changed on the rekuest server.

Calling

from arkitekt_next import easy
from rekuest_next import find


with easy("name_of_your_app") as app:
    # this will call the function on the app
    action = find("other_app", "rpc_function")

    x = action.call(
        x=1,
        name="hello world",
    )

    print(x)

Usage with complex Datastructures

Rekuest_next takes care of serialization and documentation of standard python datastructures

  • str
  • bool
  • int
  • float
  • Enum
  • Dict
  • List

To increase performance and latency it is not possible to serialize complex python objects like numpy arrays into the messages. These are best transformed into immutable objects on a centrally accessible storage and then only the reference is passed. Rekuest does not impose any rules on how you handle this storage (see mikro for ideas), it provides however a simple api.

class ComplexStructure:
    id: str # A reference for this structure on central storage

    async def shrink(self):
        return self.id

    @classmethod
    async def expand(cls, value):
        return cls.load_from_server(value)

by providing two functions:

  • shrink
  • expand

You can now use this Structure with simple typehints and arkitekt will automaticall shrink (serialize) and expand (deserialize) the structure on calling.

def complex_call(x: ComplexStrucuture) -> int:
    return x.max()

Terminology

Node A concept (documentatio) of a function that is enabled on the platform.

App: A provider of functions, that negotiates access right to data and other Apps through Oauth2

Template: An Implementation of a Node by an App.

Agent: An active instance of this App, its the host of actors. Agents connect and disconnect.

Actor: A stateless instance of a function that was provisioned

Provision: A contract between arkitekt and a Agent for the usage of a specific function. As long as the provision is active the connected agent will be required to provide the resources of the function (think Deployment in Kubernetes)

Reservation: A contract between a User and arkitekt that wants to use one or mulitple instances of functions (Actors). The platform tries to autocorrect and failure correct. Calls to the function are always address to the reservation no the provision (think: Exchange in RabbitMQ)

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rekuest_next-0.23.0.tar.gz (111.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rekuest_next-0.23.0-py3-none-any.whl (149.8 kB view details)

Uploaded Python 3

File details

Details for the file rekuest_next-0.23.0.tar.gz.

File metadata

  • Download URL: rekuest_next-0.23.0.tar.gz
  • Upload date:
  • Size: 111.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for rekuest_next-0.23.0.tar.gz
Algorithm Hash digest
SHA256 37fa0472682653d41edd63a991075d534d5068a5bdb7929b5a77c1538c1ef16b
MD5 a4851b3f1262c59a555c5fb4c9ec8c25
BLAKE2b-256 6de3a586ce311a14975355f62b111a7a836cbfa0949c17edb7c835ef6ac5b5ae

See more details on using hashes here.

File details

Details for the file rekuest_next-0.23.0-py3-none-any.whl.

File metadata

  • Download URL: rekuest_next-0.23.0-py3-none-any.whl
  • Upload date:
  • Size: 149.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for rekuest_next-0.23.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e5bb60fa46e6350fdb640736c9f6785e6ac2de74d8ca13a16f34f7284cf6f1d8
MD5 722a14900364e19d3b554481a6540fb7
BLAKE2b-256 2ae86ff712b2c622c2524594ce0bd5a2a777d7f25a9aabfa9d0b8806b99077b6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page