Skip to main content

trpc-core

Toolkit for implementing tRPC servers in python

trpc-core is currently in prototype stage. You are welcome to play with the code or drop feedback in issues, just don't expect anything usable or functional yet.

Example tRPC API with Flask:

import trpc
from flask import Flask, jsonify, request


class Router(trpc.Router):
    @trpc.query(name="helloWorld")
    def hello_world(context) -> str:
        return "Hello world"

    @trpc.mutation(name="sum")
    def sum(context, *, a: int, b: int) -> int:
        return a + b


server = trpc.Server(Router)


app = Flask(__name__)


@app.route("/trpc/<path:path>", methods=["GET"])
def trpc_query(path):
    result = server.query(path)
    return jsonify(result)


@app.route("/trpc/<path:path>", methods=["POST"])
def trpc_mutation(path):
    result = server.mutation(path)
    return jsonify(result)

Metadata

Release files for trpc-core 0.1.0

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

Source distribution (sdist)

Source distribution for trpc-core 0.1.0
File Size Uploaded
trpc_core-0.1.0.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for trpc-core 0.1.0
File Interpreter ABI Platform
trpc_core-0.1.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 10.3 kB

Release files / trpc_core-0.1.0.tar.gz

Download URL trpc_core-0.1.0.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a76828a6dfe1dca26ca65594fa1e642278353c4c853d87659b2f4797af70b52c
BLAKE2b-256 checksum
How to use checksums
37bdb2bb55cbaec88630e15e8c717efbba311ab94896d6f1cc4682b18bf2e76a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Release files / trpc_core-0.1.0-py2.py3-none-any.whl

Download URL trpc_core-0.1.0-py2.py3-none-any.whl
Size 6.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
93ba9b5fd1b123e3771973f7b7e3e1c9e38a26d13ed3737b6d24ac8450775025
BLAKE2b-256 checksum
How to use checksums
160f1f560df428061cd8f1cfa7c0b385e2c56d3562b6e15f35ef33702575371b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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