Skip to content

cirq_google GridDevice: set JSON namespace to cirq.google #5512

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

Merged

Conversation

verult
Copy link
Collaborator

@verult verult commented Jun 14, 2022

Preferred alternative over #5476 (renaming GridDevice to GoogleGridDevice). This resolves the issue of JSON name collisions between cirq_google and elsewhere by including the cirq.google namespace.

Furthermore, by staying with GridDevice as the class name, we require the caller to include the cirq-google module name in cases when multiple GridDevice classes are used (for example in the server side code today).

@95-martin-orion @mpharrigan
cc @dstrain115 @tanujkhattar

@verult verult requested review from wcourtney, a team, vtomole and cduck as code owners June 14, 2022 01:43
@CirqBot CirqBot added the Size: XS <10 lines changed label Jun 14, 2022
Copy link
Collaborator

@95-martin-orion 95-martin-orion left a comment

Choose a reason for hiding this comment

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

+1

@@ -33,7 +33,6 @@ def _class_resolver_dictionary() -> Dict[str, ObjectFactory]:
'GoogleNoiseProperties': cirq_google.GoogleNoiseProperties,
'SycamoreGate': cirq_google.SycamoreGate,
'GateTabulation': cirq_google.GateTabulation,
'GridDevice': cirq_google.GridDevice,
Copy link
Collaborator

Choose a reason for hiding this comment

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

[No change needed] As discussed, this is safe because GridDevice has not yet appeared in a Cirq release.

@mpharrigan
Copy link
Collaborator

Yes, using the json "namespacing" feature is much preferred to coming up with new names that don't match the class name. All objects would ideally be namespaced (with a carveout for top-level cirq. items)

@verult verult added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Jun 14, 2022
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Jun 14, 2022
@CirqBot CirqBot merged commit ce99bf4 into quantumlib:master Jun 14, 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 14, 2022
augustehirth pushed a commit to augustehirth/Cirq that referenced this pull request Jun 15, 2022
…#5512)

Preferred alternative over quantumlib#5476 (renaming `GridDevice` to `GoogleGridDevice`). This resolves the issue of JSON name collisions between cirq_google and elsewhere by including the `cirq.google` namespace.

Furthermore, by staying with `GridDevice` as the class name, we require the caller to include the `cirq-google` module name in cases when multiple `GridDevice` classes are used (for example in the server side code today).

@95-martin-orion @mpharrigan 
cc @dstrain115 @tanujkhattar
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
…#5512)

Preferred alternative over quantumlib#5476 (renaming `GridDevice` to `GoogleGridDevice`). This resolves the issue of JSON name collisions between cirq_google and elsewhere by including the `cirq.google` namespace.

Furthermore, by staying with `GridDevice` as the class name, we require the caller to include the `cirq-google` module name in cases when multiple `GridDevice` classes are used (for example in the server side code today).

@95-martin-orion @mpharrigan 
cc @dstrain115 @tanujkhattar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Size: XS <10 lines changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants