Skip to main content

Agnostic config parser and validator for Python applications.

Project description

fig-jam

CI status codecov PyPI - Python Version PyPI Code style: Ruff License: MIT

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 via pyyaml. 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.
  • strict must stay True for dict/dataclass/Pydantic validators; may be set to False with 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 ConfigError messages 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fig_jam-0.1.0.tar.gz (121.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fig_jam-0.1.0-py3-none-any.whl (28.5 kB view details)

Uploaded Python 3

File details

Details for the file fig_jam-0.1.0.tar.gz.

File metadata

  • Download URL: fig_jam-0.1.0.tar.gz
  • Upload date:
  • Size: 121.1 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for fig_jam-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8c60887823097c378941571dde45f72ba7aaba6a5ac2baa2dfc0b58287cb287e
MD5 2ff25b79e35f58ef743777599e9fa34d
BLAKE2b-256 9574220a07008fb94d04b7634e5a0d25da58548babf26da18353d7c6b04cb6e0

See more details on using hashes here.

File details

Details for the file fig_jam-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: fig_jam-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 28.5 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for fig_jam-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d6c0aa0729af95cedf8bca889c6e24bc96c5b5c3f0ad017336c41af6383043f1
MD5 ee260d5e2d27d059f3bac087ca20bf5a
BLAKE2b-256 639cc7ed166957537d011217940bdef3d8f3ba1ee5edd3b8b051a729578a10ee

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page