Skip to main content

Configuration Enhanced & Easy ☕️ - A Hydra-like configuration parser helper package

Project description

Language: 한국어 | English

Hydra-style Configuration + Pydantic Type Safety + Auto Help Generation

Python Version License: MIT Tests


☕️ Overview

confee makes configuration management simple, type-safe, and intuitive. Combine config files, Pydantic validation, environment variables, and CLI arguments seamlessly.


✨ Features

  • 🎯 Type-Safe — Pydantic V2 validation & IDE autocomplete
  • 📋 Multi-Format — YAML, JSON, TOML auto-detection
  • 🔄 Override System — CLI args & environment variables with priority control
  • 🔐 Secret MaskingSecretField() for sensitive data
  • 🧊 Immutability — Runtime config freezing
  • 📐 Extensible — Plugin system, JSON Schema, async loading

📦 Installation

pip install confee

🚀 Quick Start

# config.yaml
name: my-app
debug: false
workers: 4
from confee import ConfigBase

class AppConfig(ConfigBase):
    name: str
    debug: bool = False
    workers: int = 4

config = AppConfig.load("config.yaml")
print(f"App: {config.name}, Workers: {config.workers}")
# Override with CLI args
python app.py debug=true workers=8

# Override with environment variables
CONFEE_WORKERS=16 python app.py

# Nested config via environment (use __ for nested keys)
CONFEE_DATABASE__HOST=prod.db CONFEE_DATABASE__PORT=5432 python app.py

Auto-Generated Help

Run with --help to see available options:

$ python app.py --help
Usage: app.py [OPTIONS]

Options:
  --name     str   name
  --debug    bool  debug [default: False]
  --workers  int   workers [default: 4]

Override format:
  key=value              Set a simple value
  nested.key=value       Set a nested value
  @file:path/to/file     Read value from file
  true/false/yes/no/on/off for boolean values

Examples:
  app.py debug=true workers=8
  app.py --help

💡 Common Patterns

Nested Configuration

class DatabaseConfig(ConfigBase):
    host: str = "localhost"
    port: int = 5432

class AppConfig(ConfigBase):
    database: DatabaseConfig

config = AppConfig.load("config.yaml")
python app.py database.host=prod.db database.port=3306

Config Freezing

config = AppConfig.load("config.yaml")
config.freeze()

try:
    config.name = "changed"
except AttributeError:
    print("Config is frozen!")

📚 Documentation

See examples/ for more:

  • 01_basic_usage.py - Type-safe config, freezing
  • 02_cli_overrides.py - CLI args & env vars
  • 03_secrets.py - SecretField & masking
  • 04_fastapi.py - FastAPI integration

For advanced features, see ADVANCED.md:

  • Config Freezing & Immutability
  • JSON Schema Generation
  • Remote Config Loading (HTTP/HTTPS)
  • Plugin System (Custom Loaders, Validators, Hooks)
  • Config Diff & Merge
  • Integration Examples (FastAPI, Django, Kubernetes, AWS Lambda)

📄 License

MIT License © 2025 — See LICENSE for details.

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

confee-0.3.5.tar.gz (744.4 kB view details)

Uploaded Source

Built Distribution

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

confee-0.3.5-py3-none-any.whl (35.7 kB view details)

Uploaded Python 3

File details

Details for the file confee-0.3.5.tar.gz.

File metadata

  • Download URL: confee-0.3.5.tar.gz
  • Upload date:
  • Size: 744.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for confee-0.3.5.tar.gz
Algorithm Hash digest
SHA256 daee0a51e267dfdaa1cde554d4cda44809af679f19e8c2f0c62c31cd51c4ec29
MD5 63940ab072333826dab50a1cbca8f872
BLAKE2b-256 72a60ace35380071de305f6837f7fe7de231fdb0743cc265b8fac7d34091af34

See more details on using hashes here.

File details

Details for the file confee-0.3.5-py3-none-any.whl.

File metadata

  • Download URL: confee-0.3.5-py3-none-any.whl
  • Upload date:
  • Size: 35.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for confee-0.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 9e380307405158036926cb36505ae3ca05c489883f7454d6d26daa1156b8a518
MD5 20a552d8f56e985969ede721630d4311
BLAKE2b-256 b074a81e4a49a1926efbcbe103ec23ca097545f84996919393ae5eb77ed61796

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