Getting Started¶
Installation¶
Or with uv:
Create a Namespace¶
Define your methods and register them with api tags:
# myapp/api.py
from lythonic.compose.namespace import Namespace
from pydantic import BaseModel
class GreetIn(BaseModel):
name: str
class GreetOut(BaseModel):
message: str
def greet(input: GreetIn) -> GreetOut:
"""Greet someone by name."""
return GreetOut(message=f"Hello, {input.name}!")
ns = Namespace()
ns.register(greet, tags=["api"])
Configure the Server¶
Create data/woodglue.yaml:
Create data/myapp_ns.yaml:
Start the Server¶
Call via JSON-RPC¶
curl -X POST http://127.0.0.1:5321/rpc \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"myapp.greet","params":{"input":{"name":"World"}},"id":1}'