Open-RPC API hosting and interactive documentation.
Project description
Tabella
Open-RPC development framework with builtin interactive documentation.
Live Demo
A live demo is available here.
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:
from tabella import Tabella
app = Tabella()
@app.method()
def echo(a: str, b: float) -> tuple[str, float]:
"""Echo parameters back in result."""
return a, b
if __name__ == "__main__":
app.run()
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
Routers
An app with many modules can be organized into segments using Method Routers.
Security and Depends Arguments
Tabella passes request headers to the RPCServer process request methods. Details on usage can be found in the Python OpenRPC docs on Depends Arguments.
Set Servers
Set RPC servers manually to specify transport and paths to host the RPC server on, e.g.
from openrpc import Server
from tabella import Tabella
app = Tabella(
servers=[
Server(name="HTTP API", url="http://localhost:8000/my/api/path"),
Server(name="WebSocket API", url="ws://localhost:8000/my/api/path"),
]
)
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.
Starlette
Tabella HTTP and WebSocket server hosting uses Starlette. Uvicorn can be used to run the starlette app.
uvicorn main:app.starlette --reload
Monitor
If you are running the app with in debug mode, e.g. app = Tabella(debug=True)
, then at
the path /monitor
there is a display that will show requests and responses made to the
RPC server as they happen.
Inspired By
Support The Developer
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
Built Distribution
File details
Details for the file tabella-2.3.3.tar.gz
.
File metadata
- Download URL: tabella-2.3.3.tar.gz
- Upload date:
- Size: 209.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.12.1 Linux/6.6.13-200.fc39.x86_64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a357d68445a50d06a8cfea6240da0b8cf2db52ab19ca7368fa996449350488e7 |
|
MD5 | 0dea0ba227d39b4efbac4539435bdb82 |
|
BLAKE2b-256 | 6097b49d6176760a2fa7b3e9279f28bd0aa51c1a70ac1a38a3750152878f6ac2 |
File details
Details for the file tabella-2.3.3-py3-none-any.whl
.
File metadata
- Download URL: tabella-2.3.3-py3-none-any.whl
- Upload date:
- Size: 242.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.12.1 Linux/6.6.13-200.fc39.x86_64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ebf5ee10a0f726951a73e029d0630e448f2308b90e852eed45db3b8c9c8b190 |
|
MD5 | 461955b0b9a4b5beb46bdd97b828936d |
|
BLAKE2b-256 | 55ebe5524b171f0646bfc7396908295e82cc1bde190d776a51d21755b15a5000 |