Module

_config_file

TOML configuration file loading for pounce.

Searches for configuration in this order:

  1. pounce.tomlin the current working directory
  2. [tool.pounce] section in pyproject.toml

Values from the config file are used as defaults — CLI arguments always take precedence.

Examplepounce.toml::

host = "0.0.0.0"
port = 8080
workers = 4
log_level = "debug"

[static_files]
"/static" = "./public"
"/assets" = "./dist"

Examplepyproject.toml::

[tool.pounce]
host = "0.0.0.0"
port = 8080
workers = 4

Functions

find_config_file 1 Path | None
Find a pounce config file in the given (or current) directory.
def find_config_file(search_dir: Path | None = None) -> Path | None
Parameters
Name Type Description
search_dir Path | None Default:None
Returns
Path | None
load_config_file 1 dict[str, Any]
Load pounce configuration from a TOML file. For ``pounce.toml``, the entire fi…
def load_config_file(path: Path) -> dict[str, Any]

Load pounce configuration from a TOML file.

Forpounce.toml, the entire file is treated as config. Forpyproject.toml, reads the [tool.pounce]section.

Parameters
Name Type Description
path Path
Returns
dict[str, Any]
_validate_and_coerce 2 dict[str, Any]
Validate keys and coerce types to match ServerConfig fields.
def _validate_and_coerce(data: dict[str, Any], source: Path) -> dict[str, Any]
Parameters
Name Type Description
data dict[str, Any]
source Path
Returns
dict[str, Any]
load_config_with_overrides 3 dict[str, Any]
Load config file and merge with CLI overrides. CLI overrides always win. Only …
def load_config_with_overrides(cli_overrides: dict[str, Any], *, search_dir: Path | None = None, config_path: Path | None = None) -> dict[str, Any]

Load config file and merge with CLI overrides.

CLI overrides always win. Only non-None CLI values are treated as overrides (so that unset CLI flags don't mask file values).

Parameters
Name Type Description
cli_overrides dict[str, Any]

Dict of CLI arg values. Keys with None values are treated as "not set" and won't override file config.

search_dir Path | None

Directory to search for config files.

Default:None
config_path Path | None

Explicit config file path (skips search).

Default:None
Returns
dict[str, Any]