Skip to main content

Dreaming Electric Sheep

Dreaming Electric Sheep (des)

High-performance CPython 3.13+ web stack built directly on Granian RSGI with startup-compiled msgspec validation, native HTMX support, and interactive route inspection.

Build PyPI Python Versions License


Installation

pip install "dreaming-electric-sheep[standard]"

[standard] includes granian (RSGI), typer, rich, msgspec, Jinja2, and uvloop (Linux/macOS).


Quickstart

1. Scaffold a project

Create a new REST API project (or use -t fullstack for HTMX + Jinja2 as default):

des new my_api -t api
cd my_api

Templates available:

  • -t api: REST API with msgspec.Struct validation and Scalar docs.
  • -t fullstack: Jinja2 templates, HTMX fragments, Tailwind CDN, and SSE streaming.
  • -t minimal: Single-file lightweight microservice.

2. Start the development server

des dev

The server starts on http://127.0.0.1:8000 with auto-reload enabled. Interactive API documentation is available at http://127.0.0.1:8000/docs.

3. Inspect the compiled route pipeline

Verify how routes, parameter decoders, and handlers are resolved at startup:

des why POST /items

Output:

Route:      POST /items
Handler:    app:create_item
Binders:
  • data: FromJSON[CreateItemInput] (pre-compiled msgspec decoder)
OpenAPI:    Documented in /openapi.json (schema: CreateItemInput)

Example

Here is a standard app.py combining schema validation, HTMX fragment responses, and real-time SSE streaming:

from des import Application, get, post, fragment, sse_stream
from msgspec import Struct

app = Application()

class Item(Struct):
    id: int
    name: str
    price: float

# Pre-compiled msgspec validation with structured 422 errors
@post("/api/items")
def create_item(data: Item):
    return {"status": "created", "item": data}

# First-class HTMX fragment response
@get("/items/{item_id}/row")
def item_row(item_id: int):
    return fragment(f"<tr id='item-{item_id}'><td>Item #{item_id}</td></tr>")

# Native Server-Sent Events (SSE) streaming
@get("/events")
def stream_events():
    async def feed():
        for count in range(10):
            yield {"event": "tick", "count": count}
    return sse_stream(feed)

Features

  • Granian RSGI Transport: Native C/Rust socket communication bypassing ASGI message loop overhead.
  • Pre-Compiled Validation: msgspec.Struct decoders compiled at route registration time; produces standard FastAPI-compatible HTTP 422 errors.
  • Built-in HTMX Suite: Native helpers (fragment, hx_trigger, hx_redirect, hx_refresh) and sse_stream / ndjson_stream.
  • OpenAPI 3.0 Documentation: Automatic schema generation with Scalar UI, Swagger UI, and ReDoc support at /docs.
  • Developer Introspection: CLI tools (des why, des routes, des doctor, des check) to inspect the routing table and runtime health.

CLI Reference

Command Description
des new <name> -t <template> Scaffold a project (api, fullstack, or minimal)
des dev Start development server with auto-reload (Granian RSGI)
des run [app] --workers <n> Start production server with Granian RSGI
des routes Display the compiled radix routing table
des why <METHOD> <PATH> Explain route matching, parameter binders, and handler dispatch
des check Validate routes, binders, and configuration
des doctor Inspect C-extension status and interned memory tables

Benchmarks

Overhead measured against an in-memory fixture on localhost using oha (50 concurrent keep-alive connections, median of 5 runs of 5s each, CPython 3.14 on Linux x86_64, 1 worker process).

Framework Tax vs. Raw Server Ceilings (msgspec Encoder)

Measures framework overhead against raw server ceilings when all targets encode JSON per request using msgspec.json.encode with optimize_gc=False. The ~10–15% gap we aim to close represents the unavoidable cost of route matching, request abstraction, and parameter binding over raw protocol sockets:

