dotmap
dotmap copied to clipboard
Immutable/frozen dotmap
Hi, I am searching a best type for config data, usually it is nested dict, but on my opinion config must:
- have dot notation for readability,
- be immutable for safe using (config is global variable). Can DotMap be immutable?
P.S. I found https://github.com/cdgriffith/Box/ but not sure that it popular = good tested.
I usually use
configFile = yaml.safe_load(fileObject)
config = dotmap.DotMap(configFile, _dynamic = False)
which works fine. However It would be nice to be able to switch between dynamic and "static" DotMaps. For instance I want to load the config file, apply command line overrides (using argparse) and then lock the config. Currently I iterate over the DotMap and recursively set _dynamic to False.