Pounce API Reference

Browse Python API documentation by package.

Packages

Modules

__main__

Allow running pounce via python -m pounce.

_cli

Command-line interface for pounce.

_compression

Content encoding negotiation and compressor factory. Parses Accept-Encoding headers, selects the best encoding, and...

_cpu_affinity

CPU affinity for worker threads (Linux only).

_debug

Development error pages with rich tracebacks.

_errors

Error hierarchy for pounce. All pounce errors inherit from PounceError.

_fast_h1

Fast HTTP/1.1 parser for the sync worker — replaces h11 on the hot path.

_h2_handler

HTTP/2 connection handler — manages multiplexed streams over a single connection. Extracted from ``worker.py`` to...

_h3_handler

HTTP/3 connection handler — manages QUIC/UDP streams via zoomies. HTTP/3 uses QUIC (UDP) transport.

_headers

Shared header lookup utilities. Single-pass header extraction for ASGI headers (list or tuple of (name, value) byte...

_health

Built-in health check endpoint. Responds to GET requests at the configured ``health_check_path`` before the request...

_hot_reload

Hot reload without connection drops for pounce.

_importer

Application importer — resolves string references to ASGI callables.

_metrics_handler

Built-in /metrics endpoint for Prometheus scraping.

_middleware

Middleware extension system for server-level request/response processing.

_otel

OpenTelemetry integration for distributed tracing.

_output

Kida template infrastructure and one-shot branded output. Provides the shared template environment, thread-safe...

_priority

HTTP Priority Signals (RFC 9218). Parses the ``Priority`` header (``u=N, i``) from HTTP/2 requests and provides a...

_profile

Request profiling — enabled via POUNCE_PROFILE=1. Samples every Nth request and logs read/parse/app/drain timings...

_proxy

Proxy header validation — extract real client info from trusted reverse proxies. When ``trusted_hosts`` is...

_rate_limiter

Rate limiting and backpressure for pounce.

_reload

File watcher for development mode (``--reload``). Polls the application's source directory for changes and signals...

_request_id

Request ID generation and propagation. Each request gets a unique ID for tracing across logs and services. If a...

_request_pipeline

Shared request pipeline — functions used by both Worker and SyncWorker.

_request_queue

Request queuing and load shedding for pounce.

_response_frame

Pre-built HTTP response framing for the fused sync path. Bypasses H1Protocol/h11 for the hot path — serializes...

_runtime

Runtime detection utilities. Detects GIL state and determines the appropriate worker mode for the current Python...

_sentry

Sentry error tracking integration for pounce.

_state

Server lifecycle state machine — Elm Architecture via milo. Centralizes the server lifecycle (init → startup →...

_static

Static file serving with modern optimizations. Designed for Bengal SSG output and Chirp static assets.

_timing

Timing utilities and Server-Timing header builder. Provides monotonic clock helpers for request-level timing and a...

_types

ASGI type definitions for pounce. Typed definitions for the ASGI 3.0 protocol.

_ws_handler

WebSocket connection handler — HTTP/1.1 upgrade lifecycle. Extracted from ``worker.py`` to keep protocol-specific...

accept_distributor

AcceptDistributor — single-thread accept feeding a shared worker queue. Eliminates thundering herd on macOS/Windows...

async_pool

AsyncPool — dedicated event loop for streaming and WebSocket connections. Receives handoffs from SyncWorkers when...

config

Server configuration.

h3_worker

HTTP/3 worker — runs QUIC/UDP datagram endpoint for HTTP/3.

lifecycle

Connection lifecycle events — structured, immutable records. Each event captures a moment in a connection's...

logging

Logging configuration and access log formatting. Configures stdlib logging with pounce-specific formatting.

metrics

Prometheus-compatible metrics collector. Implements the ``LifecycleCollector`` protocol to track standard...

pounce

Pounce — A free-threading-native ASGI server for Python 3.14t. Pounce is a pure-Python ASGI server designed from...

server

Server — orchestrates the full pounce lifecycle. Manages the state machine: CONFIG → DETECT → BIND → LIFESPAN →...

supervisor

Supervisor — spawns, monitors, and restarts workers. The supervisor sits between the ``Server`` and the ``Worker``...

sync_protocol

SyncApp protocol — fused sync request-response path for Pounce. When a SyncApp is provided, the sync worker calls...

sync_worker

SyncWorker — blocking I/O worker for request-response workloads. One request at a time per thread, no asyncio.

testing

First-class testing utilities for pounce.

worker

Worker — the heart of pounce's request handling. Runs a single asyncio event loop that accepts connections on a...