pyRPC
DemoBlogChangelogDocs
Get Started

Installation

Install pyRPC and its modular adapters.

pyRPC follows a modular packaging strategy. You only pay for what you use.

Core Package

The tiny core protocol and runtime. This is always required.

# Using uv
uv add pyrpc-core

# Using pip
pip install pyrpc-core

Adapters

Install the adapter for your favorite web framework.

FastAPI

uv add pyrpc-fastapi

Flask

uv add pyrpc-flask

Development Tools

The pyrpc-codegen package provides the CLI for introspecting your server and synchronizing contracts.

uv add pyrpc-codegen

Contract Synchronization

To generate TypeScript types/contracts from a running server:

npx pyrpc codegen --url http://localhost:8000

Quick Start Example (FastAPI)

from fastapi import FastAPI
from pyrpc_core import rpc
from pyrpc_fastapi import mount_fastapi

app = FastAPI()

@rpc
def add(a: int, b: int) -> int:
    return a + b

mount_fastapi(app)

Next

  • Quickstart — Full server + client example
  • Concepts — Mental model and protocol design