Skip to content

Add IBM 'Use a Quantum Computer Today' notebooks (IBM-Course/)#62

Open
kanavsetia wants to merge 2 commits into
mainfrom
ibm
Open

Add IBM 'Use a Quantum Computer Today' notebooks (IBM-Course/)#62
kanavsetia wants to merge 2 commits into
mainfrom
ibm

Conversation

@kanavsetia

@kanavsetia kanavsetia commented May 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • adds four qBraid-adapted notebooks from Olivia Lanes' Use a Quantum Computer Today course on IBM Quantum Learning
  • surfaced from the Start Here panel's new Qiskit tab in 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 / matplotlib
  • QiskitRuntimeService.save_account(...) blocks removed — qBraid Vault injects the IBM token at runtime
  • IBM MDX tags (<IBMVideo>, <Accordion>, <Image>) rewritten to plain markdown so Jupyter renders the cells correctly
  • relative URLs (/composer, /docs/...) resolved to absolute quantum.cloud.ibm.com/... so the links still work outside IBM's portal
  • short qBraid-flavored intro card prepended to each notebook explaining the above
  • vault-callout markdown cell inserted in lessons 3 + 4 right before `QiskitRuntimeService()` so users know what to do if the token lookup fails

Why 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

  • Sanity-check render of each notebook by opening it in a qBraid Lab kernel
  • Lesson 4 end-to-end: with an IBM token in Vault, the bare `QiskitRuntimeService()` constructor resolves the token, `least_busy(...)` picks a backend, the Bell-state job runs to completion
  • Vault callout text matches the actual IBM Quantum sign-up flow

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Added four new lesson notebooks for the IBM Quantum course covering quantum computing context, quantum mechanics fundamentals, first quantum experiments, and building/running quantum programs.
    • Added course landing page with lesson navigation and environment-specific setup instructions for qBraid Lab.

Review Change Stack

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>
@coderabbitai

coderabbitai Bot commented May 17, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@kanavsetia has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 46 minutes and 16 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 45fe4ca3-dfa9-40cb-a655-0160adaffa5f

📥 Commits

Reviewing files that changed from the base of the PR and between f5d1cd9 and 8a0ac15.

📒 Files selected for processing (3)
  • IBM-Course/01-build-and-run-your-first-quantum-program.ipynb
  • IBM-Course/04-quantum-computing-context.ipynb
  • IBM-Course/README.md

Walkthrough

This 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.

Changes

IBM Quantum Course

Layer / File(s) Summary
Quantum Computing Context and Course Navigation
IBM-Course/01-quantum-computing-context.ipynb, IBM-Course/README.md
Markdown lesson introduces quantum computing scaling, error correction vs. mitigation, components, and application areas specific to qBraid Lab. README provides course landing page with lesson links and describes how content differs from upstream IBM notebooks (removed installation boilerplate, converted MDX to Markdown).
Quantum Mechanics Fundamentals
IBM-Course/02-quantum-mechanics-basics.ipynb
Lesson covers quantum state representation (Dirac and vector notation), unitary gate matrices, measurement probabilities and basis changes, Pauli matrices and observables, and detailed Bell-state circuit walkthrough. Single executable Qiskit cell constructs and visualizes a 2-qubit Bell-state circuit with Hadamard and CNOT gates.
First Quantum Experiments with Qiskit Runtime
IBM-Course/03-your-first-quantum-experiment.ipynb
Two complete runtime experiments: Experiment 1 prepares a Bell state, transpiles via generate_preset_pass_manager, and uses SamplerV2 to measure and histogram counts. Experiment 2 defines a Hamiltonian as SparsePauliOp and uses EstimatorV2 to estimate eigenvalues, including layout-aware observable mapping. Both include backend selection via QiskitRuntimeService.least_busy() and result visualization.
Building and Running Quantum Programs
IBM-Course/04-build-and-run-your-first-quantum-program.ipynb
Hands-on lesson building a 2-qubit Bell-state circuit and defining helper function run_circuit_and_get_counts(circuit, backend, shots) that transpiles and executes via Qiskit Runtime Sampler. Demonstrates running on both real QPU (via QiskitRuntimeService) and AerSimulator, with histogram visualization and comprehension questions linking to follow-on concepts.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and concisely summarizes the main change: adding four IBM course notebooks to the IBM-Course directory.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ibm

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8611eec and f5d1cd9.

📒 Files selected for processing (5)
  • IBM-Course/01-quantum-computing-context.ipynb
  • IBM-Course/02-quantum-mechanics-basics.ipynb
  • IBM-Course/03-your-first-quantum-experiment.ipynb
  • IBM-Course/04-build-and-run-your-first-quantum-program.ipynb
  • IBM-Course/README.md

"cell_type": "markdown",
"metadata": {},
"source": [
"\u00a9 IBM Corp., 2017-2026"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

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"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

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).

Comment on lines +169 to +176
"# 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",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

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()".

Comment on lines +321 to +325
"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",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

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"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

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).

Comment on lines +45 to +49
"#### 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",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

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"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

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>
@kanavsetia kanavsetia requested a review from ryanhill1 May 20, 2026 19:36

@ryanhill1 ryanhill1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

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.

2 participants