Releases: dwavesystems/dwave-cloud-client
0.13.2
New Features
- Add Python 3.13 support.
- Add
--raw
output mode to get-token CLI commands. See #598.
Upgrade Notes
- Remove support for dimod 0.9.x. Upgrade dimod to 0.10.0+. See #595.
- Upgrade your python to 3.9+. We no longer support python 3.8 and below.
Deprecation Notes
- Client utility function
dwave.cloud.coders.bqm_as_file()
is deprecated in favor ofdimod.BQM.to_file()
(available in dimod 0.10.0+) and will be removed in dwave-cloud-client 0.15.0.
Bug Fixes
- Update sample set creation in
dwave.cloud.computation.Future
to support dimod 0.12.18+. Previously,wait_id()
method used to be added to thefrom_future
-created sample sets in the cloud-client, and now theSampleSet
interface propagateswait_id
from the future by default. See dimod#1392 and dwave-system#540.
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. See #622.
-
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
. See #648.
-
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. See #649.
- Add support for retrieving filtered solver configuration to
dwave.cloud.api.resources.Solvers
methods. See #644.
- Add API response caching support to
dwave.cloud.api
interface. Cache is validated using a conditional request based onETag
. See #645.
-
Poll for problem-status update using long-polling strategy by default. See #662.
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. See #660.
-
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). See #657.
- 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. See #643.
- Speed-up imports by slightly decoupling submodules. See #643.
- Speed-up
dwave.cloud.utils.qubo.active_qubits
utility function by ~50%, anddwave.cloud.coders.encode_problem_as_qp
by 20-30%. See #661.
- Speed-up QPU problem sampling when problem submitted as BQM by 40%. For best performance, keep linear and quadratic biases in
dict
s. See #661.
- Cache dynamic solver metadata for up to 15 minutes, unless defined differently by API cache control response header. See #663.
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()
. See #662.
-
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.*
. See #664.
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. See #652.
- 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
. See #643.
Bug Fixes
- Defer SQLite connect in
@cached.ondisk()
until actually needed. Also, verify cache thread/process-safety and forking support. See #642.
- 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. See #642.
- Fix possible race condition during cache directory create. See homebase#37, #642.
- 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. See #663.
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.
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.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.
Bug Fixes
- Set correct lower bounds for requests/urllib3, and preemptively set upper bounds on other dependencies to prevent future breaks. See #612.
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
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.