fig-jam
Single-call configuration loader that discovers, parses, validates, and documents project settings with minimal boilerplate.
Quick start
from fig_jam import get_config
config = get_config(
path="./config.yaml", # file or directory; defaults to ~
section="database", # optional top-level key to extract
validator={"host": str, "port": int}, # or list[str], dataclass, Pydantic
)
print(config) # {"host": "127.0.0.1", "port": 8050}
get_config returns validated data when exactly one candidate succeeds, otherwise
raises ConfigError with actionable guidance and a suggested config template.
What it does
- Discovers config files when given a directory; chooses the sole candidate that passes validation, or asks you to disambiguate.
- Parses common formats: JSON; INI/CFG; TOML via
tomllib/tomli; YAML viapyyaml. Files are decoded with BOM-aware UTF-8 fallback to ASCII/Latin-1/CP1252. - Applies environment overrides declared on dataclass or Pydantic validators via
__env_overrides__ = {"field": "ENV_VAR"}before validation. - Validates payloads using:
None: return raw mapping.list[str]: assert keys exist;strict=True(default) filters to those keys.dict[str, type]: assert keys exist, coerce types, return filtered mapping.- Dataclass: coerce field types (including nested dataclasses/models) and instantiate.
- Pydantic model: let Pydantic validate and instantiate.
strictmust stayTruefor dict/dataclass/Pydantic validators; may be set toFalsewith a list validator to keep extra keys.
Why it’s helpful
- Zero per-project parser setup—formats are auto-detected and optional dependencies are only required when their formats are present.
- Clear
ConfigErrormessages capture discovery, parsing, overrides, and validation diagnostics so you know what to fix next. - Built-in template rendering shows the expected shape (and env vars) for the current validator and file format.
Release files for fig-jam 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fig_jam-0.1.0.tar.gz | 121.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fig_jam-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 149.6 kB
Release files / fig_jam-0.1.0.tar.gz
| Download URL | fig_jam-0.1.0.tar.gz |
|---|---|
| Size | 121.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8c60887823097c378941571dde45f72ba7aaba6a5ac2baa2dfc0b58287cb287e
|
|
BLAKE2b-256 checksum How to use checksums |
9574220a07008fb94d04b7634e5a0d25da58548babf26da18353d7c6b04cb6e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / fig_jam-0.1.0-py3-none-any.whl
| Download URL | fig_jam-0.1.0-py3-none-any.whl |
|---|---|
| Size | 28.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d6c0aa0729af95cedf8bca889c6e24bc96c5b5c3f0ad017336c41af6383043f1
|
|
BLAKE2b-256 checksum How to use checksums |
639cc7ed166957537d011217940bdef3d8f3ba1ee5edd3b8b051a729578a10ee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|