Skip to content
CAI
Software that uses CAICheck a score

emmett-framework/granian

63.6

Adequate · 30 September 2026

12.1k

lines of production code

Rust

with Python

2

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

Granian is a high-performance, Rust-based HTTP server designed to host Python web applications. It supports multiple Python web interfaces, including ASGI, WSGI, and the native RSGI protocol, enabling flexible integration with various frameworks. The system provides robust features such as HTTP/1 and HTTP/2 support, WebSocket handling, static file serving, and SSL/TLS security. Additionally, it offers an embedded API for in-process hosting and includes comprehensive benchmarking and testing tools to validate performance across different Python versions and concurrency models.

How it got here

2022 — Initial release and protocol implementation

12 changes.

This period marks the initial release of Granian, a Rust-based HTTP server for Python, establishing core support for ASGI, RSGI, and WSGI interfaces. The work focused on building the foundational architecture using Hyper and Tokio, implementing key features like HTTPS, WebSockets, and static file serving, and creating a comprehensive test suite and benchmarking infrastructure to validate performance.

2024–2025 — Embedded hosting and benchmarking enhancements

4 changes.

This period focused on expanding Granian's integration capabilities by introducing an embedded server API for in-process hosting within existing Python applications. Concurrently, the project significantly enhanced its performance evaluation infrastructure by adding comprehensive benchmark report templates and a new WebSocket benchmark suite. These changes were supported by improved proxy header handling utilities to ensure accurate request metadata in reverse proxy environments.

Features

Add Granian benchmark suite and results

The benchmarks directory now includes a comprehensive suite for evaluating Granian's performance, featuring a Python harness (benchmarks.py) and shell scripts to run tests against multiple Python versions (3.10–3.14) and third-party servers like Uvicorn, Gunicorn, and Hypercorn. The suite covers HTTP/1 and HTTP/2, ASGI, RSGI, and WSGI interfaces, as well as WebSockets, concurrency, and file responses. Initial benchmark results are provided in Markdown files (README.md, vs.md, concurrency.md, pyver.md, asyncio.md) showing Granian's throughput and latency metrics on an AMD Ryzen 7 5700X.

benchmarks · high confidence

Add WSGI protocol support

The server now supports the WSGI interface, allowing Python applications that implement the WSGI specification to be served. This change introduces a new \WSGIWorker\ class and the underlying Rust implementation in \src/wsgi\ to handle request processing, including building the WSGI environment dictionary, managing request bodies via an iterator interface, and handling response streaming and iteration.

src/wsgi · high confidence

Add WebSocket benchmark suite

A new WebSocket benchmark suite has been added to the \benchmarks/ws\ directory, providing tools to measure performance for both ASGI and RSGI implementations. The suite includes application entry points (\asgi.py\, \rsgi.py\) that handle WebSocket connections and broadcasting, alongside a \benchmark.py\ script that orchestrates concurrent clients to measure send/receive timings and throughput using \time.perf\_counter\.

benchmarks/ws · high confidence

Add benchmark applications for ASGI, RSGI, and WSGI protocols

The benchmarks suite now includes dedicated application files for ASGI, RSGI, and WSGI protocols, enabling performance testing across these different interfaces. These applications provide a consistent set of routes for testing various scenarios, including static responses of different sizes (10 bytes to 100KB), echo endpoints, file serving, and simulated I/O delays.

benchmarks/app · high confidence

Added proxy header handling utilities for ASGI and WSGI apps

New utilities in \granian/utils/proxies.py\ allow the server to correctly interpret \X-Forwarded-For\ and \X-Forwarded-Proto\ headers when requests come from trusted hosts. This enables accurate client IP detection and scheme resolution (HTTP/HTTPS) behind reverse proxies, with support for configuring trusted hosts via IP addresses, CIDR networks, or wildcards.

granian/utils · high confidence

Granian 2.0 initial release with ASGI, RSGI, and WSGI support

Granian is released as version 2.0, introducing a Python web server that supports ASGI, RSGI, and WSGI application interfaces. The package exposes a \Server\ class for programmatic use and a CLI built with Click for command-line invocation. Key features include configurable event loops (asyncio, uvloop, winloop, rloop), access logging, static file serving, and SSL/TLS support.

granian · high confidence

Initial ASGI protocol support

The ASGI protocol is now available, allowing Python ASGI applications to be served. This implementation includes HTTP and WebSocket handling, with support for ASGI spec version 3.0 (spec 2.3), pathsend extensions, and WebSocket subprotocol negotiation. The ASGI worker exposes configuration options for HTTP/1 and HTTP/2 modes, SSL/TLS settings, static file serving, and backpressure management.

src/asgi · high confidence

Initial release of Granian, a Rust-based HTTP server for Python

Granian is now available as a Rust HTTP server for Python applications, supporting ASGI, WSGI, and the new RSGI interfaces. It features HTTP/1 and HTTP/2 protocols, HTTPS/mTLS, WebSockets, and static file serving. The server is built on Hyper and Tokio, offering high performance and concurrency. This release includes a comprehensive CLI with options for workers, runtime mode, event loop selection, and various tuning parameters. Documentation, contributing guidelines, and development tooling (Makefile, pre-commit hooks, linters) are also included.

(repo-wide) · high confidence

Introduce RSGI protocol implementation

Adds the RSGI (Rust Server Gateway Interface) protocol support, providing a new set of Python-exposed classes including RSGIHTTPProtocol, RSGIWebsocketProtocol, RSGIHeaders, and scope types (RSGIHTTPScope, RSGIWebsocketScope). This enables Python applications to handle HTTP and WebSocket requests via the RSGI interface, with dedicated workers and serving modes (multi-threaded, single-threaded, async) exposed through the RSGIWorker class.

