Skip to main content
Version: 1.0

A hierarchical static configuration


Dataclasses can be nested and then accessed via a common root. The entire tree is type checked.

class MySQLConfig:
host: str = "localhost"
port: int = 3306
class UserInterface:
title: str = "My app"
width: int = 1024
height: int = 768
class MyConfig:
db: MySQLConfig = MySQLConfig()
ui: UserInterface = UserInterface()
cs = ConfigStore.instance()"config", node=MyConfig)
def my_app(cfg: MyConfig) -> None:
print(f"Title={cfg.ui.title}, size={cfg.ui.width}x{cfg.ui.height} pixels")
if __name__ == "__main__":
Last updated on by Jasha10