load_config¶
- load_config(search_dir: str | Path) StubConfig[source]¶
Load a
StubConfigfrom the nearest config file.Searches upward from search_dir for
stubpy.tomlor a[tool.stubpy]section inpyproject.toml. Returns a defaultStubConfigwhen no config file is found.- Parameters:
search_dir (str or Path) – Directory to begin the upward search (typically the package being stubbed, or the current working directory).
- Returns:
StubConfig – Fully populated config, falling back to defaults for any key not present in the file.
Examples
>>> from stubpy.config import load_config >>> cfg = load_config(".") >>> cfg.union_style in ("modern", "legacy") True
See also
Public API reference — overview of all public names.