ConfigClass - simple dataclass inspired configuration
**What My Project Does**
I'm making a simple configclass for handling configuration in smaller projects and scripts. Goal is to be as simple to start with as creating a dataclass.
The module itself works off dataclass and when you use it you just define a dataclass as normal, but decorate it with @configclass() instead.
Example:
from configclass import configclass
@configclass()
class Settings:
foo: bool = False
url: str = ""
footoo: bool = True
my_model: str = "model.pt"
setting = Settings.load()
print(setting.foo, setting.footoo, setting.my_model)
From that you got
JSON config file support (config.json)
YAML config file support (config.yaml)
Command line support (argparse)
Env variables support (CONFIG_SETTINGNAME)
It also support nested structures via nested dataclass classes.
**Comparison**
It's meant as a quick and lightweight alternative to larger and more comprehensive config systems, for the small programs and scripts where you'd just use a dataclass, and maybe load the values from a config file.
**Target Audience**
Since it's pretty new and raw I wouldn't recommend it for heavy production settings or complex projects. That said, it should work fine for most cases.
While I've worked with python for quite some time, this is
/r/Python
https://redd.it/1chhm8x
>>Click here to continue<<