Skip to content

Commit

Permalink
List package versions in executed notebooks (#2208)
Browse files Browse the repository at this point in the history
Adds the ability for `nb-tester` to list package versions in executed
notebooks. Closes #922.

To add version information to a notebook, add a markdown cell with tag
`version-info`. The script will replace the markdown in that cell with
the version information. I've added this cell to one notebook and
executed it to demonstrate (preview:
https://qiskit.github.io/documentation/pr-2208/guides/plot-quantum-states).
If we go with this approach, I can add empty cells to all notebooks and
they'll be populated as they're run.

This is just plain markdown for now, but we could also consider putting
it the information in a component or adding it to the notebook metadata
so we can display it somewhere else (e.g. the right sidebar).
  • Loading branch information
frankharkins authored Nov 4, 2024
1 parent 82aea7d commit ff75179
Show file tree
Hide file tree
Showing 39 changed files with 1,374 additions and 187 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ If your notebook uses the latex circuit drawer (`qc.draw("latex")`), you must
also add it to the "Check for notebooks that require LaTeX" step in
`.github/workflows/notebook-test.yml`.

### Add package version information

Add a new markdown cell under your title with a `version-info` tag.
When you execute the notebook (see the next section), the script will populate
this cell with the package versions so users can reproduce the results.

### Execute notebooks

Before submitting a new notebook or code changes to a notebook, you must run
Expand Down
47 changes: 39 additions & 8 deletions docs/guides/build-noise-models.ipynb

Large diffs are not rendered by default.

57 changes: 48 additions & 9 deletions docs/guides/circuit-library.ipynb

Large diffs are not rendered by default.

35 changes: 33 additions & 2 deletions docs/guides/classical-feedforward-and-control-flow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,39 @@
"id": "4d6203af-01d0-4362-a44c-66c2128e63d1",
"metadata": {},
"source": [
"# Classical feedforward and control flow\n",
"\n",
"# Classical feedforward and control flow"
]
},
{
"cell_type": "markdown",
"id": "e64d4278-879b-4319-9fbe-85a64327bcac",
"metadata": {
"tags": [
"version-info"
]
},
"source": [
"<details>\n",
"<summary><b>Package versions</b></summary>\n",
"\n",
"The code on this page was developed using the following requirements.\n",
"We recommend using these versions or newer.\n",
"\n",
"```\n",
"qiskit[all]~=1.2.4\n",
"qiskit-aer~=0.15.1\n",
"qiskit-ibm-runtime~=0.31.0\n",
"qiskit-serverless~=0.17.1\n",
"qiskit-ibm-catalog~=0.1\n",
"```\n",
"</details>"
]
},
{
"cell_type": "markdown",
"id": "0767b203-ad69-428f-b8c1-50ceab758b35",
"metadata": {},
"source": [
"This guide demonstrates the functionality available in the Qiskit SDK for performing classical feedforward and control flow. These features are sometimes referred to collectively as \"dynamic circuits.\" Classical feedforward refers to the ability to measure qubits in the middle of a circuit and perform additional quantum operations that depend on the measurement outcome. Qiskit supports four control flow constructs for classical feedforward, each implemented as a method on [`QuantumCircuit`](../api/qiskit/qiskit.circuit.QuantumCircuit). The constructs and their corresponding methods are:\n",
"\n",
"- If statement - [`QuantumCircuit.if_test`](../api/qiskit/qiskit.circuit.QuantumCircuit#if_test)\n",
Expand Down
43 changes: 37 additions & 6 deletions docs/guides/common-parameters.ipynb

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions docs/guides/construct-circuits.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,31 @@
"# Construct circuits"
]
},
{
"cell_type": "markdown",
"id": "e11dd8ad-7edc-4cf8-bc13-388fe04e84fa",
"metadata": {
"tags": [
"version-info"
]
},
"source": [
"<details>\n",
"<summary><b>Package versions</b></summary>\n",
"\n",
"The code on this page was developed using the following requirements.\n",
"We recommend using these versions or newer.\n",
"\n",
"```\n",
"qiskit[all]~=1.2.4\n",
"qiskit-aer~=0.15.1\n",
"qiskit-ibm-runtime~=0.31.0\n",
"qiskit-serverless~=0.17.1\n",
"qiskit-ibm-catalog~=0.1\n",
"```\n",
"</details>"
]
},
{
"cell_type": "markdown",
"id": "c50d8e43-ae82-4e41-8d17-a37332d1bf6d",
Expand Down
35 changes: 33 additions & 2 deletions docs/guides/create-transpiler-plugin.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,39 @@
"id": "58b1f0a7-d62e-4f71-ba01-b8f0beaeeb83",
"metadata": {},
"source": [
"# Create a transpiler plugin\n",
"\n",
"# Create a transpiler plugin"
]
},
{
"cell_type": "markdown",
"id": "5ec7b7a4-5318-4422-ab3d-c88cee551eaa",
"metadata": {
"tags": [
"version-info"
]
},
"source": [
"<details>\n",
"<summary><b>Package versions</b></summary>\n",
"\n",
"The code on this page was developed using the following requirements.\n",
"We recommend using these versions or newer.\n",
"\n",
"```\n",
"qiskit[all]~=1.2.4\n",
"qiskit-aer~=0.15.1\n",
"qiskit-ibm-runtime~=0.31.0\n",
"qiskit-serverless~=0.17.1\n",
"qiskit-ibm-catalog~=0.1\n",
"```\n",
"</details>"
]
},
{
"cell_type": "markdown",
"id": "a7f87a76-b7a1-4dbb-ad45-55ff63c4665b",
"metadata": {},
"source": [
"Creating a [transpiler plugin](transpiler-plugins) is a great way to share your transpilation code with the wider Qiskit community, allowing other users to benefit from the functionality you've developed. Thank you for your interest in contributing to the Qiskit community!\n",
"\n",
"Before you create a transpiler plugin, you need to decide what kind of plugin is appropriate for your situation. There are three kinds of transpiler plugins:\n",
Expand Down
55 changes: 43 additions & 12 deletions docs/guides/custom-backend.ipynb

Large diffs are not rendered by default.

37 changes: 34 additions & 3 deletions docs/guides/custom-transpiler-pass.ipynb

Large diffs are not rendered by default.

58 changes: 52 additions & 6 deletions docs/guides/defaults-and-configuration-options.ipynb

Large diffs are not rendered by default.

33 changes: 32 additions & 1 deletion docs/guides/dynamic-circuits-considerations.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,39 @@
"id": "ad8a25cb-326a-4e5e-9e04-6ab1f02a2bc3",
"metadata": {},
"source": [
"# Hardware considerations and limitations for classical feedforward and control flow\n",
"# Hardware considerations and limitations for classical feedforward and control flow"
]
},
{
"cell_type": "markdown",
"id": "8515bf71-f79c-47f6-a5ef-5314361bf80b",
"metadata": {
"tags": [
"version-info"
]
},
"source": [
"<details>\n",
"<summary><b>Package versions</b></summary>\n",
"\n",
"The code on this page was developed using the following requirements.\n",
"We recommend using these versions or newer.\n",
"\n",
"```\n",
"qiskit[all]~=1.2.4\n",
"qiskit-aer~=0.15.1\n",
"qiskit-ibm-runtime~=0.31.0\n",
"qiskit-serverless~=0.17.1\n",
"qiskit-ibm-catalog~=0.1\n",
"```\n",
"</details>"
]
},
{
"cell_type": "markdown",
"id": "b3d504a0-ce8a-4bfb-aa0a-304c3360e81f",
"metadata": {},
"source": [
"[Classical feedforward and control flow](./classical-feedforward-and-control-flow) shows how to use Qiskit to build circuits that involve classical feedforward and control flow, also known as dynamic circuits. When actually running such circuits on quantum hardware, there are several considerations and limitations to be aware of. Many of these limitations exist because the underlying technology supporting these features is in an early stage of development, and we hope to be able to address them in the future.\n",
"\n",
"\n",
Expand Down
43 changes: 37 additions & 6 deletions docs/guides/dynamical-decoupling-pass-manager.ipynb

Large diffs are not rendered by default.

47 changes: 35 additions & 12 deletions docs/guides/error-mitigation-and-suppression-techniques.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,41 @@
{
"cell_type": "markdown",
"id": "b1267e87-e0b3-4934-b4b8-0265fe84adfd",
"metadata": {},
"source": [
"# Error mitigation and suppression techniques"
]
},
{
"cell_type": "markdown",
"id": "7fb66fc9-c519-4904-a6a1-33adc3f8df13",
"metadata": {
"vscode": {
"languageId": "plaintext"
}
"tags": [
"version-info"
]
},
"source": [
"# Error mitigation and suppression techniques\n",
"\n",
"<details>\n",
"<summary><b>Package versions</b></summary>\n",
"\n",
"The code on this page was developed using the following requirements.\n",
"We recommend using these versions or newer.\n",
"\n",
"```\n",
"qiskit[all]~=1.2.4\n",
"qiskit-aer~=0.15.1\n",
"qiskit-ibm-runtime~=0.31.0\n",
"qiskit-serverless~=0.17.1\n",
"qiskit-ibm-catalog~=0.1\n",
"```\n",
"</details>"
]
},
{
"cell_type": "markdown",
"id": "076872c0-f8de-4aef-ae13-29078ee8564e",
"metadata": {},
"source": [
"This page provides high-level explanations of the error suppression and error mitigation techniques available through Qiskit Runtime.\n",
"\n",
"The following cell imports the Estimator primitive and creates a backend that will be used for initializing the Estimator in later code cells."
Expand All @@ -33,11 +60,7 @@
{
"cell_type": "markdown",
"id": "ad548ef5-f1c1-4def-b551-b3ece2032065",
"metadata": {
"vscode": {
"languageId": "plaintext"
}
},
"metadata": {},
"source": [
"## Dynamical decoupling\n",
"\n",
Expand Down Expand Up @@ -226,7 +249,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"id": "4947f442",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -268,7 +291,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 7,
"id": "f4ae33f2-3a4d-4869-952b-e5ebd9e69efc",
"metadata": {},
"outputs": [],
Expand Down
20 changes: 18 additions & 2 deletions docs/guides/functions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,24 @@
"id": "a47ac9aa-4bb9-4240-806e-9beabfd2dda2",
"metadata": {},
"source": [
"# Introduction to Qiskit Functions\n",
"\n",
"# Introduction to Qiskit Functions"
]
},
{
"cell_type": "markdown",
"id": "0be0fe02-bc50-45a6-aaf6-2120dac862c2",
"metadata": {
"tags": [
"version-info"
]
},
"source": []
},
{
"cell_type": "markdown",
"id": "098d8fd4-1558-40df-a1b1-ad70fdef8863",
"metadata": {},
"source": [
"<Admonition type=\"note\">\n",
"Qiskit Functions are an experimental feature available only to IBM Quantum&trade; Premium Plan users. They are in preview release status and subject to change.\n",
"</Admonition>\n",
Expand Down
53 changes: 42 additions & 11 deletions docs/guides/get-qpu-information.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,39 @@
"id": "cb8aed01-2218-4524-b769-94e3f481b25f",
"metadata": {},
"source": [
"# Get backend information with Qiskit\n",
"# Get backend information with Qiskit"
]
},
{
"cell_type": "markdown",
"id": "3eccac60-3e0f-4f55-ad2d-f19620105ad3",
"metadata": {
"tags": [
"version-info"
]
},
"source": [
"<details>\n",
"<summary><b>Package versions</b></summary>\n",
"\n",
"The code on this page was developed using the following requirements.\n",
"We recommend using these versions or newer.\n",
"\n",
"```\n",
"qiskit[all]~=1.2.4\n",
"qiskit-aer~=0.15.1\n",
"qiskit-ibm-runtime~=0.31.0\n",
"qiskit-serverless~=0.17.1\n",
"qiskit-ibm-catalog~=0.1\n",
"```\n",
"</details>"
]
},
{
"cell_type": "markdown",
"id": "fb232c67-5b12-4125-b786-aca54bd734c2",
"metadata": {},
"source": [
"This page explains how to use Qiskit to find information about your available backends."
]
},
Expand All @@ -29,9 +60,9 @@
{
"data": {
"text/plain": [
"[<IBMBackend('ibm_brisbane')>,\n",
" <IBMBackend('ibm_sherbrooke')>,\n",
" <IBMBackend('ibm_kyiv')>]"
"[<IBMBackend('ibm_sherbrooke')>,\n",
" <IBMBackend('ibm_kyiv')>,\n",
" <IBMBackend('ibm_brisbane')>]"
]
},
"execution_count": 1,
Expand Down Expand Up @@ -101,9 +132,9 @@
{
"data": {
"text/plain": [
"[<IBMBackend('ibm_brisbane')>,\n",
" <IBMBackend('ibm_sherbrooke')>,\n",
" <IBMBackend('ibm_kyiv')>]"
"[<IBMBackend('ibm_sherbrooke')>,\n",
" <IBMBackend('ibm_kyiv')>,\n",
" <IBMBackend('ibm_brisbane')>]"
]
},
"execution_count": 3,
Expand Down Expand Up @@ -132,7 +163,7 @@
{
"data": {
"text/plain": [
"<IBMBackend('ibm_sherbrooke')>"
"<IBMBackend('ibm_brisbane')>"
]
},
"execution_count": 4,
Expand Down Expand Up @@ -215,7 +246,7 @@
{
"data": {
"text/plain": [
"QubitProperties(t1=0.0002648987050342707, t2=0.00022849632444269408, frequency=4635662846.425661)"
"QubitProperties(t1=0.0004359191921774979, t2=9.098970775335616e-05, frequency=4635662846.425661)"
]
},
"execution_count": 6,
Expand Down Expand Up @@ -246,7 +277,7 @@
{
"data": {
"text/plain": [
"InstructionProperties(duration=5.333333333333332e-07, error=0.0060208139584001785, calibration=PulseQobj)"
"InstructionProperties(duration=5.333333333333332e-07, error=0.013205165272520247, calibration=PulseQobj)"
]
},
"execution_count": 7,
Expand Down Expand Up @@ -275,7 +306,7 @@
{
"data": {
"text/plain": [
"InstructionProperties(duration=1.2444444444444443e-06, error=0.0032999999999999696, calibration=PulseQobj)"
"InstructionProperties(duration=1.216e-06, error=0.007400000000000073, calibration=PulseQobj)"
]
},
"execution_count": 8,
Expand Down
Loading

0 comments on commit ff75179

Please sign in to comment.