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

pytket.config.get_config_file_path() Path[source]#

Get a path to the config file on this machine.

pytket.config.load_config_file() PytketConfig[source]#

Load config from default file path.

pytket.config.write_config_file(config: PytketConfig) None[source]#

Write config to default file path.

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

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

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

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[source]#

Construct a default PytketConfig

classmethod read_file(config_file_path: Path) PytketConfig[source]#

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

write_file(config_file_path: Path) None[source]#

Write a PytketConfig to a file with a given Path.

class pytket.config.pytket_config.PytketExtConfig[source]#

Abstract base class for pytket extension config classes.

__init__() None#
classmethod from_default_config_file() T[source]#

Load from default config file.

abstract classmethod from_extension_dict(ext_dict: Dict[str, Any]) T[source]#

Abstract method to build PytketExtConfig from dictionary serialized form.

classmethod from_pytketconfig(p_config: PytketConfig) T[source]#

Build from PytketConfig instance.

to_dict() Dict[str, Any][source]#

Serialize to dictionary.

update_default_config_file() None[source]#

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

update_pytket_config(pytket_config: PytketConfig) None[source]#

Update a PytketConfig instance from this extension config.