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()[source]

Get a path to the config file on this machine.

Return type:

Path

pytket.config.load_config_file()[source]

Load config from default file path.

Return type:

PytketConfig

pytket.config.write_config_file(config)[source]

Write config to default file path.

Return type:

None

class pytket.config.pytket_config.PytketConfig(extensions=None)[source]

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

__init__(extensions=None)[source]

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()[source]

Construct a default PytketConfig

Return type:

PytketConfig

classmethod read_file(config_file_path)[source]

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

Return type:

PytketConfig

write_file(config_file_path)[source]

Write a PytketConfig to a file with a given Path.

Return type:

None

class pytket.config.pytket_config.PytketExtConfig[source]

Abstract base class for pytket extension config classes.

__init__()
classmethod from_default_config_file()[source]

Load from default config file.

Return type:

TypeVar(T, bound= PytketExtConfig)

abstract classmethod from_extension_dict(ext_dict)[source]

Abstract method to build PytketExtConfig from dictionary serialized form.

Return type:

TypeVar(T, bound= PytketExtConfig)

classmethod from_pytketconfig(p_config)[source]

Build from PytketConfig instance.

Return type:

TypeVar(T, bound= PytketExtConfig)

to_dict()[source]

Serialize to dictionary.

Return type:

dict[str, Any]

update_default_config_file()[source]

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

Return type:

None

update_pytket_config(pytket_config)[source]

Update a PytketConfig instance from this extension config.

Return type:

None