Skip to main content

PyConFigue

Features

This library provides you an easy way to properly manage your python application configuration easily.

The key features are:

  • Multiple configuration sources support using configuration providers
  • Sources priority managment using a layer based model
  • Typed configuration
  • Autocomplete from IDEs
  • Support of objects configurations using Pydantic

Installation

pip install pyconfigue

Usage

1 - Define your ConFigue Model

from pyconfigue import ConFigueModel
from pydantic import BaseModel


class MyPydanticModel(BaseModel):
    key1: dict[str, str]
    key2: float


class MyConFigueModel(ConFigueModel):
    CONFIG_KEY: str
    CONFIG_KEY_2: int
    CONFIG_KEY_3: list[str]
    CONFIG_KEY_4: MyPydanticModel

2 - Define your Providers

from pyconfigue.providers import StaticFileProvider, EnvProvider, DefaultProvider

# File Provider


file_provider = StaticFileProvider(["my_file.yaml", "my_file_2.yaml"])

# Environment Provider
env_provider = EnvProvider()


# Default Provider
class DefaultConFigue(MyConFigueModel):
    CONFIG_KEY = "test_value"
    CONFIG_KEY_2 = 2
    CONFIG_KEY_3 = ["1", "2"]
    CONFIG_KEY_4 = MyPydanticModel(key1={"k1": "1", "k2": "2"}, key2=1.2)


default_provider = DefaultProvider(DefaultConFigue())

3 - Define your ConFigue Manager

from pyconfigue import ConFigueManager


class MyAppConFigueManager(ConFigueManager, MyConFigueModel):
    pass


CONFIG = MyAppConFigueManager([env_provider, file_provider, default_provider])

4 - Use your ConFigue

from .app_config import CONFIG

print("CONFIG VALUE of CONFIG_KEY", CONFIG.CONFIG_KEY)

5 - Dump the full config

CONFIG.dump()  # dict of every declared key, resolved through the providers
CONFIG.to_model()  # same, as a validated instance of your ConFigueModel

Documentation

See our wiki if you need more details about how the project works.

License

The project is under the MIT License.

Requirements

The project requires:

  • python = ">=3.10"
  • pydantic = "^2.11.4"
  • pyyaml = "^6.0.2"
  • toml = "^0.10.2"

Project Status

NOTE
The project is currently in development phase. If you have any remark or question feel free to open an Issue

Download files

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

Source Distribution

pyconfigue-1.0.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

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

pyconfigue-1.0.0-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file pyconfigue-1.0.0.tar.gz.

File metadata

  • Download URL: pyconfigue-1.0.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.2 CPython/3.14.7 Linux/6.1.0-37-amd64

File hashes

Hashes for pyconfigue-1.0.0.tar.gz
Algorithm Hash digest
SHA256 507d07aaaa4f6f176feac7d30753f6fe1e49457d24e5fc91df4b085dc0f17bf7
MD5 2f13030ed923e181acb13f43389b04c2
BLAKE2b-256 1a2d687a97e6e99d48e0380ebc05f83f270cbf44f80da579ac1fc26ce9ee0d0b

See more details on using hashes here.

File details

Details for the file pyconfigue-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pyconfigue-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.2 CPython/3.14.7 Linux/6.1.0-37-amd64

File hashes

Hashes for pyconfigue-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 06b7172466fde206f05850d91884c2b1e3a28d43299ce502584363f87ea12ccf
MD5 06a4c0f95c7f3cadf8cf2d28be3abf21
BLAKE2b-256 47990a9a195e77384e27439a54603d42821491f6c24882499e6b48327663e8bf

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 files

0.0.2

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page