This page summarizes the public names exported by smallserver. Signatures
omit overload detail where prose is clearer.
get(path),post(path),put(path),patch(path),delete(path)— route decorators for one supported method.route(path, methods)— atomic multi-method route decorator.get_regex,post_regex,put_regex,patch_regex,delete_regex, androute_regex(pattern, methods)— optional timeout-bounded regex decorators.websocket(path, *, origins=None, subprotocols=())— static HTTP/1.1 WebSocket Upgrade decorator.async dispatch(request)— dispatch an existingRequest.listen(host="127.0.0.1", port=8000, config=None, *, protocol="http1",http2_config=None, runtime=None, start=None)— managed blocking lifecycle or caller-owned scheduling/startup.serve(runtime, host="127.0.0.1", port=8000, config=None, *,protocol="http1", http2_config=None)— schedule against a caller-owned runtime and return immediately.
Immutable, case-insensitive mapping with items() and get().
Frozen request value with validated method, path, headers, and byte body, plus
raw_target, query_string, immutable path_params, and route_pattern.
Frozen response value. Response.text(), Response.json(), and to_http1()
provide common construction and serialization paths.
Frozen finite-limit configuration. See Configuration.
Frozen SmallOS settings used only when listen() creates the runtime. A
caller-supplied runtime retains its own configuration.
Optional cleartext HTTP/2 stream, buffer, frame-batch, and timeout limits. See
Cleartext HTTP/2. Constructing a listener with protocol="http2"
requires the smallserver[http2] extra.
Read-only properties: address, port, closed, failure, finished,
cleanup_errors, owned_connection_count, dropped_route_error_events, and
route_observer_failures.
Operations: close(), async close_from_task(task), and finalize().
Finite optional-regex limits. RouteErrorEvent, RouteMatchTimeout,
RoutePathTooLarge, and RegexRoutesUnavailable describe its bounded error
surface. Runtime regex matching requires smallserver[regex-routes].
WebSocketConfig— finite connection, frame, message, mailbox, and deadline limits.WebSocket—accept,reject, receive/send methods,ping,close, iteration,request, and negotiatedsubprotocol.WebSocketMessage— complete typed text or binary message.WebSocketDisconnect,WebSocketStateError, andWebSocketCapacityError— application-visible lifecycle and capacity outcomes.WebSocketUnavailable— the optionalwsprotoengine is missing.
See WebSockets for handshake and completion semantics.
Bounded worker-thread execution for synchronous or thread-affine callables.
Bounded coroutine execution on one persistent asyncio loop thread.
Methods: register, get, call, names, items, and shutdown. It also
implements a context manager and exposes closed.
Convert a SmallOS AdapterError to a sanitized HTTPError.
Applications can import AdapterError, AdapterCapacityError,
AdapterUnavailableError, AdapterClosedError, AdapterCancelledError,
AdapterProtocolError, and AdapterExecutionError directly from
smallserver.
Raised after registry shutdown attempts every adapter but one or more fail.
Its failures tuple contains (name, exception) entries.
HTTPError(status, detail="")ServerConfigurationErrorServerStartupErrorServerFinalizationError
Cleanup errors expose cleanup_errors, cleanup_complete, retry_cleanup(),
and finalize(). ServerStartupError additionally exposes primary_error.
Public typing information is shipped through smallserver/py.typed.