-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add version flag to qpy dump (#11644)
* Add version flag to qpy dump This commit adds a new keyword argument to the qpy.dump() function which is used to specify a compatibility version of QPY which is the latest version for the 0.45 and 0.46 version. This basically adds a compatibility mode for generating QPY files that returns a fixed QPY version that enables the 0.45 and 0.46 release to load the QPY files generated with the 1.0 release. The default output doesn't change and dump() will always return the latest QPY format version by default as this is the version that gets all the bugfixes and is kept up to date with the QuantumCircuit class. As of this commit the compatibility version and the latest version are the same, both at version 10. However, this flag is being added so that the interface exists for when we inevitably need to update the QPY version field for any release in the 1.x major version series. There are potential PRs in the 1.0 release series that will bump the latest QPY version to 11 which will change this and those PRs will need to factor this in when they change the format. * Export current and compatibility version from qiskit.qpy * Update test to use QPY_COMPATIBILITY_VERSION Co-authored-by: Will Shanks <willshanks@us.ibm.com> * Revise support policy to be a range not just min/max versions * Add attribute documentation * Remove hardcoded reference to current QPY_VERSION --------- Co-authored-by: Will Shanks <willshanks@us.ibm.com>
- Loading branch information
Showing
5 changed files
with
84 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
from qiskit.qpy import formats | ||
|
||
QPY_VERSION = 10 | ||
QPY_COMPATIBILITY_VERSION = 10 | ||
ENCODE = "utf8" | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
releasenotes/notes/add-qpy-version-flag-6bb1756e671fde55.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
features: | ||
- | | ||
Added a new flag, ``version``, to the :func:`.qpy.dump` function which | ||
optionally takes an integer value for the :ref:`qpy_format` version to | ||
emit from the dump function. This is useful if you need to generate a QPY | ||
file that will be loaded by an older version of Qiskit. However, the | ||
supported versions to emit are limited, only versions between the latest | ||
QPY version (which is the default), and the compatibility QPY version | ||
which is :ref:`qpy_version_10` (which was introduced in Qiskit 0.45.0) can | ||
be used. The compatibility version will remain fixed for the the entire | ||
1.x.y major version release series. This does not change the backwards | ||
compatibility guarantees of the QPY format when calling :func:`.qpy.load`, | ||
it just enables users to emit an older version of QPY to maintain | ||
compatibility and interoperability between the 0.x and 1.x release series. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters