ConfigManager

class ConfigManager

Helper class to handle vpype’s TOML configuration files.

This class is typically used via its singleton instance CONFIG_MANAGER:

>>> from vpype import CONFIG_MANAGER
>>> my_config = CONFIG_MANAGER.config.get("my_config", None)

Helper methods are provided for specific aspects of configuration, such as command-specific configs or HPGL-related configs.

By default, built-in configuration packaged with vpype are loaded at startup. If a file exists at path ~/.vpype.toml, it will be loaded as well. Additionaly files may be loaded using the load_config_file() method.

Methods

__init__

Initialize self.

get_command_config

Returns the configuration for command name.

get_plotter_config

Returns a PlotterConfig instance for plotter name.

get_plotter_list

Returns a list of plotter names whose configuration is available.

load_config_file

Load a config file and add its content to the configuration database.

Attributes

config

rtype

Dict[str, Any]

Methods

ConfigManager.__init__()

Initialize self. See help(type(self)) for accurate signature.

ConfigManager.get_command_config(name)

Returns the configuration for command name.

Parameters

name (str) -- name of the command

Return type

Dict[str, Any]

Returns

dictionary containing the config values (empty if none defined)

ConfigManager.get_plotter_config(name)

Returns a PlotterConfig instance for plotter name.

Parameters

name (Optional[str]) -- name of desired plotter (may be None, in which case None is returned)

Return type

Optional[PlotterConfig]

Returns

PlotterConfig instance or None if not found

ConfigManager.get_plotter_list()

Returns a list of plotter names whose configuration is available.

Return type

List[str]

Returns

list of plotter name

ConfigManager.load_config_file(path)

Load a config file and add its content to the configuration database. The configuration file must be in TOML format.

Parameters

path (str) -- path of the config file

Return type

None

Attributes

ConfigManager.config
Return type

Dict[str, Any]