dwave.cloud.client.Client.from_config#
- classmethod Client.from_config(config_file=None, profile=None, client=None, **kwargs)[source]#
Client factory method to instantiate a client instance from configuration.
Configuration values can be specified in multiple ways, ranked in the following order (with 1 the highest ranked):
Values specified as keyword arguments in
from_config()
Values specified as environment variables
Values specified in the configuration file
Values specified as
Client
instance defaultsValues specified in
Client
classClient.DEFAULTS
Configuration-file format and environment variables are described in
dwave.cloud.config
.File/environment configuration loading mechanism is described in
load_config()
.- Parameters:
config_file (str/[str]/None/False/True, default=None) – Path to configuration file. For interpretation, see
load_config()
.profile (str, default=None) – Profile name. For interpretation, see
load_config()
.client (str, default=None) – Client type used for accessing the API. Supported values are
qpu
fordwave.cloud.qpu.Client
,sw
fordwave.cloud.sw.Client
andhybrid
fordwave.cloud.hybrid.Client
.
- Returns:
Appropriate instance of a QPU/software/hybrid client.
- Return type:
Client
subclass- Raises:
ConfigFileReadError – Config file specified or detected could not be opened or read.
ConfigFileParseError – Config file parse failed.
ValueError – Invalid (non-existing) profile name.