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

pytket.config.get_config_file_path() Path

Get a path to the config file on this machine.

pytket.config.load_config_file() PytketConfig

Load config from default file path.

pytket.config.write_config_file(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.


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

classmethod default() PytketConfig

Construct a default PytketConfig

classmethod read_file(config_file_path: Path) PytketConfig

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

write_file(config_file_path: 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.

classmethod from_default_config_file() T_ext

Load from default config file.

abstract classmethod from_extension_dict(ext_dict: Dict[str, Any]) T_ext

Abstract method to build PytketExtConfig from dictionary serialized form.

classmethod from_pytketconfig(p_config: PytketConfig) 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: PytketConfig) None

Update a PytketConfig instance from this extension config.