Granian

A fast Rust HTTP server for Python that serves ASGI, WSGI, and RSGI applications

Tool
PyPI
v2.8.3
5,675 stars
BSD 3-Clause License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
86 /100 Excellent
Development Activity 92
Maintenance 100
Community 56
Maturity 56
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
87 /100 Excellent
Architecture 90
Code Quality 88
Innovation 86
Learning Curve 82

Granian is a Rust-based HTTP server for Python applications, built on top of Hyper and Tokio. It provides a single, self-contained dependency to serve ASGI, WSGI, and its own RSGI interface applications, replacing the usual Gunicorn + Uvicorn + http-tools stack.

Designed around a correct, unified HTTP implementation, Granian supports HTTP/1 and HTTP/2, HTTPS and mTLS, websockets, and direct static-file serving, with strong concurrency characteristics and high throughput across Linux, macOS, and Windows.

What You Get

  • A single-dependency HTTP server binary distributed as a Python wheel for Linux, macOS, and Windows
  • Support for ASGI/3, WSGI, and the native RSGI application interfaces
  • HTTP/1 and HTTP/2 protocols with HTTPS and mTLS support
  • Websockets and direct static-file serving out of the box
  • A configurable CLI plus an embeddable Server API for programmatic control

Common Use Cases

  • Serving FastAPI, Starlette, Django, or Flask applications in production
  • Replacing a Gunicorn + Uvicorn worker setup with one dependency
  • Serving Python apps over HTTP/2 with high throughput and websockets
  • Running applications with mTLS or direct static-file delivery

Under The Hood

Architecture - Granian splits responsibilities across a Rust core (src/lib.rs, serve.rs, workers.rs, http.rs, ws.rs, tls.rs) that owns the HTTP/1 and HTTP/2 handling on top of Hyper and Tokio, and a thin Python layer (granian/server, granian/asgi.py, wsgi.py, rsgi.py, cli.py) that bridges incoming requests into the ASGI, WSGI, or RSGI callable and manages the worker process model.

Tech Stack - The server core is written in Rust using Hyper and Tokio and compiled into a Python extension via PyO3/maturin; the Python side depends only on click for its CLI, with optional extras for dotenv, process naming, reload, and alternative event loops (rloop, uvloop, winloop).

Code Quality - The repository ships a substantial pytest suite (test_asgi.py, test_wsgi.py, test_rsgi.py, test_ws.py, test_https.py, test_static_files.py, test_uds.py, and more) covering each interface and transport, alongside typed Python (py.typed, _granian.pyi stubs) and a modular Rust source tree, indicating a mature, well-tested codebase.

API Design - Usage centers on a single ergonomic CLI (granian —interface asgi main:app) with an embeddable Server class for programmatic control; configuration is exposed through well-named flags and options, and the documented ASGI/WSGI/RSGI contracts keep onboarding for existing Python web apps minimal.

Used by 5 apps in this directory

Python
82%
MIT

LiteLLM

AI Development · Developer Tools

59,745

Open source AI gateway and Python SDK that gives you one OpenAI-compatible interface to call 100+ LLM providers, with built-in routing, cost tracking, guardrails, and virtual keys.

View details
92
Repo Health
81
Technical
69
Dependency
Built with
Python 82%
TypeScript 12%
Updated 5 days ago
Python
63%
GPL 3.0

Paperless-ngx

Bookmarks Archiving

46,108

Turn your paper pile into a searchable digital archive with OCR, AI classification, and automated workflows — all running on your own server.

View details
91
Repo Health
88
Technical
67
Dependency
Built with
Python 63%
TypeScript 28%
Updated 5 days ago
Python
55%
Other

PostHog

Ab Testing Experimentation · Analytics · Developer Tools

39,975

The all-in-one open source product platform combining analytics, session replay, feature flags, error tracking, AI observability, and a built-in data warehouse in a single self-hostable stack.

View details
92
Repo Health
80
Technical
65
Dependency
Built with
Python 55%
TypeScript 36%
Updated 5 days ago
Python
57%
Other

Sentry

Analytics · Developer Tools · Monitoring

44,862

Developer-first error tracking and performance monitoring platform with AI-powered root-cause analysis across 20+ languages and frameworks.

View details
95
Repo Health
80
Technical
69
Dependency
Built with
Python 57%
TypeScript 41%
Updated 5 days ago
Python
91%
GPL 3.0

Weblate

Developer Tools

6,094

Continuous localization platform that commits translations directly into your version control system with full translator attribution.

View details
95
Repo Health
86
Technical
67
Dependency
Built with
Python 91%
Updated 5 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers