Update docs to be more readable and add uv instructions

Rewrote README and DEVELOPMENT.md to sound less robotic. Added changelog
documenting the new test suite and other recent changes.
This commit is contained in:
2026-01-09 00:50:57 +00:00
parent 9fe700296d
commit e658aa92a2
3 changed files with 219 additions and 24 deletions

View File

@@ -1,20 +1,21 @@
# FastAPI Traffic
Production-grade rate limiting for FastAPI with multiple algorithms and storage backends.
A rate limiting library for FastAPI that actually works in production. Pick your algorithm, pick your backend, and you're good to go.
## Features
## Why this library?
- **Multiple Algorithms**: Token Bucket, Sliding Window, Fixed Window, Leaky Bucket, Sliding Window Counter
- **Multiple Backends**: In-memory (default), SQLite (persistent), Redis (distributed)
- **Decorator-based**: Simple `@rate_limit` decorator for endpoints
- **Middleware Support**: Global rate limiting via middleware
- **Dependency Injection**: Use as FastAPI dependency for more control
- **Strict Typing**: Full type hints, pyright/mypy compatible
- **Customizable**: Custom key extractors, exemptions, callbacks
- **Production Ready**: Connection pooling, async support, proper error handling
Most rate limiting solutions are either too simple (fixed window only) or too complex (requires a PhD to configure). This one tries to hit the sweet spot:
- **Five algorithms** to choose from, depending on your use case
- **Three storage backends**: memory for development, SQLite for single-node, Redis for distributed
- **Works how you'd expect**: decorator for endpoints, middleware for global limits
- **Fully async** and type-checked with pyright
- **Sensible defaults** but configurable when you need it
## Installation
### Using pip
```bash
# Basic installation (memory backend only)
pip install fastapi-traffic
@@ -26,6 +27,19 @@ pip install fastapi-traffic[redis]
pip install fastapi-traffic[all]
```
### Using uv
```bash
# Basic installation
uv add fastapi-traffic
# With Redis support
uv add fastapi-traffic[redis]
# With all extras
uv add fastapi-traffic[all]
```
## Quick Start
### Basic Usage with Decorator
@@ -219,20 +233,7 @@ When `include_headers=True`, responses include:
## Development
```bash
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Type checking
pyright
# Linting
ruff check .
ruff format .
```
See [DEVELOPMENT.md](DEVELOPMENT.md) for setting up a development environment and contributing.
## License