Installation
AllSafe Fast is a pure-Python package distributed on PyPI. It takes one command to install and one command to verify. This page covers everything you need to get it running.
Requirements
AllSafe Fast requires Python 3.9 or newer. The framework uses typing.Protocol (3.8+), str | None union syntax (3.10+, backported via from __future__ import annotations for 3.9), and asyncio features available since 3.9.
| Requirement | Minimum Version | Notes |
|---|---|---|
| Python | 3.9 | 3.11+ recommended for best async performance. Tested on 3.9, 3.10, 3.11, and 3.12. |
| pip | 21.0 | Any recent pip version works. |
| Operating System | Any | Linux, macOS, Windows. Argon2id requires a C compiler on first install (via argon2-cffi). |
The argon2-cffi package compiles a C extension on first install. On Linux, install gcc and python3-dev. On macOS, install Xcode Command Line Tools. On Windows, install Visual C++ Build Tools. Pre-built wheels are available for common platforms, so you may not need a compiler at all.
Install with pip
The simplest way to install AllSafe Fast is with pip:
Always install in a virtual environment to avoid conflicts with system packages. Run python -m venv .venv then source .venv/bin/activate (on macOS/Linux) or .venv\Scripts\activate (on Windows) before installing.
Dependencies
AllSafe Fast declares its dependencies explicitly. When you pip install allsafe-fast, pip installs these automatically. You don't need to install them separately.
| Package | Minimum Version | Why It's Needed |
|---|---|---|
| FastAPI | 0.100.0 | The web framework AllSafe Fast integrates with. Provides the dependency injection system, routing, and request/response models. |
| Pydantic | 2.0.0 | Data validation and settings management. AllSafe Fast uses Pydantic v2 models for request/response schemas and for AuthConfig. |
| python-jose | 3.3.0 | JWT signing and verification (HS256). The JWTService uses jwt.encode() and jwt.decode() from this library. |
| argon2-cffi | 21.0.0 | Argon2id password hashing. The Password provider uses this for secure password hashing and verification. |
| httpx | 0.24.0 | Async HTTP client for OAuth 2.0 and OIDC providers. Used for token exchange, userinfo fetches, and JWKS discovery. |
| SQLAlchemy (async) | 2.0.0 | Async database ORM for the production storage backend. Uses create_async_engine and async_sessionmaker. |
| Typer | 0.9.0 | CLI framework. Powers the allsafe command-line tool. |
| Rich | 13.0.0 | Terminal formatting for the CLI. Pretty-prints allsafe doctor output and migration logs. |
Optional Dependencies
These packages are not required for the framework to run, but enable specific features. Install them only if you need the corresponding feature.
| Package | Install Command | What It Enables |
|---|---|---|
| asyncpg | pip install asyncpg | PostgreSQL async driver for the SQLAlchemy storage backend. Required for production deployments using PostgreSQL. Without it, you can only use the in-memory backend. |
| redis | pip install redis | Redis client for distributed rate limiting. The in-memory rate limiter works for single-process apps, but you need Redis for multi-process or multi-server deployments. |
If you know you'll use PostgreSQL and Redis, install all optional dependencies in one command: pip install allsafe-fast asyncpg redis. There's no extra/dependency group syntax — just list the packages you need.
Verify Your Installation
After installing, verify that AllSafe Fast is working by running the doctor command. This checks your Python version, installed dependencies, and configuration environment:
The doctor command reports three categories:
- Python environment — your Python version and platform. If the version is below 3.9, you'll see an error.
- Core dependencies — every required package and its version. A missing or incompatible package shows as an error.
- Optional dependencies — asyncpg and redis. These show as warnings (not errors) if missing, since the framework works without them.
If doctor warns that ALLSAFE_SECRET_KEY is not set, generate one with allsafe secret. This prints a cryptographically secure key to stdout. Copy it into your .env file or export it as an environment variable. Never use the default secret key in production — the production guard will refuse to start.
Next Steps
Once installation is verified, you're ready to configure AllSafe Fast and protect your first route. The Quick Start guide walks through the full setup in five steps.
- Quick Start — install, configure, authenticate, protect, deploy in five steps
- Configuration — every environment variable and configuration option
- First Application — build a complete example app from scratch