Framework / Layer Server / Runtime Plaintext (req/s) JSON (req/s) Mem get (req/s) Mem get ×20 (req/s) HTML fortunes (req/s) Mem update ×20 (req/s)
Granian (Raw RSGI) Rust RSGI (ceiling) 130,148 132,491 129,247 61,794 36,078 49,109
Dreaming Electric Sheep (RSGI) Granian (RSGI) 128,942 123,586 121,578 59,001 32,783 47,597
Granian (Raw ASGI) Rust ASGI (ceiling) 95,699 93,922 92,682 50,459 32,138 42,186
Dreaming Electric Sheep (ASGI) Granian (ASGI) 88,623 88,530 80,685 46,522 29,073 38,880
Uvicorn (Raw ASGI) Uvicorn ASGI (ceiling) 55,481 53,698 51,735 35,765 26,127 31,759

Default Stack Comparison (Stock Helpers Out-of-the-Box)

Measures out-of-the-box performance using each framework's standard serialization and response helpers:

Framework Server / Runtime Plaintext (req/s) JSON (req/s) Mem get (req/s) Mem get ×20 (req/s) HTML fortunes (req/s) Mem update ×20 (req/s)
Dreaming Electric Sheep (RSGI) Granian (RSGI) 121,069 122,107 118,083 56,176 32,432 45,328
Dreaming Electric Sheep (ASGI) Granian (ASGI) 86,350 86,744 79,035 40,206 25,639 39,075
Emmett Granian (RSGI/ASGI) 57,930 52,004 50,008 24,396 22,378 21,441
Sanic Sanic Core 46,014 42,729 40,802 24,766 21,946 22,896
Litestar Granian (ASGI) 33,523 32,140 30,722 20,600 16,695 18,930
Robyn Robyn Rust 30,885 28,311 27,791 18,921 17,786 17,727
FastAPI Granian (ASGI) 24,231 20,367 19,050 7,389 13,518 6,858
Django Granian (WSGI) 24,018 20,238 18,763 7,281 13,456 7,011
Flask Granian (WSGI) 23,794 20,186 18,644 7,271 13,274 6,986

See perf/compare/ and Why DES? for harness scripts and reproduction details.


Documentation


License & Attribution

Dreaming Electric Sheep is licensed under the MIT License.
Derived from BlackSheep (Copyright (c) Roberto Prevato and contributors). See NOTICE for details.

made with love by EduLoboM

Metadata

Release files for dreaming-electric-sheep 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dreaming-electric-sheep 1.2.0
File Size Uploaded
dreaming_electric_sheep-1.2.0.tar.gz 2.0 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for dreaming-electric-sheep 1.2.0
File
dreaming_electric_sheep-1.2.0-cp314-cp314-win_arm64.whl CPython 3.14 CPython 3.14 Windows ARM64 Details
dreaming_electric_sheep-1.2.0-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
dreaming_electric_sheep-1.2.0-cp314-cp314-musllinux_1_2_x86_64.whl CPython 3.14 CPython 3.14 Linux musl 1.2+ x86-64 Details
dreaming_electric_sheep-1.2.0-cp314-cp314-musllinux_1_2_aarch64.whl CPython 3.14 CPython 3.14 Linux musl 1.2+ ARM64 Details
dreaming_electric_sheep-1.2.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details
dreaming_electric_sheep-1.2.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl CPython 3.14 CPython 3.14 Linux glibc 2.28+ ARM64, Linux glibc 2.17+ ARM64 Details
dreaming_electric_sheep-1.2.0-cp314-cp314-macosx_10_15_universal2.whl CPython 3.14 CPython 3.14 macOS 10.15+ universal2 (ARM64, x86-64) Details
dreaming_electric_sheep-1.2.0-cp313-cp313-win_arm64.whl CPython 3.13 CPython 3.13 Windows ARM64 Details
dreaming_electric_sheep-1.2.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
dreaming_electric_sheep-1.2.0-cp313-cp313-musllinux_1_2_x86_64.whl CPython 3.13 CPython 3.13 Linux musl 1.2+ x86-64 Details
dreaming_electric_sheep-1.2.0-cp313-cp313-musllinux_1_2_aarch64.whl CPython 3.13 CPython 3.13 Linux musl 1.2+ ARM64 Details
dreaming_electric_sheep-1.2.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64, Linux glibc 2.17+ x86-64 Details
dreaming_electric_sheep-1.2.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ ARM64, Linux glibc 2.28+ ARM64 Details
dreaming_electric_sheep-1.2.0-cp313-cp313-macosx_10_13_universal2.whl CPython 3.13 CPython 3.13 macOS 10.13+ universal2 (ARM64, x86-64) Details

