Skip to main content

wyolet-api-tools

Stateful FastAPI primitives — rate limit, distributed lock, idempotency keys — sharing one Backend protocol. Memory or Redis today; sqlite and postgres on the roadmap.

First package under the wyolet umbrella.

uv add wyolet-api-tools

Why

Every FastAPI project ends up reinventing the same primitives. The existing packages are each scoped to one of them — slowapi for rate limiting, redlock-py for locks, aiocache for caching — each with its own backend abstraction and lifecycle quirks. wyolet.api_tools unifies them: write one backend, get every primitive that needs state.

Quickstart

from fastapi import FastAPI, Depends
from wyolet.api_tools.backends.redis import RedisBackend
from wyolet.api_tools.ratelimit import RateLimit
from wyolet.api_tools.lock import Lock
from wyolet.api_tools.idempotency import Idempotency

backend = RedisBackend("redis://localhost")

app = FastAPI()

@app.post("/transfer", dependencies=[Depends(RateLimit(backend, "10/minute"))])
async def transfer(...):
    async with Lock(backend, key=f"user:{user_id}", ttl=30):
        ...

@app.post("/charge", dependencies=[Depends(Idempotency(backend, ttl=3600))])
async def charge(...):
    ...

Backends

Backend Status Use for
MemoryBackend v0.1 dev, tests, single-process
RedisBackend v0.1 production
SqliteBackend planned small deployments without redis
PostgresBackend planned when redis is overkill

Bring-your-own backend by implementing the Backend protocol — every primitive in this package will work with it.

Status

Pre-alpha. v0.1 ships rate limit, distributed lock, idempotency on memory + redis. Roadmap: dedup, OTP, feature flags, cache decorator, circuit breaker, retry, outbound throttle, pool/health composers.

License

TBD.

Metadata

Release files for wyolet-api-tools 0.0.1

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

Source distribution (sdist)

Source distribution for wyolet-api-tools 0.0.1
File Size Uploaded
wyolet_api_tools-0.0.1.tar.gz 3.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wyolet-api-tools 0.0.1
File Interpreter ABI Platform
wyolet_api_tools-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 5.5 kB

Release files / wyolet_api_tools-0.0.1.tar.gz

Download URL wyolet_api_tools-0.0.1.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
31e10cc0a61eb1bb0b5e6f0d1ab3b029956e6647e3e32548e63aac05950799a3
BLAKE2b-256 checksum
How to use checksums
d24dd4ba29466a5e83c5a2d8bf5f0eddbbabbfb63feaecbc69ad12d2d99e636f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.8

Release files / wyolet_api_tools-0.0.1-py3-none-any.whl

Download URL wyolet_api_tools-0.0.1-py3-none-any.whl
Size 2.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6183a00228f56018a6434382066568d08a8d438fcc99e8ee6891916230416166
BLAKE2b-256 checksum
How to use checksums
09b1e4daabf2e4856a0e1a161285a5504602dd5a613fba187118d04bb897ee0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.8

Release history Release notifications | RSS feed

This release

0.0.1 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