find_config_file

find_config_file(search_dir: str | Path) Path | None[source]

Walk upward from search_dir looking for a stubpy config file.

Checks each directory for (in order):

  1. stubpy.toml

  2. pyproject.toml (only if it contains [tool.stubpy])

Returns the first matching Path, or None when no config is found before the filesystem root.

Parameters:

search_dir (str or Path) – Directory to start searching from (typically the package root or the source file’s parent).

Returns:

Path or None

Examples

>>> from stubpy.config import find_config_file
>>> result = find_config_file(".")   # returns None if no config present

See also

Public API reference — overview of all public names.