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.
from classy_config import BaseModel, ConfigValue, register_config
# Create your global config manager (example test-config.json below)
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)
package="ClassyConfig"
[author]
username="GDWR"
email="gregory.dwr@gmail.com"
lucky_number=17
[nested]
value=10
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.2.0a3.tar.gz
(4.7 kB
view hashes)
Built Distribution
Close
Hashes for classy_config-0.2.0a3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35ca8c2ad3f1b1dd96851212d4edec8bebd2339ac72e5a85a3c2082366c666a2 |
|
MD5 | 3b4f0be25fdd624925b376b2b0bf0d8c |
|
BLAKE2b-256 | 50e4ed44ac2f0e3656b81c559c7d47fc8c3a65d1f58926de2113feb54c0d23bc |