Total release size: 82.4 MB

Release files / dreaming_electric_sheep-1.2.0.tar.gz

Download URL dreaming_electric_sheep-1.2.0.tar.gz
Size 2.0 MB
Tags Source
SHA-256 checksum
How to use checksums
7cdcbb968dc39d22fca7f6d8103b130d23c9c35e10ae280322a62124fce3dd81
BLAKE2b-256 checksum
How to use checksums
3283cc07c65bad66ea0320a4789287df8daeb9f6d232fbc82f6a99be465617d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / dreaming_electric_sheep-1.2.0-cp314-cp314-win_arm64.whl

Download URL dreaming_electric_sheep-1.2.0-cp314-cp314-win_arm64.whl
Size 2.6 MB
Tags CPython 3.14 Windows ARM64
SHA-256 checksum
How to use checksums
e48d7ce7a449efe1e46ea1807225d458f9b7987924e8ec7d852d3bbcc49b1c95
BLAKE2b-256 checksum
How to use checksums
0acba4947874fb68216f8b5da77b0682b7b32f87481c94c686e6b6c0acaf0856
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / dreaming_electric_sheep-1.2.0-cp314-cp314-win_amd64.whl

Download URL dreaming_electric_sheep-1.2.0-cp314-cp314-win_amd64.whl
Size 2.7 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
4b00989eb7dd789c8cc339c8ee63c87339da0bac37525f2e2fe666a2a489977d
BLAKE2b-256 checksum
How to use checksums
9b04d2c974fb8d55dcded0cd23100743e0d1e57a966e5167a08dbb4d0a2f5a87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / dreaming_electric_sheep-1.2.0-cp314-cp314-musllinux_1_2_x86_64.whl

Download URL dreaming_electric_sheep-1.2.0-cp314-cp314-musllinux_1_2_x86_64.whl
Size 7.7 MB
Tags CPython 3.14 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
9b2375a163d93d3c9b140c80cdc9bbe3456e3861290e681bc02d68cb1c7128e7
BLAKE2b-256 checksum
How to use checksums
6c46be0075277e9ccd3e33aff20740db3fce5d88f52cfcccd87cf1e76db891e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / dreaming_electric_sheep-1.2.0-cp314-cp314-musllinux_1_2_aarch64.whl

Download URL dreaming_electric_sheep-1.2.0-cp314-cp314-musllinux_1_2_aarch64.whl
Size 7.7 MB
Tags CPython 3.14 Linux musl 1.2+ ARM64
SHA-256 checksum
How to use checksums
ccd1982d7539188efa776585b197a773923ae74083f00dd456c08140c0315ece
BLAKE2b-256 checksum
How to use checksums
b2b8606f99cd9874327a006944248caee4e9d9452dfdcc6a4e30460c80e6b082
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / dreaming_electric_sheep-1.2.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL dreaming_electric_sheep-1.2.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 7.9 MB
Tags CPython 3.14 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
63802fd2f2ecc65b0990881f784bbcd2025f8bba9f2489209c6f47014af431e7
BLAKE2b-256 checksum
How to use checksums
f33f2b11447d4d5bf2b26af4034d514d62fc12837f3939e002bb964c442b27a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / dreaming_electric_sheep-1.2.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl

Download URL dreaming_electric_sheep-1.2.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Size 7.9 MB
Tags CPython 3.14 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
23b7e959e7cc5ba02fe1961a1776c90070eb6c822b370ab91c715ec802d97ab1
BLAKE2b-256 checksum
How to use checksums
736077beade94cc75697bc087da0d28d6e387b22e7427b6d7eaa8a5833d7c769
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / dreaming_electric_sheep-1.2.0-cp314-cp314-macosx_10_15_universal2.whl

