ClassyConfig is a Python3 package aiming to remove the need for a config.py or settings.py file.
Project description
ClassyConfig
ClassyConfig is a Python3 package aiming to remove the need for a config.py or settings.py file.
Documentation
Installation
ClassyConfig is avliable via Pypi, so it can be installed using pip
$ pip install classy_config
Usage
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
Release history Release notifications | RSS feed
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.4.0a0.tar.gz
(5.5 kB
view hashes)
Built Distribution
Close
Hashes for classy_config-0.4.0a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 935fad1eff0b14ead2e6142ebb4174a5ff1c8dc8d296c4b0dbdbea96df1e3e8b |
|
MD5 | 513e9abb46df4b0f50b54ed79ba474e2 |
|
BLAKE2b-256 | ffaf72223a9634e1bd3d8cfa20f1b79167a9f299ab59a5a4bf3febafd0ef2c5c |