Add IBM 'Use a Quantum Computer Today' notebooks (IBM-Course/)#62
Add IBM 'Use a Quantum Computer Today' notebooks (IBM-Course/)#62kanavsetia wants to merge 2 commits into
Conversation
qBraid-flavored adaptations of Olivia Lanes' four lesson notebooks from IBM Quantum Learning. Surfaced from the Start Here panel's new Qiskit tab in the lab extension. Adaptations vs upstream: - drop !pip install (qiskit/qiskit-ibm-runtime/qiskit-aer/matplotlib ship with the qBraid Lab base env) - drop QiskitRuntimeService.save_account(...) (token is injected from qBraid Vault when you've connected IBM Quantum) - IBM MDX tags (<IBMVideo>, <Accordion>, <Image>) → plain markdown so the cells render correctly in Jupyter - absolute URLs for IBM Quantum docs/composer links Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughThis PR introduces a complete IBM Quantum course adapted for qBraid Lab, consisting of four lesson notebooks progressing from quantum computing context through mechanics fundamentals to hands-on Qiskit Runtime workflows and practical circuit construction, with a course README providing navigation and attribution. ChangesIBM Quantum Course
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 7
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@IBM-Course/01-quantum-computing-context.ipynb`:
- Line 233: The final notebook cell currently contains the string "\u00a9 IBM
Corp., 2017-2026" which does not match the repo's required Apache 2.0 footer;
open the last cell (the one containing that string) and replace its content with
the exact repository-required Apache 2.0 footer text (copy-paste the precise
footer string enforced by the project's footer check), preserving any IBM
attribution only if it is part of that exact footer.
In `@IBM-Course/02-quantum-mechanics-basics.ipynb`:
- Line 397: The final notebook cell currently contains the string "\u00a9 IBM
Corp., 2017-2026" which fails the CI footer checker; replace the last cell's
content with the exact Apache 2.0 footer string required by CI (overwrite the
final cell in IBM-Course/02-quantum-mechanics-basics.ipynb with the canonical
Apache-2.0 footer text).
In `@IBM-Course/03-your-first-quantum-experiment.ipynb`:
- Line 467: Replace the final notebook cell that currently contains the string
"\u00a9 IBM Corp., 2017-2026" with the exact Apache 2.0 footer text required by
the license-footer checker: locate the last cell content matching that copyright
string and overwrite it with the canonical Apache License 2.0 footer string the
workflow enforces (use the exact phraseing/capitalization and punctuation from
the checker).
- Around line 321-325: The inline annotations are inconsistent with the
variables: update the comments so they match the actual values and indexing used
by obs = SparsePauliOp.from_list([("ZZ", J), ("XI", hx), ("IX", hx)]): change
the J comment to reflect J = 1.0 is ferromagnetic (J>0) rather than “J<0”,
clarify the ZZ label as referring to qubit 0 and 1 (e.g. “ZZ (Z0 Z1)”) instead
of “Z1 Z2”, and make the hx comment state that hx = -0.5 is a negative
transverse field (or remove the sign description) so the comments for J, hx, and
the ZZ operator are all consistent with the code.
- Around line 169-176: The notebook references service when selecting a backend
but never instantiates it; instantiate QiskitRuntimeService and assign it to
service before calling service.least_busy (e.g., create service =
QiskitRuntimeService(...) with appropriate API token/config) so the backend
selection (backend = service.least_busy(...)) runs without NameError; ensure the
QiskitRuntimeService import and any required credentials/config are present and
uncomment or replace the placeholder instantiation that currently reads "#
service = QiskitRuntimeService()".
In `@IBM-Course/04-build-and-run-your-first-quantum-program.ipynb`:
- Line 366: Replace the notebook's final cell content that currently reads "©
IBM Corp., 2017-2026" with the exact Apache 2.0 footer string required by CI;
locate the final markdown cell (the one containing the current footer string)
and update its text to match the repository's enforced footer verbatim so the
license check passes.
- Around line 45-49: The notebook's "Installation and imports" explanatory text
still references a Colab/pip install workflow and suggests installing Qiskit,
which conflicts with the qBraid environment; remove or reword any
Colab/install-specific sentences so the cell clearly states that qBraid already
provides Qiskit (no pip install needed) and keep only the descriptions of
imports like QuantumCircuit, plot_histogram, AerSimulator, preset_passmanagers,
Sampler, and QiskitRuntimeService to match the qBraid flow; apply the same
removal/rewriting to the duplicated wording at the later occurrence (around the
mention at line 354).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 1ee5178f-c504-4451-93ea-d6b689b1e459
📒 Files selected for processing (5)
IBM-Course/01-quantum-computing-context.ipynbIBM-Course/02-quantum-mechanics-basics.ipynbIBM-Course/03-your-first-quantum-experiment.ipynbIBM-Course/04-build-and-run-your-first-quantum-program.ipynbIBM-Course/README.md
| "cell_type": "markdown", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "\u00a9 IBM Corp., 2017-2026" |
There was a problem hiding this comment.
Use the exact repository-required Apache 2.0 footer in the final cell.
CI is currently failing because the last notebook cell does not match the exact Apache 2.0 footer string enforced by the footer check. Keep IBM attribution if needed, but make the final cell exactly the required Apache footer text.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@IBM-Course/01-quantum-computing-context.ipynb` at line 233, The final
notebook cell currently contains the string "\u00a9 IBM Corp., 2017-2026" which
does not match the repo's required Apache 2.0 footer; open the last cell (the
one containing that string) and replace its content with the exact
repository-required Apache 2.0 footer text (copy-paste the precise footer string
enforced by the project's footer check), preserving any IBM attribution only if
it is part of that exact footer.
| "cell_type": "markdown", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "\u00a9 IBM Corp., 2017-2026" |
There was a problem hiding this comment.
Replace the final cell with the exact Apache 2.0 footer string required by CI.
The footer checker is failing on this notebook because the last cell content is not the expected Apache 2.0 footer text.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@IBM-Course/02-quantum-mechanics-basics.ipynb` at line 397, The final notebook
cell currently contains the string "\u00a9 IBM Corp., 2017-2026" which fails the
CI footer checker; replace the last cell's content with the exact Apache 2.0
footer string required by CI (overwrite the final cell in
IBM-Course/02-quantum-mechanics-basics.ipynb with the canonical Apache-2.0
footer text).
| "# Load the Qiskit Runtime service\n", | ||
| "from qiskit_ibm_runtime import QiskitRuntimeService\n", | ||
| "\n", | ||
| "## Load the Qiskit Runtime service\n", | ||
| "# # service = QiskitRuntimeService()\n", | ||
| "# Use the least busy backend, or uncomment the loading of a specific backend like \"ibm_brisbane\".\n", | ||
| "backend = service.least_busy(operational=True, simulator=False, min_num_qubits=127)\n", | ||
| "# backend = service.backend(\"ibm_brisbane\")\n", |
There was a problem hiding this comment.
Instantiate QiskitRuntimeService before using service.
service is referenced for backend selection, but its initialization is commented out, which causes a runtime NameError and blocks the notebook flow.
Suggested fix
# Load the Qiskit Runtime service
from qiskit_ibm_runtime import QiskitRuntimeService
-## Load the Qiskit Runtime service
-# # service = QiskitRuntimeService()
+service = QiskitRuntimeService()
# Use the least busy backend, or uncomment the loading of a specific backend like "ibm_brisbane".
backend = service.least_busy(operational=True, simulator=False, min_num_qubits=127)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@IBM-Course/03-your-first-quantum-experiment.ipynb` around lines 169 - 176,
The notebook references service when selecting a backend but never instantiates
it; instantiate QiskitRuntimeService and assign it to service before calling
service.least_busy (e.g., create service = QiskitRuntimeService(...) with
appropriate API token/config) so the backend selection (backend =
service.least_busy(...)) runs without NameError; ensure the QiskitRuntimeService
import and any required credentials/config are present and uncomment or replace
the placeholder instantiation that currently reads "# service =
QiskitRuntimeService()".
| "J = 1.0 # antiferromagnetic coupling (J<0)\n", | ||
| "hx = -0.5 # transverse field strength\n", | ||
| "\n", | ||
| "# 1. Define the Hamiltonian H = J Z1 Z2 + hx (X1 + X2)\n", | ||
| "obs = SparsePauliOp.from_list([(\"ZZ\", J), (\"XI\", hx), (\"IX\", hx)])\n", |
There was a problem hiding this comment.
Fix inconsistent Hamiltonian annotations for sign/index conventions.
The inline comments conflict with the code and surrounding text (J = 1.0 but comment says J<0, and Z1 Z2 naming in a 2-qubit 0/1-indexed example). Align these annotations so learners are not given contradictory guidance.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@IBM-Course/03-your-first-quantum-experiment.ipynb` around lines 321 - 325,
The inline annotations are inconsistent with the variables: update the comments
so they match the actual values and indexing used by obs =
SparsePauliOp.from_list([("ZZ", J), ("XI", hx), ("IX", hx)]): change the J
comment to reflect J = 1.0 is ferromagnetic (J>0) rather than “J<0”, clarify the
ZZ label as referring to qubit 0 and 1 (e.g. “ZZ (Z0 Z1)”) instead of “Z1 Z2”,
and make the hx comment state that hx = -0.5 is a negative transverse field (or
remove the sign description) so the comments for J, hx, and the ZZ operator are
all consistent with the code.
| "cell_type": "markdown", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "\u00a9 IBM Corp., 2017-2026" |
There was a problem hiding this comment.
Update the last notebook cell to the exact Apache 2.0 footer expected by the checker.
This file is failing the license-footer workflow because the final cell does not match the enforced footer string.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@IBM-Course/03-your-first-quantum-experiment.ipynb` at line 467, Replace the
final notebook cell that currently contains the string "\u00a9 IBM Corp.,
2017-2026" with the exact Apache 2.0 footer text required by the license-footer
checker: locate the last cell content matching that copyright string and
overwrite it with the canonical Apache License 2.0 footer string the workflow
enforces (use the exact phraseing/capitalization and punctuation from the
checker).
| "#### Installation and imports\n", | ||
| "\n", | ||
| "The next cell installs Qiskit with the [visualization module](https://quantum.cloud.ibm.com/docs/api/qiskit/visualization) plus two add-ons: **Aer** (fast simulators) and the **IBM Runtime** client (for quantum computer runs).\n", | ||
| "\n", | ||
| "Next, we have a number of imports. The `QuantumCircuit` class is where we define our quantum bits, or qubits, and define operations on those qubits. This is our first quantum term: a **qubit** is the basic building block of quantum computation, just as a bit is the building block of classical computation. We'll learn more about the special properties of qubits as we create our circuit. Next, `plot_histogram` will be used to visualize the results of our quantum circuit. `AerSimulator`, allows us to simulate the quantum circuit on a classical computer. But simulators cannot run quantum circuits at the same scale as real quantum computers; that's why we need real quantum computers. This can be helpful for testing, debugging, or educational purposes; or if you've exhausted your 10 free minutes of QPU time. The `preset_passmanagers` help optimize the circuits to run efficiently on hardware, which becomes really important as our circuits become more complex. `Sampler` and `QiskitRuntimeService` are necessary to actually run the circuit on the quantum computer. More on this later.\n", |
There was a problem hiding this comment.
Remove residual Colab/install wording to match the qBraid flow.
These sections still describe a fresh Colab install path, which conflicts with this notebook’s qBraid-specific “no pip install needed” setup and can confuse users.
Also applies to: 354-354
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@IBM-Course/04-build-and-run-your-first-quantum-program.ipynb` around lines 45
- 49, The notebook's "Installation and imports" explanatory text still
references a Colab/pip install workflow and suggests installing Qiskit, which
conflicts with the qBraid environment; remove or reword any
Colab/install-specific sentences so the cell clearly states that qBraid already
provides Qiskit (no pip install needed) and keep only the descriptions of
imports like QuantumCircuit, plot_histogram, AerSimulator, preset_passmanagers,
Sampler, and QiskitRuntimeService to match the qBraid flow; apply the same
removal/rewriting to the duplicated wording at the later occurrence (around the
mention at line 354).
| "cell_type": "markdown", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "\u00a9 IBM Corp., 2017-2026" |
There was a problem hiding this comment.
Set the final cell to the exact Apache 2.0 footer required by CI.
The current last-cell text does not match the repository’s enforced notebook footer format, so the license check fails.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@IBM-Course/04-build-and-run-your-first-quantum-program.ipynb` at line 366,
Replace the notebook's final cell content that currently reads "© IBM Corp.,
2017-2026" with the exact Apache 2.0 footer string required by CI; locate the
final markdown cell (the one containing the current footer string) and update
its text to match the repository's enforced footer verbatim so the license check
passes.
IBM Quantum Learning's "Use a Quantum Computer Today" course lists "Build and run your first quantum program" as Lesson 1 (hands-on first, context after), with "Quantum computing context" as Lesson 4. The initial commit had them flipped. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ryanhill1
left a comment
There was a problem hiding this comment.
Can you ensure the CI/CD passes
If these files are licensed under IBM and not us, and therefore you don't want to add the copyright footers, then we need an update to corresponding GitHub workflow.
Or if you want to modify the default copyright footer for those files, that works too.
Summary
qbraid-lab-extensions(gated behind a localStorage flag + command-palette toggle until this PR merges)What's adapted vs upstream IBM notebooks
!pip install ...lines removed — qBraid Lab's base env already ships qiskit / qiskit-ibm-runtime / qiskit-aer / matplotlibQiskitRuntimeService.save_account(...)blocks removed — qBraid Vault injects the IBM token at runtime<IBMVideo>,<Accordion>,<Image>) rewritten to plain markdown so Jupyter renders the cells correctly/composer,/docs/...) resolved to absolutequantum.cloud.ibm.com/...so the links still work outside IBM's portalWhy a branch (not main yet)
While this branch is open, the `qbraid-lab-extensions` Start Here panel fetches these notebooks from `ibm` directly (via the existing `fetch-notebook` handler's `branch` param). Once merged, the catalog will be flipped to `main` and the branch retired.
Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit