During development of the CLI the need for parsing configuration values for the core and plugins from config.toml and perhaps envvars arose.
Module level constants could be altered depending on a heuristic to use all package level constants and such in pyroll.<package>.config modules.
But module level constants are error prone regarding imported references, for example one shall always import the config module and not the value itself (from . import config instead of from .config import SOME_VAR).
A static configuration class would be the better approach, since one could not accidentally import the var itself. To facilitate creation of such classes, the following helper classes and decorators are proposed.
During development of the CLI the need for parsing configuration values for the core and plugins from
config.toml
and perhaps envvars arose. Module level constants could be altered depending on a heuristic to use all package level constants and such inpyroll.<package>.config
modules. But module level constants are error prone regarding imported references, for example one shall always import the config module and not the value itself (from . import config
instead offrom .config import SOME_VAR
).A static configuration class would be the better approach, since one could not accidentally import the var itself. To facilitate creation of such classes, the following helper classes and decorators are proposed.