Comprehensive Config

Comprehensive config is a python configuration library that aims to be extraordinarily pythonic and easy to use. It takes heavy inspiration from pydantic models.

Comprehensive config includes automatic config file creation and/or loading as well as complex validators for incoming configuration values.

Module

class comprehensiveconfig.json._ConfigSpecMeta(cls, name, bases, attrs, default_file: str | None = None, writer=None, create_file: bool = False, auto_load: bool = True, **kwargs)

Used to automatically load config and overwrite get/set attribute methods to allow direct access to data.

_WRITER: Type[configio.ConfigurationWriter] | None
_DEFAULT_FILE: str | None
_AUTO_LOAD: bool
_CREATE_FILE: bool
_INST: 'ConfigSpec' | None
class comprehensiveconfig.json._ConfigSpecABCMeta

Combines ABCMeta and _ConfigSpecMeta

class comprehensiveconfig.json.ConfigSpec(cls, **kwargs)

Important

Not meant to be used directly: instead subclass and pass _ConfigSpecMeta keyword arguments.

class MyConfig(ConfigSpec, writer=JsonWriter, auto_load=False, ...):
   pass # fields here
classmethod load(cls, file=None, writer=None, /) Self

Load a specified file (or load default file with default writer)

save(file=None, writer=None, /, create_file=False)

Save a specified file (or save default file with default writer). Has the option to create the file if it does exist.

reset()

Reset configuration using default values of all fields

Indices and tables