Skip to main content

Open-RPC API hosting and interactive documentation.

Project description

Tabella

Open-RPC development framework with builtin interactive documentation.

Demo

Install

Tabella is on PyPI and can be installed with:

pip install tabella

Or with Poetry

poetry add tabella

Python OpenRPC Docs

The RPC server hosted and documented by Tabella is powered by Python OpenRPC. Refer to the Python OpenRPC docs hosted here for advanced use.

Getting Started

A basic Tabella app:

import tabella
from openrpc import RPCServer
import uvicorn

rpc = RPCServer()


@rpc.method()
def echo(a: str, b: float) -> tuple[str, float]:
    """Echo parameters back in result."""
    return a, b


app = tabella.get_app(rpc)

if __name__ == "__main__":
    uvicorn.run(app, host="127.0.0.1", port=8000)

Run this, then open http://127.0.0.1:8000/ in your browser to use the interactive documentation.

The Open-RPC API will be hosted over HTTP on http://127.0.0.1:8000/api and over WebSockets on ws://127.0.0.1:8000/api.

Further Usage

Security and Depends Arguments

The tabella.get_app function accepts argument, middleware, which is a callable that will be passed HTTP request headers/WebSocket connection headers. The middleware function must return a tuple of two dictionaries, the first will be passed to the RPC Server as Depends Arguments and the second as Security Arguments.

Set Servers

Set RPC servers manually to specify transport and paths to host the RPC server on, e.g.

from openrpc import RPCServer, Server
import tabella

rpc = RPCServer(
    servers=[
        Server(name="HTTP API", url="http://localhost:8000/my/api/path"),
        Server(name="WebSocket API", url="ws://localhost:8000/my/api/path"),
    ]
)
app = tabella.get_app(rpc)

This app will host the RPCServer over HTTP and over WebSockets with the path /my/api/path.

Pydantic

Pydantic is used for request/response deserialization/serialization as well as schema generation. Pydantic should be used for any models as seen here in the Python OpenRPC Docs.

FastAPI

Tabella HTTP and WebSocket server hosting is uses FastAPI. The app returned by tabella.get_app is a FastAPI app.

Inspired By

Support The Developer

Buy Me A Coffee

Project details


Download files

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

Source Distribution

tabella-0.96.2.tar.gz (204.6 kB view details)

Uploaded Source

Built Distribution

tabella-0.96.2-py3-none-any.whl (233.3 kB view details)

Uploaded Python 3

File details

Details for the file tabella-0.96.2.tar.gz.

File metadata

  • Download URL: tabella-0.96.2.tar.gz
  • Upload date:
  • Size: 204.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.12 Linux/6.4.6-76060406-generic

File hashes

Hashes for tabella-0.96.2.tar.gz
Algorithm Hash digest
SHA256 366cc6a511d85e635c999701b07a28bce049cffff1d6938ede07fcefc1dc8a4c
MD5 145f2fa9218c85118b324eb58d498a99
BLAKE2b-256 57d803c82ad9f812d2c042f7b4c5186b9e4d8a93592de40214d8412a05fa3785

See more details on using hashes here.

File details

Details for the file tabella-0.96.2-py3-none-any.whl.

File metadata

  • Download URL: tabella-0.96.2-py3-none-any.whl
  • Upload date:
  • Size: 233.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.12 Linux/6.4.6-76060406-generic

File hashes

Hashes for tabella-0.96.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b48f91c7e67cc4d0d40101221d5d42c4f07a4581c625ac433960645361ebe854
MD5 266026cfe8993256df0c986f0c09716d
BLAKE2b-256 dff71f92b0f4adef7c96a3d7f4de1c0360607941bd0270d396ab8360d887e5ad

See more details on using hashes here.

Supported by

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