pytket.config#

The config module defines a userspace pytket configuration. The configuration is saved to and loaded from file.

pytket.config.get_config_file_path() pathlib.Path#

Get a path to the config file on this machine.

pytket.config.load_config_file() pytket.config.pytket_config.PytketConfig#

Load config from default file path.

pytket.config.write_config_file(config: pytket.config.pytket_config.PytketConfig) None#

Write config to default file path.

class pytket.config.pytket_config.PytketConfig(extensions: Optional[Dict[str, Any]] = None)#

PytketConfig represents a loaded config file for pytket and extension packages.

__init__(extensions: Optional[Dict[str, Any]] = None) None#

Construct a PytketConfig object with inital config parameter values.

Parameters

extensions (Optional[Dict[str, Any]], optional) – Dictionary holding parameter values for extension packages, defaults to None

classmethod default() pytket.config.pytket_config.PytketConfig#

Construct a default PytketConfig

classmethod read_file(config_file_path: pathlib.Path) pytket.config.pytket_config.PytketConfig#

Construct a PytketConfig from reading a file with a given Path.

write_file(config_file_path: pathlib.Path) None#

Write a PytketConfig to a file with a given Path.

class pytket.config.pytket_config.PytketExtConfig#

Abstract base class for pytket extension config classes.

__init__() None#
classmethod from_default_config_file() pytket.config.pytket_config.T_ext#

Load from default config file.

abstract classmethod from_extension_dict(ext_dict: Dict[str, Any]) pytket.config.pytket_config.T_ext#

Abstract method to build PytketExtConfig from dictionary serialized form.

classmethod from_pytketconfig(p_config: pytket.config.pytket_config.PytketConfig) pytket.config.pytket_config.T_ext#

Build from PytketConfig instance.

to_dict() Dict[str, Any]#

Serialize to dictionary.

update_default_config_file() None#

Update default config file with current parameters in this extension config.

update_pytket_config(pytket_config: pytket.config.pytket_config.PytketConfig) None#

Update a PytketConfig instance from this extension config.