puff-rs 0.1.5

Puff - Deep Stack Python Runtime and GraphQL library.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from fastapi import FastAPI
from puff import global_state, wrap_async


app = FastAPI()


@app.get("/fast-api")
async def read_root():
    return {"Hello": "World", "from": "Fast API"}


@app.get("/fast-api-async")
async def read_root():
    result = await wrap_async(
        lambda r: global_state.hello_from_rust_async(r, "hello from asyncio")
    )
    return {"Hello": "World", "from": "Fast API", "rust_value": result}