Functions
_get_env
0
▼
Get or create the kida template environment (thread-safe, lazy).
_get_env
0
▼
def _get_env()
_is_pretty
0
bool
▼
Check if we're in pretty (TTY) output mode.
_is_pretty
0
bool
▼
def _is_pretty() -> bool
Returns
bool
_render
2
str
▼
Render a kida template with the given context.
_render
2
str
▼
def _render(name: str, **ctx) -> str
Parameters
| Name | Type | Description |
|---|---|---|
name |
str |
|
**ctx |
— |
Returns
str
_write
1
None
▼
Write a line to stderr (thread-safe).
Reuses the shared lock from pounce.loggi…
_write
1
None
▼
def _write(text: str) -> None
Write a line to stderr (thread-safe).
Reuses the shared lock from pounce.logging so lifecycle output and direct stderr writes (JSON mode, etc.) never interleave under free-threaded Python.
Parameters
| Name | Type | Description |
|---|---|---|
text |
str |
error
5
None
▼
Render a branded error message.
Uses the kida template when stderr is a TTY (e…
error
5
None
▼
def error(message: str, *, code: str | None = None, hint: str | None = None, docs_url: str | None = None, diagnostics: list[dict[str, str]] | None = None) -> None
Render a branded error message.
Uses the kida template when stderr is a TTY (even if logging hasn't been configured yet — errors can fire before configure_logging runs). Falls back to plain text when piped.
Parameters
| Name | Type | Description |
|---|---|---|
message |
str |
|
code |
str | None |
Default:None
|
hint |
str | None |
Default:None
|
docs_url |
str | None |
Default:None
|
diagnostics |
list[dict[str, str]] | None |
Default:None
|
_human_bytes
1
str
▼
Format byte count for human readability.
_human_bytes
1
str
▼
def _human_bytes(n: int) -> str
Parameters
| Name | Type | Description |
|---|---|---|
n |
int |
Returns
str
_duration_str
1
str
▼
Format duration in human-readable form.
_duration_str
1
str
▼
def _duration_str(ms: float) -> str
Parameters
| Name | Type | Description |
|---|---|---|
ms |
float |
Returns
str
access
6
None
▼
Render a pretty-mode access log line via kida template.
access
6
None
▼
def access(method: str, path: str, status: int, bytes_sent: int, duration_ms: float, client: str) -> None
Parameters
| Name | Type | Description |
|---|---|---|
method |
str |
|
path |
str |
|
status |
int |
|
bytes_sent |
int |
|
duration_ms |
float |
|
client |
str |
detect_gil_status
0
str
▼
Detect whether the GIL is enabled or disabled.
detect_gil_status
0
str
▼
def detect_gil_status() -> str
Returns
str
probe_optional_dep
1
tuple[bool, str]
▼
Check if an optional dependency is importable and return its version.
probe_optional_dep
1
tuple[bool, str]
▼
def probe_optional_dep(module: str) -> tuple[bool, str]
Parameters
| Name | Type | Description |
|---|---|---|
module |
str |
Returns
tuple[bool, str]
probe_all_optional_deps
0
list[dict]
▼
Probe all optional dependencies, returning status dicts for rendering.
probe_all_optional_deps
0
list[dict]
▼
def probe_all_optional_deps() -> list[dict]
Returns
list[dict]
detect_frameworks
0
list[str]
▼
Detect installed ASGI frameworks by attempting imports.
detect_frameworks
0
list[str]
▼
def detect_frameworks() -> list[str]
Returns
list[str]
info_panel
8
None
▼
Render the system info diagnostic panel.
info_panel
8
None
▼
def info_panel(*, version: str, python_version: str, platform_str: str, cpu_count: int, gil_status: str, install_path: str, deps: list[dict], frameworks: list[str]) -> None
Parameters
| Name | Type | Description |
|---|---|---|
version |
str |
|
python_version |
str |
|
platform_str |
str |
|
cpu_count |
int |
|
gil_status |
str |
|
install_path |
str |
|
deps |
list[dict] |
|
frameworks |
list[str] |
check_results
3
None
▼
Render pre-flight check results.
check_results
3
None
▼
def check_results(*, version: str, checks: list[dict], all_passed: bool) -> None
Parameters
| Name | Type | Description |
|---|---|---|
version |
str |
|
checks |
list[dict] |
|
all_passed |
bool |
_shorten_path
1
str
▼
Shorten a file path for display.
_shorten_path
1
str
▼
def _shorten_path(filepath: str) -> str
Parameters
| Name | Type | Description |
|---|---|---|
filepath |
str |
Returns
str
_hint_for_crash
1
str
▼
Generate a contextual hint for common crash patterns.
_hint_for_crash
1
str
▼
def _hint_for_crash(exc: BaseException) -> str
Parameters
| Name | Type | Description |
|---|---|---|
exc |
BaseException |
Returns
str
branded_traceback
2
None
▼
Render a branded traceback for an unhandled exception.
branded_traceback
2
None
▼
def branded_traceback(exc: BaseException, *, worker_id: int | None = None) -> None
Parameters
| Name | Type | Description |
|---|---|---|
exc |
BaseException |
|
worker_id |
int | None |
Default:None
|