-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add QPY module #250
Merged
rathishcholarajan
merged 5 commits into
Qiskit:main
from
rathishcholarajan:147-copy-qpy-module
Apr 1, 2022
Merged
Add QPY module #250
rathishcholarajan
merged 5 commits into
Qiskit:main
from
rathishcholarajan:147-copy-qpy-module
Apr 1, 2022
Commits on Feb 23, 2022
-
Move QPY serializer to own module (#7582)
* Move qpy to own module. qpy_serialization.py is splint into several files for maintenability. This commit also adds several bytes Enum classes for type keys in the header, and provides several helper functions. Some namedtuple class names are updated because, for example, INSTRUCTION will be vague when we add schedule, i.e. it's basically different program and has own instruction that has different data format. Basically CIRCUIT_ prefix is added to them. * manually cherry-pick #7584 with some cleanup - change qiskit.qpy.objects -> qiskit.qpy.binary_io - TUPLE -> SEQUENCE (we may use this for list in future) - add QpyError - add _write_register in circuit io to remove boilerplate code * respond to review comments - expose several private methods for backward compatibility - use options for symengine - rename alphanumeric -> value - rename write, read methods and remove alias - improve container read * remove import warning * replace alphanumeric with value in comments and messages. * private functions import Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for 22637ce - Browse repository at this point
Copy the full SHA 22637ceView commit details
Commits on Mar 11, 2022
-
Add support for custom metadata serializers to QPY load() and dump() …
…(#7550) * Add support for custom metadata serializers to QPY load() and dump() This commit adds a new argument to load(), metadata_serializer, and dump(), metadata_deserializer, which is used to specify custom serialization functions to use for serializing the python dictionary for each circuit's metadata attribute. By default QPY expects the serialized metadata payload to be encoded as a utf8 json string. But since there are no user constraints on the metadata dictionary's contents a simple json.dump() of the circuit's metadata attribute may not be feasible. To address this issue these new arguments are added to enable users to specify a custom function to encode the dictionary as binary data however is required for their circuit's metadata and then read that custom format as required when deserializing. The QPY format specification does not change here and still explicitly lists a UTF8 encoded JSON string as the contents. A fixed format is needed in the format specification for potential interoperability for other tools generating QPY data (none exist currently to my knowledge but nothing precludes it which is why the format is publicly documented). These new arguments are specific to only the qiskit implementation and should only be used when generating qpy files and loading them via qiskit. * Pivot to use JSONEncoder and JSONDecoder classes for new argument This commit pivots to leveraging custom JSONEncoder and JSONDecoder classes for the optional serializer and deserializer arguments instead of custom callables that return bytes. In the previous commit we used callables that would be passed the dictionary and returned bytes. However, while this was flexible it was pretty easy for a user to create QPY out of spec. While this was documented it is probably easier to just constrain the argument to always producing valid json. Using custom encoder and decoder classes let users still handle custom types but also restrict things to always be JSON. This should fix the potential risk in the previous iteration but still fix the underlying issue. * Update release note * Remove pylint ignores from release note example Co-authored-by: Jake Lishman <[email protected]> Co-authored-by: Jake Lishman <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for ceeb993 - Browse repository at this point
Copy the full SHA ceeb993View commit details
Commits on Mar 30, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 045e6f3 - Browse repository at this point
Copy the full SHA 045e6f3View commit details
Commits on Mar 31, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 6389232 - Browse repository at this point
Copy the full SHA 6389232View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2fa23f2 - Browse repository at this point
Copy the full SHA 2fa23f2View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.