Skip to content

Conversation

@verult
Copy link
Collaborator

@verult verult commented Jun 23, 2022

This PR deprecates all serializers we plan to deprecate

  • Deprecated GateOpSerializer, GateOpDeserializer, DeserializingArg, and SerializingArg using the class wrapper technique.
  • CircuitSerializer and serializer classes it depends on (CircuitOp[De]Serializer, Serializer) are left in place.
  • Skipping deprecation of common serializers in common_serializers.py for now and remove them directly after the 0.15 release as it's very unlikely for users to access them directly. Most users interact with them via global gatesets, e.g.

SYC_GATESET = cast(
serializable_gate_set.SerializableGateSet,
serializable_gate_set._SerializableGateSet(
gate_set_name='sycamore',
serializers=[
SYC_SERIALIZER,
*SINGLE_QUBIT_SERIALIZERS,
*SINGLE_QUBIT_HALF_PI_SERIALIZERS,
MEASUREMENT_SERIALIZER,
WAIT_GATE_SERIALIZER,
CIRCUIT_OP_SERIALIZER,
],
deserializers=[
SYC_DESERIALIZER,
*SINGLE_QUBIT_DESERIALIZERS,
*SINGLE_QUBIT_HALF_PI_DESERIALIZERS,
MEASUREMENT_DESERIALIZER,
WAIT_GATE_DESERIALIZER,
CIRCUIT_OP_DESERIALIZER,
],
),
)

But if time allows, I'll try to deprecate common serializers as well.

  • Added mentions of serializer deprecations in global gateset deprecation warnings.

@dstrain115

@verult verult requested review from a team, cduck, vtomole and wcourtney as code owners June 23, 2022 21:21
@verult verult requested a review from pavoljuhas June 23, 2022 21:21
@CirqBot CirqBot added the size: XL lines changed >1000 label Jun 23, 2022
@verult verult requested review from dstrain115 and removed request for pavoljuhas June 23, 2022 21:22
Copy link
Collaborator

@dstrain115 dstrain115 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, minus two small comments.

gate.id = gate_id

if not isinstance(serializer, op_serializer.GateOpSerializer):
if not isinstance(serializer, op_serializer._GateOpSerializer):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to handle both GateOpSerializer and _GateOpSerilalzer, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_GateOpSerializer is a superclass of GateOpSerializer so both are handled

@verult
Copy link
Collaborator Author

verult commented Jun 24, 2022

Thanks for the review, merging now.

@verult verult added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Jun 24, 2022
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Jun 24, 2022
@CirqBot CirqBot merged commit 7e67d66 into quantumlib:master Jun 24, 2022
@CirqBot CirqBot removed automerge Tells CirqBot to sync and merge this PR. (If it's running.) front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. labels Jun 24, 2022
@verult verult mentioned this pull request Jul 7, 2022
40 tasks
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
This PR deprecates all serializers we plan to deprecate
* Deprecated GateOpSerializer, GateOpDeserializer, DeserializingArg, and SerializingArg using the class wrapper technique. 
* CircuitSerializer and serializer classes it depends on (`CircuitOp[De]Serializer`, `Serializer`) are left in place.
* Skipping deprecation of common serializers in `common_serializers.py` for now and remove them directly after the 0.15 release as it's very unlikely for users to access them directly. Most users interact with them via global gatesets, e.g.

https://github.com/quantumlib/Cirq/blob/abfc619bfe31e93573993c76cecfddc5689dea9b/cirq-google/cirq_google/serialization/gate_sets.py#L43-L64

But if time allows, I'll try to deprecate common serializers as well.

* Added mentions of serializer deprecations in global gateset deprecation warnings.

@dstrain115
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: XL lines changed >1000

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants