# _config_file

URL: /pounce/api/_config_file/
Section: api
Description: TOML configuration file loading for pounce.

Searches for configuration in this order:
1. ``pounce.toml`` in 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.

Example ``pounce.toml``::

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

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

Example ``pyproject.toml``::

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

---

> For a complete page index, fetch /pounce/llms.txt.

Open LLM text
(/pounce/api/_config_file/index.txt)

Share with AI

Ask Claude
(https://claude.ai/new?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fpounce%2Fapi%2F_config_file%2Findex.txt)

Ask ChatGPT
(https://chatgpt.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fpounce%2Fapi%2F_config_file%2Findex.txt)

Ask Gemini
(https://gemini.google.com/app?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fpounce%2Fapi%2F_config_file%2Findex.txt)

Ask Copilot
(https://copilot.microsoft.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fpounce%2Fapi%2F_config_file%2Findex.txt)

Module

#
`_config_file`

TOML configuration file loading for pounce.

Searches for configuration in this order:

- `pounce.toml`in the current working directory

- `[tool.pounce]` section in `pyproject.toml`

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

Example`pounce.toml`::

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

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

Example`pyproject.toml`::

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

4Functions

## 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.

For`pounce.toml`, the entire file is treated as config.
For`pyproject.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]`
