Skip to main content

SimpleGRPC


High-performance gRPC made simple. Write less, ship to production faster.

Development using gRPC made easy. Heavily inspired by FastAPI.

Important Disclaimer: In active development. Lock the package version and run your own tests.

🔥 Key Features

  • Familiar, minimal API: an app object with a single decorator - @app.rpc("Service", "Method") - maps plain Python functions onto gRPC handlers, FastAPI-style.
  • Zero protobuf boilerplate: .proto files are auto-discovered, compiled with protoc, and wired to your handlers at startup - no build step, no generated code to check in.
  • FastAPI-style dependency injection: Depends() with nested dependency trees, caching-free depth-first resolution, and generator dependencies with pre/post teardown (yield), plus app-wide dependencies.
  • Built-in injectables: handlers receive request, request_iterator, and context by parameter name - no protocol noise.
  • Schemaless RPCs: @app.schemaless_rpc("Service", "Method") - build protobuf-free services over google.protobuf.Struct, sending and receiving plain dicts.
  • Full streaming support: all four RPC flavors out of the box - unary, request-streaming, response-streaming, and bidirectional - response streams can yield messages or dicts.
  • Typed exceptions for every gRPC status code: 16 concrete exceptions (NotFoundError, InvalidArgumentError, UnauthenticatedError, …) that auto-map to abort() on unary and streaming calls alike.
  • First-class TLS/mTLS: ServerCredentials accepts paths or raw PEM, validates certificates fail-fast at startup, and supports client-auth.
  • Hot-reload dev mode: app.dev() watches your .py and .proto files, recompiles and restarts on change - the gRPC developer loop FastAPI users expect.
  • Production-grade logging out of the box: colorized access logs per RPC plus lifecycle/error loggers, configurable via LoggingConfig and honoring NO_COLOR.
  • Full access to gRPC internals when you need them: pass interceptors, compression, channel options, xds, and concurrency limits straight through ServerOptions to grpc.server().
  • Small and inspectable: Minimal abstraction, minimal dependencies, no magic you can't read.

⚙️ Installation

From pypi:

pip install simple-grpcio

The package name on PyPI ends in "io" because the desired name was already taken 🥲.

🚀 Quickstart

Server-side snippets: each one is a complete, runnable file (python server.py).

Schemaless endpoints

No proto files at all - plain dicts in, dicts out.

from simple_grpc import SimpleGRPC

app = SimpleGRPC(port=50051)


@app.schemaless_rpc("Greeter", "SayHello")
def say_hello(request):
    return {"message": f"Hello, {request['name']}!"}


if __name__ == "__main__":
    app.run()

Proto-backed endpoints

Pass proto content inline; it is compiled at startup into a generated-code directory under the system temp dir - no .proto file, no build step.

from simple_grpc import SimpleGRPC

CALCULATOR_PROTO = """
syntax = "proto3";

service Calculator {
  rpc Add (AddRequest) returns (AddReply);
}

message AddRequest {
  int64 a = 1;
  int64 b = 2;
}

message AddReply {
  int64 sum = 1;
}
"""

app = SimpleGRPC(raw_protos={"calculator": CALCULATOR_PROTO}, port=50052)


@app.rpc("Calculator", "Add")
def add(request):
    return {"sum": request.a + request.b}


if __name__ == "__main__":
    app.run()

Dependency injection

Declare Depends() in the handler signature. Plain dependencies resolve before the call; generator dependencies (yield) open and tear down around it.

from typing import Annotated

from simple_grpc import Depends, SimpleGRPC

app = SimpleGRPC(port=50053)


def auth_dep(context):
    """Read the bearer token from the metadata headers."""
    metadata = dict(context.invocation_metadata())
    if metadata.get("authorization") != "Bearer abc123":
        context.abort(16, "unauthenticated")
    return "alice"


UserDep = Annotated[str, Depends(auth_dep)]


def db_session():
    """Open a fake session for the handler and close it afterwards."""
    print("db: session opened")
    yield {"notes": ["shopping", "taxes"]}
    print("db: session closed")


@app.schemaless_rpc("Notes", "GetNote")
def get_note(request, user: UserDep, db: Annotated[dict, Depends(db_session)]):
    return {"user": user, "title": db["notes"][int(request["id"]) - 1]}


if __name__ == "__main__":
    app.run()

During development, swap app.run() for app.dev() to hot-reload on file changes.

More examples...

Health checking

Pass health=True to expose the standard grpc.health.v1.Health service (the gRPC health checking protocol): Kubernetes, Envoy and grpcurl can probe the server with zero extra code.

from grpc_health.v1 import health_pb2

from simple_grpc import SimpleGRPC

app = SimpleGRPC(port=50053, health=True)  # reports SERVING for the whole server

if __name__ == "__main__":
    app.run()

To report a degraded state, flip the status on the servicer (available after the server starts):

app.health_servicer.set("", health_pb2.HealthCheckResponse.NOT_SERVING)

Reflection

Pass reflection=True to expose the standard gRPC server reflection service: clients and tools (grpcurl, Postman, Insomnia) discover the served services and their schema at runtime, without the .proto files compiled in.

from simple_grpc import SimpleGRPC

app = SimpleGRPC(port=50058, reflection=True)

if __name__ == "__main__":
    app.run()
grpcurl -plaintext localhost:50058 list
grpcurl -plaintext -d '{"name": "grpcurl"}' localhost:50058 Greeter/SayHello

Reflection is aimed at testing and tooling - consider disabling (or restricting) it in production.

🧪 Tests

uv run pytest -vs

Metadata

Release files for simple-grpcio 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simple-grpcio 0.1.7
File Size Uploaded Provenance
simple_grpcio-0.1.7.tar.gz 34.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for simple-grpcio 0.1.7
File Interpreter ABI Platform
simple_grpcio-0.1.7-py3-none-any.whl Python 3 none any Details

Total release size: 63.8 kB

Release files / simple_grpcio-0.1.7.tar.gz

Download URL simple_grpcio-0.1.7.tar.gz
Size 34.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4a8ac9a2642974459431564260e9e9019223e22e9c9ea59dc19b287faf8d84af
BLAKE2b-256 checksum
How to use checksums
f0283d4d08afe68a26ac94fc18852ec303660cd71b0f95b289f7080ebcd3c76a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

Release files / simple_grpcio-0.1.7-py3-none-any.whl

Download URL simple_grpcio-0.1.7-py3-none-any.whl
Size 29.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b264ebd1ff8bd44e39866e2f32b5b44c1b7fa7c40200893eb0a969783c187b71
BLAKE2b-256 checksum
How to use checksums
4b3bb696ef34f63eeacb1cadf823b56b9f86141a31b55c9c21e209153719a6bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

Security for simple-grpcio 0.1.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for simple_grpcio-0.1.7.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.7 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page