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

get_command_config

Returns the configuration for command name.

get_plotter_config

Returns a PlotterConfig instance for plotter device.

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

Methods#

ConfigManager.get_command_config(name: str) dict[str, Any]#

Returns the configuration for command name.

Parameters:

name (str) -- name of the command

Returns:

dictionary containing the config values (empty if none defined)

Return type:

dict[str, Any]

ConfigManager.get_plotter_config(device: str | None) PlotterConfig | None#

Returns a PlotterConfig instance for plotter device.

If None is passed, this function attempts to use the default device if one is configured, or the function returns None.

Parameters:

device (str | None) -- name of desired plotter (or None to use the default device if configured)

Returns:

PlotterConfig instance or None if not found

Return type:

PlotterConfig | None

ConfigManager.get_plotter_list() list[str]#

Returns a list of plotter names whose configuration is available.

Returns:

list of plotter name

Return type:

list[str]

ConfigManager.load_config_file(path: str) None#

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#