Skip to main content

Heaven ⚡ :

Heaven is the absolute minimal, insanely fast ASGI web framework for Python purists. It doesn't just get out of your way; it vanishes, leaving you with raw performance and total control.

"Mastery in 30 minutes or less. No grey spots, just pure Python."


Why Heaven?

Feature Heaven FastAPI Flask Django
Learning Curve 30 Mins High Low Extreme
Throughput (measured) 12,517 req/s 6,223 req/s 1,190 req/s 1,784 req/s
Boilerplate Zero Medium Low Massive
Mastery Complete Partial High Low
Background Jobs Native (Daemons) External External External
  1. Stupid Simple: Built for engineers who hate bloat. If you know Python, you already know Heaven.
  2. Blazing Fast: A thin layer over ASGI, optimized for high-concurrency and low-latency.
  3. Batteries Included (The right ones): Native support for application mounting, centralized hooks (.BEFORE/.AFTER), and powerful background Daemons.
  4. Transparent: No magic decorators that hide logic. Just clear, explicit routing.

Performance

Hello-world JSON throughput, one worker process each, default out-of-the-box configuration, generated by the script checked in at benchmarks/compare.py:

Framework Served by Requests/sec Relative
Heaven 2.0.0 uvicorn 12,517 1.00x
FastAPI 0.141.1 uvicorn 6,223 0.50x
Django 6.0.7 (ASGI) uvicorn 1,784 0.14x
Flask 3.1.3 gunicorn 1,190 0.10x

Roughly 2x FastAPI, 7x Django and 10x Flask, measured on the same box: an Intel i5-8350U laptop, Python 3.12, 48 keep-alive connections, median of three 5 second rounds. ASGI apps run under uvicorn[standard], Flask runs under gunicorn's default sync worker. Absolute numbers are hardware-dependent, so reproduce them on yours before quoting:

pip install heaven fastapi flask django 'uvicorn[standard]' gunicorn
python benchmarks/compare.py

Quickstart in 60 Seconds

  1. Install
$ pip install heaven
  1. Code
from heaven import App, Request, Response, Context

app = App()

# Centralized Auth / Pre-processing
async def auth(req, res, ctx):
    if not req.headers.get('Authorization'):
        res.status = 401
        res.abort('Unauthorized')

app.BEFORE('/api/*', auth)

# Simple Handler
async def welcome(req, res, ctx):
    res.body = {"message": "Welcome to Heaven"}

app.GET('/api/v1/welcome', welcome)

Prefer grouping routes by subject? Register a method with Class#method:

# controllers/orders.py
from heaven import Handler

class Orders(Handler):
    async def index(self):
        self.res.body = await self.req.app.peek('db').orders()

app.GET('/orders', 'controllers.orders.Orders#index')

self.req, self.res and self.ctx are the same three objects, and Heaven builds one instance per request so self is never shared.

  1. Protect (Automatic OpenAPI)
from typing import Annotated, TypedDict

class User(TypedDict):
    name: Annotated[str, 'min_len=2']

app.schema.POST('/user', expects=User, summary="Create User")
app.DOCS('/docs')
  1. Fly (CLI) Heaven comes with a beautiful, zero-config CLI.
pip install heaven

# Auto-discovery & run with reload
heaven fly

# Visualize your API structure
heaven routes
  1. Daemon (Background)
async def pulse(app):
    print("Heartbeat...")
    return 5 # Run every 5 seconds

app.daemons = pulse
  1. Run (Standard)
$ uvicorn app:app --reload

Contributing

We love builders. See the Contribution Guidelines.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

heaven-2.2.0.tar.gz (66.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

heaven-2.2.0-py3-none-any.whl (72.6 kB view details)

Uploaded Python 3

File details

Details for the file heaven-2.2.0.tar.gz.

File metadata

  • Download URL: heaven-2.2.0.tar.gz
  • Upload date:
  • Size: 66.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.3 Linux/7.0.0-28-generic

File hashes

Hashes for heaven-2.2.0.tar.gz
Algorithm Hash digest
SHA256 71e622a5eae6424773ae7bc5933c529690d5f90e418ed9aab5c81d7631fcdfcb
MD5 d9cbe302a7348a639751e839b308c35d
BLAKE2b-256 0c0c7b59acfe5b4469a11a91767e3b3ee9a98a33aba2d78dc7f5bb7b67fb54f1

See more details on using hashes here.

File details

Details for the file heaven-2.2.0-py3-none-any.whl.

File metadata

  • Download URL: heaven-2.2.0-py3-none-any.whl
  • Upload date:
  • Size: 72.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.3 Linux/7.0.0-28-generic

File hashes

Hashes for heaven-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e1fe6be946797aa3688190002d2a43569044cb689e9f498e5bd7846610088350
MD5 1eb976dda2ab9d32f13445c97e8fa7ef
BLAKE2b-256 3417a3dbce837a3e1a747425a596011c4d2ef6373ed92def723cb62c7fcd2da4

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.2.0 This release

2 files

2.1.1

2 files

2.1.0

2 files

2.0.0

2 files

1.4.1

2 files

1.4.0

2 files

1.3.15

2 files

1.3.14

2 files

1.3.12

2 files

1.3.11

2 files

1.3.10

2 files

1.3.9

2 files

1.3.8

2 files

1.3.7

2 files

1.3.6

2 files

1.3.5

2 files

1.3.4

2 files

1.3.3

2 files

1.3.2

2 files

1.3.1

2 files

1.3.0

2 files

1.2.2

2 files

1.2.1

2 files

1.2.0

2 files

1.1.0

2 files

1.0.1

2 files

1.0.0

2 files

0.6.12

2 files

0.6.11

2 files

0.6.10

2 files

0.6.9

2 files

0.6.8

2 files

0.6.7

2 files

0.6.6

2 files

0.6.5

2 files

0.6.4

2 files

0.6.3

2 files

0.6.2

2 files

0.6.1

2 files

0.6.0

2 files

0.5.1

2 files

0.5.0

2 files

0.4.4

2 files

0.4.3

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.11

2 files

0.3.10

2 files

0.3.9

2 files

0.3.8

2 files

0.3.7

2 files

0.3.6

2 files

0.3.5

2 files

0.3.4

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.6

2 files

0.2.5

2 files

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.1

2 files

0.1.0

2 files

0.0.9

2 files

0.0.8

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page