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

Remove top-level access to Device, QubitDevice and QutritDevice #6537

Conversation

JerryChen97
Copy link
Contributor

@JerryChen97 JerryChen97 commented Nov 6, 2024

Context:
In previous cycle the access to the three legacy devices has already been deprecated:

The three devices are accessible through getattr in the top-level init file. We need to raise a deprecation whenever they are still imported in that manner, and direct users to import them through qml.devices module instead.

There should be an extra piece of information regarding the import of Device, where the user needs to import it as qml.devices.LegacyDevice and not just qml.devices.Device

Here we would like to remove them.
Description of the Change:

  • Remove qml.Device, qml.QubitDevice and qml.QutritDevice entirely from pennylane repo
    Benefits:
    Fin the depr cycle

Possible Drawbacks:
Downstreaming incompatibility. Would be fixed in the corresponding pr's
Related GitHub Issues:

Related Shortcut Stories:
[sc-77502]

@JerryChen97 JerryChen97 marked this pull request as ready for review November 8, 2024 16:31
@JerryChen97 JerryChen97 self-assigned this Nov 8, 2024
@JerryChen97 JerryChen97 added the do not merge ⚠️ Do not merge the pull request until this label is removed label Nov 8, 2024
@JerryChen97
Copy link
Contributor Author

I guess my autoblack over the init files messed up something. Do not merge before fix

pennylane/__init__.py Outdated Show resolved Hide resolved
Copy link

codecov bot commented Nov 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.29%. Comparing base (bf03136) to head (e7543cb).
Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6537      +/-   ##
==========================================
- Coverage   99.30%   99.29%   -0.01%     
==========================================
  Files         454      454              
  Lines       43269    43267       -2     
==========================================
- Hits        42967    42964       -3     
- Misses        302      303       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@JerryChen97 JerryChen97 added merge-ready ✔️ All tests pass and the PR is ready to be merged. and removed do not merge ⚠️ Do not merge the pull request until this label is removed labels Nov 8, 2024
Copy link
Contributor

@astralcai astralcai left a comment

Choose a reason for hiding this comment

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

Many of our type hints and documentation are outdated, we shouldn't just replace all mentions of pennylane.Device with pennylane.devices.LegacyDevice because that would be inaccurate. Unless something is exclusively referring to a LegacyDevice (there shouldn't be many of them anymore), we should use pennylane.devices.Device.

doc/development/guide/architecture.rst Outdated Show resolved Hide resolved
doc/introduction/circuits.rst Outdated Show resolved Hide resolved
pennylane/devices/__init__.py Outdated Show resolved Hide resolved
pennylane/gradients/parameter_shift_cv.py Outdated Show resolved Hide resolved
tests/test_qnode.py Outdated Show resolved Hide resolved
Copy link
Contributor

@albi3ro albi3ro left a comment

Choose a reason for hiding this comment

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

❤️

@JerryChen97 JerryChen97 enabled auto-merge (squash) November 13, 2024 21:00
@JerryChen97 JerryChen97 merged commit 499c63b into master Nov 13, 2024
46 checks passed
@JerryChen97 JerryChen97 deleted the Remove-top-level-access-to-`Device`,-`QubitDevice`-and-`QutritDevice` branch November 13, 2024 21:51
JerryChen97 added a commit to PennyLaneAI/qml that referenced this pull request Dec 5, 2024
**Title:**
Remove QubitDevice warnings, which will be removed in the 0.40PL
**Summary:**
as title
**Relevant references:**
#PennyLaneAI/pennylane#6537
**Possible Drawbacks:**
None
**Related GitHub Issues:**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants