Skip to main content

ClassyConfig is a Python3 package aiming to remove the need for a config.py or settings.py file.

Project description

ClassyConfig Logo

ClassyConfig

ClassyConfig is a Python3 package aiming to remove the need for a config.py or settings.py file.

Checks Pipeline Badge Create Documentation Badge Build and Publish Badge
PyPI MIT License Downloads

Documentation

Installation

ClassyConfig is avliable via Pypi, so it can be installed using pip

$ pip install classy_config

Usage

View on the docs

from classy_config import ConfigValue, register_config
from pydantic import BaseModel

# Register your config file to be used
register_config(filepath="config.toml")

# Resolve default values based on your config
def print_current_version(version: str = ConfigValue("package", str)) -> None:
    print(version)

# Use Pydantic Models for your config
class Author(BaseModel):
    username: str
    email: str
    lucky_number: int

# Resolve default values based on your config
def print_author(author: Author = ConfigValue("author", Author)) -> None:
    print(author)

# Allows for nested values
def print_value(value: int = ConfigValue("nested.value", int)) -> None:
    print(value)

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

classy_config-0.6.0.tar.gz (4.8 kB view hashes)

Uploaded Source

Built Distribution

classy_config-0.6.0-py3-none-any.whl (7.2 kB view hashes)

Uploaded Python 3

Supported by

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