- access
config['axes.xticks.color']
andconfig.axes.xticks.color
. Which one is the preferred? Or both? - validators
- default values? resetting?
- virtual or real hierarchy: Is the structure only naming convention or do we want to define explicit structure components?
- support aliases, possibility for deprecated aliases
- simple layering of configs (ChainMap-like?)
- Definition of values should be explicit (e.g. ArgumentParser-style)
config.add_param('lines.width', type=float, description="The width of all lines in points")
- option for inferred values ("grid.linewidth" should use the value from "lines.width")
- fast access - may be needed often in constructors for 'small' objects like ticks.
- contexts
How do other libraries handle this? numpy, scipy, scikit image, pandas,
- numpy: n/a
- scipy: n/a
- pandas: http://pandas.pydata.org/pandas-docs/stable/user_guide/options.html
- Naming: option/options
- "fully-dotted"
- Supports both
pd.options.display.max_rows
andget_option('pd.options.display.max_rows')
- Has a regexp matcher for names
Would not do this because
- ambiguity
- may introduce unnoticed errors
- uniqueness may fail when more options are added
- case insensitive
- MATLABian context style
with option_context('display.max_rows', 10, 'display.max_columns', 5):
- scikit image: n/a
- flask: http://flask.pocoo.org/docs/1.0/api/#flask.Config
- dict extended for reading/writing config files
- Parameter names: UNDERSCORE_SEPARATED
get_namespace()
for returning
- django: https://docs.djangoproject.com/en/2.2/topics/settings/
- a settings module with uppercase variables
- not recommended to change at runtime
- ipython: https://ipython.readthedocs.io/en/stable/config/intro.html
https://github.com/ipython/ipython/blob/a2685d78f2403f84e6cb915ae11a4f6033ccc5f6/docs/source/development/config.rst
- Using its own traitlets variant and
traitlets.config
https://github.com/ipython/traitlets/tree/master/traitlets/config
- Using its own traitlets variant and
- types: assert isinstance(x, type)
- lists: assert x in list
- callable: assert func(x)
- preprocessor x = func(x)
with config({'axes.xticks.color': 'red', 'axes.xticks.edgewidth': 4}):
with config({'axes.xticks': {'color': 'red', 'edgewidth': 4}}):
with config(axes_xticks_color='red', axes_xticks_edgewidth=4}):