Skip to main content

A library that let's you manage your python app configuration easily

Project description

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)

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

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

pyconfigue-0.0.2.tar.gz (6.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-0.0.2-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyconfigue-0.0.2.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.13.7 Linux/6.1.0-30-amd64

File hashes

Hashes for pyconfigue-0.0.2.tar.gz
Algorithm Hash digest
SHA256 e72f698d3faad2a15803ef2dda14b773200f02a456783fefec46cbec50d74dbb
MD5 f8e9b9c9014fa5da50630a61336d821b
BLAKE2b-256 abaca21320c20ad6feefe0ae8759e50568cf153eafd53e32d67dd17ed2a6938f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyconfigue-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.13.7 Linux/6.1.0-30-amd64

File hashes

Hashes for pyconfigue-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b590a86fa7a5b5282c12e45e260b911354fbbeca7e6734ba537eb32621fa75eb
MD5 1f566ba272fd7539620a3ca97a3749d8
BLAKE2b-256 1c99ede095b96e945b744ff17d5e1a778c375c5e10a733f1581d43329a5dc47a

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