Skip to content

Picker server reference

The published server reference renders the Python signatures and docstrings below. For configuration and client mounts, use the integration guide.

server

Serve the stack's theme preference using only the Python standard library.

Theme

Bases: TypedDict

A named palette and its representative gallery colors.

Addon

Bases: TypedDict

An optional visual change for a specific group of apps.

Catalog

Bases: TypedDict

Metadata bundled and tested with the offline picker.

Selection

Bases: NamedTuple

One preference shared by the apps in this generated project.

PickerHandler

Bases: BaseHTTPRequestHandler

Serve a small same-origin UI; only a JSON POST can change the theme.

respond

respond(
    status: int, content_type: str, body: bytes
) -> None

Send a complete, non-cacheable response with an explicit content type.

json_response

json_response(
    status: int,
    **fields: str
    | tuple[str, ...]
    | list[str]
    | list[Theme]
    | list[Addon]
    | None,
) -> None

Use the same response format for updates and validation failures.

available_apps

available_apps() -> list[str]

Report the supported apps selected in this deployment.

available_addons

available_addons() -> list[Addon]

Show only the applicable apps beside each add-on.

do_GET

do_GET() -> None

Return the current selection or one of the bundled picker files.

do_POST

do_POST() -> None

Accept a supported theme from the picker origin.

read_selection

read_selection(selection: Path) -> Selection

Accept only the exact local imports the picker can write.

save_theme

save_theme(
    selection: Path,
    theme: str,
    addons: tuple[str, ...] = (),
    *,
    only_if_missing: bool = False,
) -> None

Atomically publish a palette and all its add-ons in one complete stylesheet.

trusted_host

trusted_host(authority: str, allowed_host: str) -> bool

Allow local names, literal addresses, or an explicitly configured DNS hostname.

main

main() -> None

Start the picker and initialize only a new state directory.