XanaduAI / strawberryfields

Strawberry Fields is a full-stack Python library for designing, simulating, and optimizing continuous variable (CV) quantum optical circuits.
https://strawberryfields.ai
Apache License 2.0
754 stars 191 forks source link

Adds api_version property, adds 'Accept-Version' to headers #512

Closed brownj85 closed 3 years ago

brownj85 commented 3 years ago

Context: The Xanadu platform API will soon be implementing versioning, allowing clients to request a particular version of the API using the 'Accept-Version' HTTP header. This header will eventually be mandatory.

Description of the Change: Adds an api_version str property to Connection with the value 1.0.0. On init, adds 'Accept-Version' header to Connection._headers with the value of api_version.

Benefits: Future releases of sf will be able to use the platform API once versioning becomes mandatory. Platform will be able to support older versions of sf following breaking API changes.

Possible Drawbacks: None, beyond the established drawbacks of versioning the platform API - older releases of sf will eventually be incompatible with the platform once versioning becomes mandatory. The current (non-versioned) platform API's behavior is unchanged by the 'Accept-Version' header.

Related GitHub Issues:

codecov[bot] commented 3 years ago

Codecov Report

Merging #512 (581ee53) into master (bbae4bd) will increase coverage by 0.00%. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #512   +/-   ##
=======================================
  Coverage   97.85%   97.85%           
=======================================
  Files          71       71           
  Lines        7406     7409    +3     
=======================================
+ Hits         7247     7250    +3     
  Misses        159      159           
Impacted Files Coverage Δ
strawberryfields/api/connection.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update bbae4bd...581ee53. Read the comment docs.