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.

RequirementMinimum VersionNotes
Python3.93.11+ recommended for best async performance. Tested on 3.9, 3.10, 3.11, and 3.12.
pip21.0Any recent pip version works.
Operating SystemAnyLinux, macOS, Windows. Argon2id requires a C compiler on first install (via argon2-cffi).
C compiler needed for Argon2id

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:

Terminal
$ pip install allsafe-fast Collecting allsafe-fast Downloading allsafe_fast-1.0.0-py3-none-any.whl (156 kB) Collecting fastapi>=0.100.0 Downloading fastapi-0.104.1-py3-none-any.whl (92 kB) Collecting pydantic>=2.0.0 Downloading pydantic-2.5.2-py3-none-any.whl (372 kB) Collecting python-jose[cryptography]>=3.3.0 Downloading python_jose-3.3.0-py3-none-any.whl (34 kB) Collecting argon2-cffi>=21.0.0 Downloading argon2_cffi-23.1.0-py3-none-any.whl (16 kB) Collecting httpx>=0.24.0 Downloading httpx-0.25.2-py3-none-any.whl (74 kB) Collecting sqlalchemy[asyncio]>=2.0.0 Downloading sqlalchemy-2.0.23-cp311-cp311-manylinux_2_17_x86_64.whl (3.0 MB) Collecting typer>=0.9.0 Downloading typer-0.9.0-py3-none-any.whl (45 kB) Collecting rich>=13.0.0 Downloading rich-13.7.0-py3-none-any.whl (240 kB) Installing collected packages: fastapi, pydantic, python-jose, argon2-cffi, httpx, sqlalchemy, typer, rich, allsafe-fast Successfully installed allsafe-fast-1.0.0
💡
Use a virtual environment

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.

PackageMinimum VersionWhy It's Needed
FastAPI0.100.0The web framework AllSafe Fast integrates with. Provides the dependency injection system, routing, and request/response models.
Pydantic2.0.0Data validation and settings management. AllSafe Fast uses Pydantic v2 models for request/response schemas and for AuthConfig.
python-jose3.3.0JWT signing and verification (HS256). The JWTService uses jwt.encode() and jwt.decode() from this library.
argon2-cffi21.0.0Argon2id password hashing. The Password provider uses this for secure password hashing and verification.
httpx0.24.0Async HTTP client for OAuth 2.0 and OIDC providers. Used for token exchange, userinfo fetches, and JWKS discovery.
SQLAlchemy (async)2.0.0Async database ORM for the production storage backend. Uses create_async_engine and async_sessionmaker.
Typer0.9.0CLI framework. Powers the allsafe command-line tool.
Rich13.0.0Terminal 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.

PackageInstall CommandWhat It Enables
asyncpgpip install asyncpgPostgreSQL async driver for the SQLAlchemy storage backend. Required for production deployments using PostgreSQL. Without it, you can only use the in-memory backend.
redispip install redisRedis 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.
Install everything at once

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:

Terminal
$ allsafe doctor AllSafe Fast Doctor v1.0.0 ────────────────────────────────── Python environment ✓ Python 3.11.6 ✓ Platform: Linux-6.5.0-x86_64 Core dependencies ✓ FastAPI 0.104.1 ✓ Pydantic 2.5.2 ✓ python-jose 3.3.0 ✓ argon2-cffi 23.1.0 ✓ httpx 0.25.2 ✓ SQLAlchemy 2.0.23 (async support) ✓ Typer 0.9.0 ✓ Rich 13.7.0 Optional dependencies ✓ asyncpg 0.29.0 — PostgreSQL driver available ✗ redis — not installed (in-memory rate limiter only) Configuration ⚠ ALLSAFE_SECRET_KEY: not set (using default — generate one with `allsafe secret`) ⚠ ALLSAFE_ENV: not set (defaults to "development") ────────────────────────────────── 2 warnings, 0 errors. Ready for development. Run `allsafe init` to generate a .env file and secret key.

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.
💡
Generate a secret key

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