Download URL dreaming_electric_sheep-1.2.0-cp314-cp314-macosx_10_15_universal2.whl
Size 3.6 MB
Tags CPython 3.14 macOS 10.15+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
b997535dba627e31da8f856970dd62cfc4a737a3543231f1ee4b9e98d7c0dae7
BLAKE2b-256 checksum
How to use checksums
5c49d7350f3883e48f7368592aca0cb93fcf21927cafc8d5d35b3fb989bc7b45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / dreaming_electric_sheep-1.2.0-cp313-cp313-win_arm64.whl

Download URL dreaming_electric_sheep-1.2.0-cp313-cp313-win_arm64.whl
Size 2.6 MB
Tags CPython 3.13 Windows ARM64
SHA-256 checksum
How to use checksums
a92bb28a5459a68730ad6ccb305e4162b1e0e7c9cf15cf568e732b10003c5da5
BLAKE2b-256 checksum
How to use checksums
2d28c2f63284b595fee8d1df9ff4d3adafd23338f9e614b11237852bd8e77f3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / dreaming_electric_sheep-1.2.0-cp313-cp313-win_amd64.whl

Download URL dreaming_electric_sheep-1.2.0-cp313-cp313-win_amd64.whl
Size 2.7 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
5e3459ca06b5cfaa43c8e4e65cfd29910f942798bb360ac7625eed22e3911720
BLAKE2b-256 checksum
How to use checksums
3bef7e88a93b032a7f36bd6e42f69eb5fbef77f5293545058635d36d1b3fcae0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / dreaming_electric_sheep-1.2.0-cp313-cp313-musllinux_1_2_x86_64.whl

Download URL dreaming_electric_sheep-1.2.0-cp313-cp313-musllinux_1_2_x86_64.whl
Size 7.8 MB
Tags CPython 3.13 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
78ef79ecabbd23282faac4659d1dcb137f5a97a4f527470bd6d7b9faa89a6ba5
BLAKE2b-256 checksum
How to use checksums
c778a2f184c705d758dabbc7c05e7e65f451b9f6e7a67b3a54b9d9a582766492
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / dreaming_electric_sheep-1.2.0-cp313-cp313-musllinux_1_2_aarch64.whl

Download URL dreaming_electric_sheep-1.2.0-cp313-cp313-musllinux_1_2_aarch64.whl
Size 7.7 MB
Tags CPython 3.13 Linux musl 1.2+ ARM64
SHA-256 checksum
How to use checksums
44e49a3e6fbae5a585a0b6f3e8fb24f748c69104658e76d7436f57b23917a0fa
BLAKE2b-256 checksum
How to use checksums
162c27c61c5381c82038f7a91b136857dbabf1cfc7f9b223ab3645035130a312
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / dreaming_electric_sheep-1.2.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL dreaming_electric_sheep-1.2.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 8.0 MB
Tags CPython 3.13 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
d1d67e12e28076aeb690037d77bd8805b67bc52d73500ef5894d5a5050c27995
BLAKE2b-256 checksum
How to use checksums
ad2e8bc2de83792e7be2b332021d829f686709235bc6a49c39da87968a70cc61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / dreaming_electric_sheep-1.2.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl

Download URL dreaming_electric_sheep-1.2.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Size 7.9 MB
Tags CPython 3.13 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
24e6b2a8928343665018976c1efdbaa474e40eedc017131d3781bdeec97c8002
BLAKE2b-256 checksum
How to use checksums
490101c9c03d5edd849796785b0f87db3fcb51c14ea861a4b19dcb6d5dfaee42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / dreaming_electric_sheep-1.2.0-cp313-cp313-macosx_10_13_universal2.whl

Download URL dreaming_electric_sheep-1.2.0-cp313-cp313-macosx_10_13_universal2.whl
Size 3.5 MB
Tags CPython 3.13 macOS 10.13+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
9e7baa87a7d0db2eecaa7033fbe42462c18088f64af472d1c06230b21eb303d7
BLAKE2b-256 checksum
How to use checksums
9e2490fb5f78dbad2b5d634b72abb8cb8a94721090c9244ab098bafa390a04bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release history Release notifications | RSS feed

This release

1.2.0 This release

15 release files

1.1.2

15 release files

1.1.1

15 release files

1.1.0

15 release files

1.0.0

15 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page