-
-
Notifications
You must be signed in to change notification settings - Fork 1
Debug experiments #10
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses compatibility issues with Qiskit 2.x and ensures all examples work properly in headless environments (Docker, SSH, remote servers). The changes focus on fixing deprecated API usage patterns and matplotlib configuration for non-interactive execution.
Key changes include:
- Fixed Qiskit 2.x compatibility issues across all 46 example files
- Added matplotlib non-interactive backend configuration for headless environments
- Updated documentation to reflect the improvements and compatibility fixes
Reviewed Changes
Copilot reviewed 51 out of 51 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| examples/utils/visualization.py | Added matplotlib 'Agg' backend configuration for headless support |
| examples/module8_applications/*.py | Fixed API compatibility and added headless matplotlib setup (6 files) |
| examples/module7_hardware/*.py | Resolved circuit composition issues and headless plotting (5 files) |
| examples/module6_machine_learning/*.py | Fixed measurement circuit creation and duplicate imports (5 files) |
| examples/module5_error_correction/*.py | Corrected DensityMatrix operations and import cleanup (5 files) |
| examples/module4_algorithms/*.py | Updated plotting calls and backend configuration (5 files) |
| examples/module3_programming/*.py | Fixed circuit patterns and matplotlib backend (6 files) |
| examples/module2_mathematics/*.py | Resolved plotting issues and added headless support (5 files) |
| examples/module1_fundamentals/*.py | Fixed measurement circuits and visualization cleanup (8 files) |
| README.md, CHANGELOG.md, etc. | Updated documentation to reflect Qiskit 2.x compatibility and headless features |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| from qiskit.circuit import QuantumCircuit | ||
| meas_circuit = QuantumCircuit(circuit.num_qubits, 1) | ||
| meas_circuit.compose(circuit, inplace=True) |
Copilot
AI
Oct 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The import statement from qiskit.circuit import QuantumCircuit is redundant since QuantumCircuit is already imported at the top. This local import should be removed to avoid confusion and maintain clean code structure.
| from qiskit.circuit import QuantumCircuit | ||
| meas_circuit = QuantumCircuit(circuit.num_qubits, 1) | ||
| meas_circuit.compose(circuit, inplace=True) |
Copilot
AI
Oct 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another redundant import of QuantumCircuit that should be removed since it's already imported at the module level.
| # Add measurement | ||
| meas_circuit = circuit.copy() | ||
| meas_circuit.add_register(ClassicalRegister(1)) | ||
| from qiskit.circuit import ClassicalRegister, QuantumCircuit |
Copilot
AI
Oct 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant imports of ClassicalRegister and QuantumCircuit since both are already imported at the top of the file. This local import should be removed.
| from qiskit.circuit import ClassicalRegister, QuantumCircuit |
| from qiskit.circuit import ClassicalRegister | ||
| qc_measure = QuantumCircuit(1, 1) |
Copilot
AI
Oct 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant import of ClassicalRegister since it's already imported at the top of the file. This local import should be removed.
| from qiskit.circuit import ClassicalRegister | |
| qc_measure = QuantumCircuit(1, 1) | |
| qc_measure = QuantumCircuit(1, 1) |
π Description
Brief description of the changes in this pull request.
π Type of Change
π― Related Issues
Fixes #(issue number)
Relates to #(issue number)
π Module/Area Affected
π§ͺ Testing
Describe how you tested your changes:
β Completed Testing
π₯οΈ Testing Environment
π Test Commands
# Commands used to test the changes python module_x/example.py --help python module_x/example.py --parameter valueπΈ Screenshots (if applicable)
Include screenshots for visual changes, new visualizations, or UI improvements.
π Documentation Changes
β‘ Performance Impact
π Breaking Changes
If this introduces breaking changes, please describe:
π Checklist
Code Quality
Testing
Documentation
Educational Value
π Educational Impact
How do these changes improve the learning experience?
π€ Review Notes
Anything specific you'd like reviewers to focus on?
π Future Work
Any follow-up work that should be done in future PRs?
Thank you for contributing to Quantum Computing 101! πβοΈ