Skip to content
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

Deprecate subclassing of Register and Bit #13841

Merged

Conversation

jakelishman
Copy link
Member

The data represented by these classes will move to Rust space in Qiskit 2.0, and the remaining Python objects will be thin wrappers around the Rust-space objects. Rust space will not support additional bits beyond the existing triple Qubit/AncillaQubit/Clbit, and so Python-space will be unable to represent anything beyond this in the circuit data model.

It's not clear what, if any, meaning was intended by subclassing these objects already, and Qiskit did not consider them subclass safe. We don't expect that anybody will have been doing this, so the impact should be minimal.

Summary

Details and comments

This is prep work for #13686, or an in-the-works PR by Ray that will supersede that one.

The data represented by these classes will move to Rust space in Qiskit
2.0, and the remaining Python objects will be thin wrappers around the
Rust-space objects.  Rust space will not support additional bits beyond
the existing triple `Qubit/AncillaQubit/Clbit`, and so Python-space will
be unable to represent anything beyond this in the circuit data model.

It's not clear what, if any, meaning was intended by subclassing these
objects already, and Qiskit did not consider them subclass safe.  We
don't expect that anybody will have been doing this, so the impact
should be minimal.
@jakelishman jakelishman added Changelog: Deprecation Include in "Deprecated" section of changelog mod: circuit Related to the core of the `QuantumCircuit` class or the circuit library labels Feb 13, 2025
@jakelishman jakelishman added this to the 1.4.0 milestone Feb 13, 2025
@jakelishman jakelishman requested a review from a team as a code owner February 13, 2025 18:35
@qiskit-bot
Copy link
Collaborator

One or more of the following people are relevant to this code:

  • @Qiskit/terra-core

Copy link
Contributor

@raynelfss raynelfss left a comment

Choose a reason for hiding this comment

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

LGTM! At first, I was confused about the check but checking the destination module sounds logical.

@raynelfss raynelfss added this pull request to the merge queue Feb 13, 2025
@jakelishman
Copy link
Member Author

Yeah, I needed some way of marking that ClassicalRegister, QuantumRegister and AncillaRegister are "fine", and ended up with the somewhat Nixon-esque "when the library does it, that means it's not a crime" form you see here...

Merged via the queue into Qiskit:stable/1.4 with commit f0f90ac Feb 13, 2025
17 checks passed
@jakelishman jakelishman deleted the deprecate-subclass-register branch February 13, 2025 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: Deprecation Include in "Deprecated" section of changelog mod: circuit Related to the core of the `QuantumCircuit` class or the circuit library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants