Release Notes#
0.13.1#
New Features#
Configuration constants like default region and default API endpoints are now available in a new module
dwave.cloud.config.constants
.Configuration-related exceptions are now available in a new module
dwave.cloud.config.exceptions
.dwave.cloud.config
module (with submodules) is now free from dependencies on other submodules, and it’s safe to be imported in any cloud-client context.
Deprecation Notes#
Use of
dwave.cloud.api.constants
to access default configuration constants is deprecated indwave-cloud-client==0.13.1
in favor of a new config moduledwave.cloud.config.constants
, and will be disabled indwave-cloud-client==0.14.0
.
Bug Fixes#
Fix a circular import error. See #669.
0.13.0#
New Features#
Enable QPU problem data compression on upload using
deflate
content encoding.Compression is controlled with a new config option,
compress_qpu_problem_data
, defaulting to true, and it can be turned off either in config file or viaClient()
kwarg.
Add long polling as problem status/answer polling strategy.
We add the following config options:
poll_strategy
("backoff"
is the current default,"long-polling"
is the new strategy),poll_wait_time
, andpoll_pause
.
Add
timeout
keyword argument toapi.resources.Problems.get_problem_status()
andapi.resources.Problems.get_problem_statuses()
methods.Use it to enable long polling on problem status API endpoint. The connection is closed (server-side) when at least one problem completes, or the
timeout
(in seconds) elapses, whatever comes first.
Add support for retrieving filtered solver configuration to
dwave.cloud.api.resources.Solvers
methods.
Add API response caching support to
dwave.cloud.api
interface. Cache is validated using a conditional request based onETag
.
Poll for problem-status update using long-polling strategy by default.
Long-polling strategy enables faster status-change propagation to the client, especially for longer jobs, or during heavy QPU usage.
Speed-up function calls that dispatch events by short-circuiting the dispatch in case no event handlers are registered.
Add
timeout
keyword argument toapi.resources.Problems.get_problem()
method.Use it to enable long polling on problem fetch API endpoint. The connection is closed (server-side) when the problem completes, or the
timeout
(in seconds) elapses, whatever comes first. In case problem completed in time, problem answer is returned in addition to problem status (which is always returned).
Enable regions metadata API cache control in
dwave.cloud.regions.get_regions()
by switching toapi.Regions
built-in caching session. See #647.
Speed-up JSON encoding and decoding by switching to
orjson
. See #423
Parse
Cache-Control
header field if present in API response, and use it to guide local caching policy.This means
dwave.cloud.api.DWaveAPIClient
anddwave.cloud.api.resource
classes now respect origin server response caching policy. See #646.
Cache solver metadata on disk, using conditional requests for cache validation (update).
Static and dynamic parts of solver metadata are fetched and stored separately, to enable efficient caching.
See #613.
Lazily import
Client
/Solver
/Future
in the top-level namespace,dwave.cloud
. Direct imports are preferred, e.g.from dwave.cloud.client import Client
, but the widely-used way (from dwave.cloud import Client
) is still supported for backwards compatibility.Similarly we now lazily import old namespaces with client type as submodule, e.g.
dwave.cloud.qpu
.The main benefit of such lazy imports is import performance, as “heavy” symbols are only imported when explicitly needed/asked for.
Speed-up imports by slightly decoupling submodules.
Speed-up
dwave.cloud.utils.qubo.active_qubits
utility function by ~50%, anddwave.cloud.coders.encode_problem_as_qp
by 20-30%.
Speed-up QPU problem sampling when problem submitted as BQM by 40%. For best performance, keep linear and quadratic biases in ``dict``s.
Cache dynamic solver metadata for up to 15 minutes, unless defined differently by API cache control response header.
Upgrade Notes#
Short polling with exponential backoff is not used by default anymore, but it is still available. If for some reason you want to use it, set:
poll_strategy = backoff
configuration parameter in your config file, or the keyword argument in calls to
Client()
orClient.from_config()
.
Config attributes previously available directly on
Client
instance, deprecated indwave-cloud-client==0.11.0
, are removed indwave-cloud-client==0.13.0
.Use config model (
dwave.cloud.config.models.ClientConfig
) available asClient.config
to access client configuration instead.Path to most attributes translates directly. For example,
Client.region
is now available asClient.config.region
. One attribute has been renamed (Client.default_solver
is nowClient.config.solver
), and allClient.poll_*
config options are consolidated underClient.config.polling_schedule.*
. SimilarlyClient.http_retry_*
options are now available underClient.config.request_retry.*
.
Deprecation Notes#
dwave.cloud.utils.coders.NumpyEncoder
is deprecated and will be removed indwave-cloud-client==0.14.0
. Useorjson.dumps()
withOPT_SERIALIZE_NUMPY
option instead.
Shorthand import paths for specialized Clients (for
qpu
,sw
andhybrid
) are deprecated indwave-cloud-client==0.12.2
and will be removed indwave-cloud-client==0.14.0
. Instead, use the full import path, e.g.from dwave.cloud.client.qpu import Client
, instead offrom dwave.cloud.qpu import Client
.
Bug Fixes#
Defer SQLite connect in
@cached.ondisk()
until actually needed. Also, verify cache thread/process-safety and forking support.
Fix
get_cache_dir()
to not create the cache directory by default. Creation is now optional and controlled withcreate
argument. This makes it consistent with other config path functions.
Fix possible race condition during cache directory create. See homebase#37.
During solver metadata filtering, treat solver
status
as a dynamic field. This is to handle an edge case when solver is markedoffline
, but it’s still available via API.
0.12.1#
New Features#
Add some basic benchmarks (use airspeed velocity/asv).
Add
dwave.cloud.testing.mocks.hybrid_cqm_solver_data()
, a mock metadata generator for the CQM hybrid solver.
Add
dwave.cloud.coders.decode_qp_problem
, a decoder of quadratic unconstrained binary problems in SAPI’s"qp"
format.
Add
qpu_zephyr_solver_data
generator for mock QPU solvers with Zephyr topology.
Bug Fixes#
Update
dwave.cloud.testing.mocks.hybrid_*_solver_data()
generators to include the full list of solver properties (albeit with mock/dummy values).
Fix a regression bug introduced during utils module refactor and keep using
importlib_metadata
forentry_points()
access. See #631.
0.12.0#
Upgrade Notes#
dwave.cloud.utils
module has been split into the following submodules:dwave.cloud.utils.cli
,dwave.cloud.utils.coders
,dwave.cloud.utils.decorators
,dwave.cloud.utils.dist
,dwave.cloud.utils.exception
,dwave.cloud.utils.http
,dwave.cloud.utils.logging
,dwave.cloud.utils.qubo
, anddwave.cloud.utils.time
.First reason for doing this was code clean-up (including adding type annotations), but a more important reason is that this will enable import time optimization in the future. And that’s why we break backwards compatibility by not importing everything back into the top-level utils namespace.
The utils module is considered Ocean-internal as is, so this move shouldn’t affect user’s code.
Positional arguments in
dwave.cloud.Client
constructor, deprecated in 0.10.0, are removed in 0.12.0. Use keyword arguments instead.
Alias keys
samples
andoccurrences
(forsolutions
andnum_occurrences
) in the results dict ofdwave.cloud.computation.Future.result()
, deprecated in 0.8.0, are now finally removed in 0.12.0. We’ll try to keep the result dict as close to raw data returned by SAPI as possible. Postprocessed data is instead available viadwave.cloud.computation.Future
properties.
0.12.0.dev0#
New Features#
Add support for
binary-ref
answer encoding format, where answer data is not immediately present in the answer, but on an URI referenced in the answer response.
Add
dwave.cloud.computation.Future.answer_data
property to hold the answer data of a resolved future. A call to.answer_data
will block until computation future is resolved.
Add
dwave.cloud.api.models.UnstructuredProblemAnswerBinaryRef
model, a subclass ofProblemAnswer
forbinary-ref
answers, and a method for downloading answer data (resolving binary-ref),dwave.cloud.api.resources.Problems.get_answer_data
.
Add support for nonlinear unstructured solvers with
dwave.cloud.solver.NLSolver
.
Add request/response logging to
AuthFlow
/OAuth2Session
.
Add basic support for structured logs (JSON output).
Enable log format control with
DWAVE_LOG_FORMAT
env variable (set to"json"
for structured output.
Bug Fixes#
Fix a possible race condition when multiple threads try to resolve remote computation results. A special case of this occurs on binary answer download from a reference link. See #624.
Log failing request/response details in the low-level API client.
Suppress logging output from the cloud-client by default (as recommended for libraries).
Format log record date/time according to ISO 8601.
0.11.4#
New Features#
Add
revoke_token
method todwave.cloud.auth.flow.AuthFlow
to enable revocation of OAuth 2.0 refresh/access tokens. See #600.
Add
dwave auth revoke
CLI command to enable revocation of OAuth 2.0 refresh/access tokens from command line. See #600.
0.11.3#
Bug Fixes#
Use fixed authorization success URL, without any authorization query parameters appended (to minimize exposure), as they are not needed on the authorization server’s success page.
Improve CSRF protection on localhost redirect URI during authorization code exchange. Previously,
state
was verified only if supplied. Now it’s mandatory. Please note this is an additional CSRF protection on top of the PKCE, just in case PKCE is not supported (or properly implemented) server-side.
Fix PKCE support in
dwave.cloud.auth.flow.AuthFlow
by properly includingcode_verifier
in fetch token (code exchange) requests. See #605.
Remove circular references in
dwave.cloud.computation.Future
to enable easier garbage collection and lower memory footprint. See #601.
Use a consistent
User-Agent
value for all API and non-API requests made byClient
,api.Client
andauth.flow
client.
Speed-up
User-Agent
string construction significantly (10ms to 5us).
0.11.2#
New Features#
Add Python 3.12 support.
Add
dwave.cloud.utils.get_distribution
as a replacement forpkg_resources.get_distribution
unavailable in Python 3.12.
0.11.1#
New Features#
Add optional Leap authorization step to
dwave setup
CLI. During setup, we now install optional contributed packages, authorize Ocean to access Leap (--auth
and--oob
flags), and finally create the configuration file, optionally retrieving SAPI token from Leap API (if authorized) for the currently active Leap project, or project specified with--project
option. See #591.
Add
--skip-valid
option todwave auth login
CLI. When used, authorization flow will be skipped if Leap access token is valid or if it can be refreshed.
Prefer QPU solvers in
dwave ping
, unless overridden by user/config. See #592
Redirect user back to a Leap info page when auth redirect flow successfully completes. Similarly, redirect user to a Leap error page in case of an auth error.
0.11.0.dev0#
New Features#
Add Leap authorization-related group of CLI commands under
dwave auth
:login
,get <token-type>
,refresh
. See #565.
Add Leap project CLI commands under new
dwave leap project
group:ls
,token
.
Add
--auto
option todwave config create
to attempt SAPI token fetch from Leap API on configuration file create (if access already authorized withdwave auth login
).
For OAuth 2.0 Authorization Code exchange flow, add support for both the redirect flow and the out-of-band flow. See #564.
Add a general-purpose, multi-threaded, WSGI application server,
dwave.cloud.auth.server.BackgroundAppServer
. This server can handle redirect URIs in the OAuth2 authorization code flow. See #563.
Add
dwave.cloud.auth.server.SingleRequestAppServer
based ondwave.cloud.auth.server.BackgroundAppServer
to specifically handle only one (valid) request to the OAuth redirect URI (and self-terminate after that).
Add
dwave.cloud.auth.creds.Credentials
, an on-disk credentials store. See #562.
Add configuration options for defining Leap API endpoint:
leap_api_endpoint
option in configuration file or as keyword argument, andDWAVE_LEAP_API_ENDPOINT
environment variable. See #569.
Add a configuration option for setting Leap OAuth 2.0 Ocean client id,
leap_client_id
. Primarily used for testing.
Add OAuth 2.0 Authorization Code exchange flow to enable users to authorize Ocean SDK to access Leap API on their behalf. See #564.
Add wall time and QPU timing to
dwave sample
output. See #570.
Add a per-call cached value maximum age (
maxage_
) for functions decorated with@cached
.
Allow specifying cache key explicitly, instead of using all arguments of a function decorated with
@cached
.
Add cache bypass control via
disable()
andenable()
on the decorated function.
Add
@cached.disabled
context manager (and a function decorator) that temporarily disables cache within the context (i.e. the decorated function). See #503.
Add
leap_api_endpoint
andsolver_api_endpoint
properties todwave.cloud.api.models.Region
.
Move
dwave.cloud.Client.get_regions
todwave.cloud.regions.get_regions
in a newregions
submodule, and refactor for flexibility of use and better caching control. See #577.
Add endpoints-from-region resolver,
dwave.cloud.regions.resolve_endpoints
. Previously, similar resolver was part of theClient
class.
Add
--clique-size
/--size
/-k
options todwave sample
CLI command to help specify problem size (clique size) for random problems generated for unstructured solvers.
Add Pydantic-based data model for cloud-client configuration,
dwave.cloud.config.models.ClientConfig
.
Consolidate client runtime configuration options under
Client.config
, a data model defined withdwave.cloud.config.models.ClientConfig
and decouple config parsing fromdwave.cloud.Client
construction. See #504.
Add
from_config()
family of factories todwave.cloud.api.client.DWaveAPIClient
and subclasses for SolverAPI, MetadataAPI and LeapAPI.from_config()
dispatches tofrom_config_model()
orfrom_config_file()
, depending on arguments. See #572.
Use full client config for Metadata API access during region/endpoint resolution on
dwave.cloud.Client
construction. See #505.
Add support for specifying connection read timeout separately from connect timeout. Previously, both read and connect timeouts were set to the same value, specified with the
request_timeout
configuration parameter. We now accept a(read, connect)
tuple for therequest_timeout
parameter. See #440.
Add
--project
option todwave config create
, to be used in conjunction with--auto
/--auto-token
.When project is not specified, the configuration file is initialized with a SAPI token for the currently active Leap project.
Project can be specified via project name, code or ID.
Upgrade
dwave.cloud.api.models.*
to use Pydantic v2. See #555.
Upgrade Notes#
Upgrade your python to 3.8+. We no longer support python 3.7 and below.
Method
from_client_config()
is removed fromdwave.cloud.api.resources.ResourceBase
, (affecting instantiation of its subclasses), in favor of a new methodfrom_config_model()
(or alternatively, a more generalfrom_config()
). Previously an instance of eitherdwave.cloud.Client
ordwave.cloud.api.DWaveAPIClient
was required, and now it’s possible to use just the configuration, adwave.cloud.config.models.ClientConfig
object.To upgrade, replace
{ResourceBase}.from_client_config(cloud_client)
with{ResourceBase}.from_config_model(client.config)
, and{ResourceBase}.from_client_config(dwave_api_client)
with{ResourceBase}(dwave_api_client)
.
@dwave.cloud.utils.cached
parametercache
has been renamed tostore
.
API models now coerce Numpy types to Python types on validation (model instantiation), instead of holding
typing.Any
until serialization.
Disk cache serialization changed from Python pickle to JSON. Currently, disk cache is used only for the list of Leap regions fetched from the Metadata API on
dwave.cloud.Client
instantiation. Upgrade should be seamless, as a new on-disk cache database file is created for each dwave-cloud-client version.
Deprecation Notes#
Client method
get_regions
is deprecated in favor ofdwave.cloud.regions.get_regions
.
Individual config options exposed as
dwave.cloud.Client
attributes are deprecated sincedwave-cloud-client==0.11.0
and will be removed indwave-cloud-client==0.12.0
. UseClient.config
data model instead.
Bug Fixes#
Fix
@cached
instances isolation when using a shared storage (e.g. disk cache), viabucket
argument (cache key prefix).
Fix random problem sampling on hybrid solvers via
dwave sample
CLI. See #557.
Fix region/endpoint resolution during
dwave.cloud.Client
construction when insecure connection is required (config:permissive_ssl = On
) and/or a proxy is used (config:proxy = socks5://...
). Previously client construction would fail completely. See #507.
Correctly set backoff_max time for retried requests when
urllib3>=2.0
is used. See #566.
0.10.6#
New Features#
Add basic support for Leap API access with
dwave.cloud.api.client.LeapAPIClient
anddwave.cloud.api.resources.LeapAccount
.
Filter out more formats of API token-like strings from logs. In addition to the Solver API tokens, we now filter generic 32-char+ hex tokens (Leap API access token format), and UUID tokens (all variants). See #551.
Bug Fixes#
Constrain
pydantic
version, as V2 introduces major backwards incompatible changes.
0.10.5#
New Features#
Add
strict_mode
support toVersionedAPISession
. Strict mode is now the default, implying API requests will fail if type/version is expected and the response doesn’t include it.
Add
version_strict_mode
config option toDWaveAPIClient
. It corresponds to underlying session’s (VersionedAPISession
)strict_mode
.
Add
VersionedAPISession
, arequests.Session
subclass (more precisely, further specializedLoggingSession
) that enforces conformance of API response version with supported version range(s).
Add
accepts
decorator for declaring accepted media type and response format version (range) ondwave.cloud.api.Resource
methods.
Simplify
dwave.cloud.api.resource.accepts
interface (require onlymedia_type
andversion
), but retain flexibility (pass all keyword arguments toVersionedAPISession.set_accept
).
Support
strict_mode
control of API response type validation via@accepts
interface.
Upgrade Notes#
Response type version is now always required (regardless of
strict_mode
) if type is expected and received, and version is expected.
Enforce D-Wave API response format version on all
cloud.api
resources.
Bug Fixes#
Fix
dwave.cloud.api.resources.accepts
to allow for partial decoration ofResource
methods. See #544.
0.10.4#
New Features#
Add Python 3.11 support
Add dimod 0.12.x support
Add numpy 1.24.x support
0.10.3#
New Features#
Add support for NumPy scalars used as problem parameter values.
0.10.2#
New Features#
Added
estimate_qpu_access_time
method todwave.cloud.solver.StructuredSolver
to estimate quantum processing unit (QPU) access time for a submission to the selected solver.
0.10.1#
Bug Fixes#
Previously it was possible for mutually exclusive config options, if all specified on the same level, and depending on the order used, to not be correctly combined with options from a lower level. See #524, now fixed.
0.10.0#
New Features#
Add
poll_backoff_base
configuration option to control the exponential base of the (problem status) polling schedule. Available as a config file option anddwave.cloud.Client
keyword argument.
Upgrade Notes#
Make polling schedule denser in the beginning (by lowering the exponential base from
2
to1.3
), thus enabling much faster answer download for SAPI response times under two minutes.
Remove
Client.solvers()
method in favor ofClient.get_solvers()
. It was previously deprecated indwave-cloud-client==0.5.0
.
Remove
dwave.cloud.computation.Future.error
property in favor ofdwave.cloud.computation.future.exception()
method. The property was previously deprecated indwave-cloud-client==0.7.3
.
Remove
dwave.cloud.computation.Future.{eta_min,eta_max}
. These properties were previously deprecated indwave-cloud-client==0.8.5
when the underlying SAPI feature/field was removed.
Remove
dwave.cloud.computation.Future.occurrences
alias in favor ofdwave.cloud.computation.Future.num_occurrences
property. The alias was previously deprecated indwave-cloud-client==0.8.0
.
CLI: use of
-c
for--config-file
has been deprecated sincedwave-cloud-client==0.8.5
in favor of-f
, and the option is now removed in 0.10.0. Use--config-file
or-f
instead.
Remove support for dimod 0.8.x. Upgrade dimod to 0.9.0+.
Upgrade your python to 3.7+. We no longer support python 3.6 and below.
Deprecation Notes#
Alias keys (
samples
andoccurrences
) indwave.cloud.computation.Future.result()
-returned dictionary are deprecated sincedwave-cloud-client==0.8.0
and will be removed indwave-cloud-client==0.12.0
.
Positional arguments to
dwave.cloud.Client
constructor are deprecated sincedwave-cloud-client==0.10.0
and will be removed indwave-cloud-client==0.12.0
. Use keywords arguments instead.
0.9.5#
Bug Fixes#
Preemptively resolve sampling answer during dwave ping and dwave sample, as to capture and properly output/format eventual errors. See #517.
0.9.4#
New Features#
Add
StructuredSolver.reformat_parameters()
method. This method can be used to format solver parameters for SAPI. See #465.
Support
dimod<0.13.0
Bug Fixes#
0.9.3#
New Features#
Add Python 3.10 support.
Add
--json
output option todwave sample
.
Add
--sampling-params
option todwave sample
.--num-reads
has been kept, and it now overwrites value given in sampling params.
Add
--label
option todwave ping
anddwave sample
, with a default value set. See #481.
Add
--full
option todwave setup
, propagated todwave config create
. Clarifieddwave setup
operation in CLI help.
Filter out API token-like strings from logs. Most notably, we make sure to redact Solver API tokens, but will filter out any prefixed hex token. See #391.
Bug Fixes#
Improved error and output handling in
dwave sample
. See #300.
0.9.2#
New Features#
Added Metadata API client,
Regions
model and API resource.
Added multi-region support to
dwave.cloud.Client
.New config option for region selection is called
region
, and environment variable is calledDWAVE_API_REGION
.New config option for specifying Metadata API endpoint URL is exposed as
metadata_api_endpoint
andDWAVE_METADATA_API_ENDPOINT
.List of available regions available with
dwave.cloud.Client.get_regions
.
Add context manager protocol support to
dwave.cloud.api.client.DWaveAPIClient
to ensure resources are easily cleaned up (session closed). Note thatclose()
method is available for cases when context manager pattern is inconvenient.Similarly, we add
close()
method to resources indwave.cloud.api.resource.*
, in addition to the existing context manager protocol support.
Add
--region
and--endpoint
options to the relevantdwave
CLI subcommands:ping
,solvers
,sample
,upload
.
Upgrade Notes#
To access solvers in a non-default region (na-west-1), you can use the
region
config option andDWAVE_API_REGION
environment variable.
dwave.cloud.config.load_config
used to return some minimal (but arbitrary) set of always-set options (set toNone
if undefined). Now it returns just the options set either in config file, environment, or kwargs.
Bug Fixes#
Fix
dwave.cloud.api.constants.ProblemType
enumeration to include the CQM problem type.
0.9.1#
New Features#
Add Leap hybrid CQM solvers support.
Upgrade Notes#
Sampling on structured solvers of problems with incompatible graph/structure now fails with
ProblemStructureError
.
Bug Fixes#
Make
StructuredSolver.check_problem
faster (15-20%). See #487.
0.9.0#
New Features#
Default
dwave config create
configuration flow is now simplified to prompt only for essential parameters (at the moment that’s onlytoken
).Interactive configuration of an extended set of non-essential parameters (i.e. the previous default) is now available via a new flag:
--full
.See #304
Upgrade Notes#
To configure non-essential parameters such as
endpoint
,client
andsolver
, configuration create command now has to be called with the--full
option:dwave config create --full
Bug Fixes#
When a path to a nonexistent config file is provided to
dwave config create
, we’ll now happily create that file, instead of failing.
0.9.0.dev0#
Prelude#
We began using Reno as a changelog tool after the release of 0.8.7. Content added before that release is not included. See releases for previous release notes.
New Features#
A low-level
dwave.cloud.api.client
added to abstract SAPI communication details (like authentication, response decoding, error handling, retries, etc).
All SAPI requests and responses modelled in
dwave.cloud.api.models.*
. These models are used for data validation and representation.
Added model-level interfaces to SAPI resources (in a REST sense),
dwave.cloud.api.resources.Solvers
anddwave.cloud.api.resources.Problems
.
Added mock solver data generators.
New layer of exceptions added in
dwave.cloud.api.exceptions
. Base exceptionRequestError
subclassesrequests
’s exception and includes raw.response
object, along with.error_msg
and.error_code
returned by SAPI.
Begin using reno for changelog.
Upgrade Notes#
SAPIError
exception is now just an alias fordwave.cloud.api.exceptions.RequestError
.
dwave.cloud.client
module is now a namespace containing all client subclasses as submodules. You should update your imports accordingly:dwave.cloud.Client --> dwave.cloud.client.base.Client dwave.cloud.hybrid.Client --> dwave.cloud.client.hybrid.Client dwave.cloud.qpu.Client --> dwave.cloud.client.qpu.Client dwave.cloud.sw.Client --> dwave.cloud.client.sw.Client
For backwards compatibility, old import paths still work, but are deprecated.
Deprecation Notes#
Import paths
dwave.cloud.{hybrid,qpu,sw}.Client
are deprecated and should be replaced withdwave.cloud.client.{hybrid,qpu,sw}.Client
.
Bug Fixes#
Configured client session creation is sped up by caching user-agent construction (per client). Client session is now created ~200x faster, making it on par with
requests.Session
creation time (~50us).
Avoid character encoding / charset guessing for speed and stability.