src/rsgi · high confidence

Introduce embedded server API for in-process hosting

The \granian.server\ package now exposes an \embed\ module containing an \AsyncWorker\ and a \Server\ class, allowing Granian to be run as an embedded component within an existing Python application rather than only as a standalone process. This new API supports the same configuration options as the main server (such as SSL, static files, and interface selection) but manages the event loop and worker lifecycle internally via asyncio, enabling integration into frameworks or long-running services that require Granian's HTTP handling without external process management.

granian/server · high confidence

Introduce granian 2.0 with free-threaded Python support and new internal architecture

This release introduces granian 2.0, featuring support for free-threaded Python (PEP 703) via the \Py\_GIL\_DISABLED\ build flag, allowing the server to operate without holding the GIL. The internal architecture has been significantly refactored: the codebase is reorganized into distinct modules (asyncio, blocking, callbacks, conversion, files, http, ipc, metrics, net, runtime, serve, sys, tls, workers, ws, wsgi) to improve maintainability. A new metrics system has been added, exposing worker and server statistics via a dedicated exporter. The server now supports static file serving with configurable cache headers and directory listings. Additionally, the runtime includes a configurable blocking thread pool with idle timeout and growth strategies, and IPC mechanisms have been introduced for metrics collection in multi-threaded modes. The version has been bumped to 2.0.

src · high confidence

New benchmark report templates for Granian performance comparisons

The benchmark suite now includes a comprehensive set of Jinja2 templates that generate structured Markdown reports for Granian performance data. These templates cover multiple comparison dimensions: main protocol benchmarks (RSGI, ASGI, WSGI, HTTP/2, file responses), concurrency analysis (workers and runtime threads), AsyncIO-specific metrics (event loops and task implementations), Python version comparisons (3.10–3.14), and third-party server comparisons (ASGI, WSGI, HTTP/2, file responses, long I/O, and WebSockets). The templates standardize how benchmark results are presented, including helper functions for formatting latency and identifying maximum concurrency runs.

benchmarks/templates · high confidence

Test coverage

Add test application fixtures for ASGI, RSGI, and WSGI protocols; Initial test suite for Granian server protocols and features; Updated test fixtures for TLS and static content.

Dependencies

Initial release of Granian 2.8.4

This change introduces the initial dependency manifests for Granian version 2.8.4, establishing the project's build and runtime requirements. The Rust core relies on PyO3 0.29 for Python bindings, Hyper 1.11 for HTTP handling, and Tokio 1.51 for async runtime support, with optional memory allocators for jemalloc and mimalloc. The Python package requires Python 3.10+ and uses Click 8.1.0+ for its CLI, while optional extras provide support for environment variables (python-dotenv), process naming (setproctitle), file watching (watchfiles), and various event loop implementations including uvloop, rloop, and winloop.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 62 → 64 (+1.1)
  • Rubric changed (rubric-2026.09.10 → rubric-2026.09.18) — scores are not directly comparable.

Lenses

  • Code Health 92 → 92 (-0.7)
  • Architecture 100 → 99 (-1.5)
  • Maturity 46 → 46 (+0.0)
  • Readiness 66 → 68 (+2.6)
  • Security 76 → 84 (+8.0)
  • Performance 89 (new)

Resolved (3)

  • Documentation: no contributor guidance (README.md)
  • Documentation: no installation or build instructions (README.md)
  • Documentation: no usage examples (README.md)

New (16)

  • Documentation: no architecture or design documentation (README.md)
  • Duplicated block (14 lines × 3) (granian/server/embed.py)
  • Duplicated block (15 lines × 2) (granian/cli.py)
  • Duplicated block (15 lines × 2) (granian/server/mp.py)
  • Duplicated block (15 lines × 8) (granian/server/mp.py)
  • Duplicated block (16 lines × 4) (granian/server/mp.py)
  • Duplicated block (17 lines × 2) (granian/rsgi.py)
  • Duplicated block (17 lines × 3) (granian/server/mp.py)
  • Duplicated block (17 lines × 3) (granian/server/mt.py)
  • Duplicated block (20 lines × 3) (granian/server/embed.py)
  • Duplicated block (21–22 lines × 2) (granian/server/mp.py)
  • Duplicated block (27 lines × 2) (granian/server/embed.py)
  • Duplicated block (5 lines × 2) (src/asgi/callbacks.rs)
  • Duplicated block (7 lines × 2) (granian/server/common.py)
  • Low cohesion: Worker (LCOM4 5) (src/workers.rs)
  • Members sharing a duplicated core (8 members, 50+ identical tokens) (granian/server/mp.py)

Changes since last survey

  • 5 commits — 4 feature/other, 1 fixes

By area

  • (root) — 2 commits
  • granian/asgi.py — 1 commit
  • granian/server — 1 commit
  • src/asgi — 1 commit

Notable commits

  • fix: Fix query-string encoding in ASGI access log (close #920)
  • change: Bump dependencies
  • change: Bump version to 2.8.4
  • change: Fix IPv6 formatting in server log (#919)
  • change: Refactor disconnection guards (#926)

Architecture

  • Unchanged — 0 containers · 1 contexts · 0 edges

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

emmett-framework/granian was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 30 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 22b54dee6dbefda895855ea06c51f042bfa09f4d — the exact code this score is about.
  • Scored under rubric-2026.09.18 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-836b52ac9a11.