Public API
Thepouncepackage exports the following:
from pounce import run, ServerConfig, ASGIApp, Scope, Receive, Send
pounce.run()
Start a pounce server.
def run(app: str, **kwargs: Unpack[ServerConfigKwargs]) -> None:
Parameters:
| Name | Type | Description |
|---|---|---|
app |
str |
ASGI application string (e.g.,"myapp:app" or "myapp:create_app()") |
**kwargs |
ServerConfigKwargs |
Configuration overrides passed toServerConfig |
Example:
import pounce
# Minimal
pounce.run("myapp:app")
# Configured
pounce.run(
"myapp:app",
host="0.0.0.0",
port=8000,
workers=4,
compression=True,
server_timing=True,
)
pounce.ServerConfig
Frozen dataclass holding all server configuration. See ServerConfig for the complete field reference.
from pounce import ServerConfig
config = ServerConfig(host="0.0.0.0", port=8000, workers=4)
print(config.resolve_workers()) # 4
ASGI Types
Pounce exports typed definitions for the ASGI interface:
ASGIApp
ASGIApp = Callable[[Scope, Receive, Send], Awaitable[None]]
The standard ASGI application callable.
Scope
Scope = MutableMapping[str, Any]
The ASGI connection scope dictionary.
Receive
Receive = Callable[[], Awaitable[dict[str, Any]]]
Callable that receives ASGI events from the client.
Send
Send = Callable[[dict[str, Any]], Awaitable[None]]
Callable that sends ASGI events to the client.
__version__
from pounce import __version__
print(__version__) # e.g., "0.4.0"
The installed package version, read from importlib.metadata.
See Also
- ServerConfig — Full configuration reference
- ASGI Bridge — Bridge internals