Skip to content

Commit

Permalink
Merge pull request #2 from Qiskit/docs-updates
Browse files Browse the repository at this point in the history
Pull main
  • Loading branch information
assafb authored Nov 1, 2024
2 parents 50ed9da + 3b56f44 commit 74f35f2
Show file tree
Hide file tree
Showing 638 changed files with 47,263 additions and 5,273 deletions.
20 changes: 12 additions & 8 deletions .github/workflows/dev-docs-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,25 @@ jobs:
node-version: 18
- name: Install Node.js dependencies
run: npm ci

- name: Sync dev docs
run: npx tsx scripts/js/commands/api/syncDevDocs.ts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get all changed docs files
id: changed-docs-files
uses: tj-actions/changed-files@af2816c65436325c50621100d67f6e853cd1b0f1
with:
# Note: we specifically check for changed docs files rather than changed
# images in public/images or changes to scripts/config/api-html-artifacts.json
# to avoid noisy PRs. It's common for images to change because some of the
# images are generated non-deterministically.
files: docs/api/**/*.mdx
# Note: we specifically check for changed docs files rather than changed
# images in public/images or changes to scripts/config/api-html-artifacts.json
# to avoid noisy PRs. It's common for images to change because some of the
# images are generated non-deterministically.
run: |
echo "CHANGED_FILES<<EOF" >> $GITHUB_OUTPUT
git diff --name-only docs >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Make pull request
if: ${{ !cancelled() && steps.changed-docs-files.outputs.any_changed == 'true' }}
if: steps.changed-docs-files.outputs.CHANGED_FILES
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand Down
18 changes: 3 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,6 @@ jobs:
with:
files: docs/**/*.{md,mdx,ipynb}
separator: "\n"
- name: Get all changed notebooks
id: all-changed-notebooks
uses: tj-actions/changed-files@af2816c65436325c50621100d67f6e853cd1b0f1
with:
files: "docs/**/*.ipynb"
separator: "\n"

- name: Pull preview image
if: steps.all-changed-files.outputs.any_changed == 'true'
Expand All @@ -80,17 +74,11 @@ jobs:
shell: python
run: |
import subprocess, sys
files = """${{ steps.all-changed-notebooks.outputs.all_changed_notebooks }}"""
args = ["tox", "-e", "lint", "--"] + files.split("\n")
try:
subprocess.run(args, check=True)
subprocess.run(["tox", "-e", "lint"], check=True)
except:
print(
"To fix, install `tox` and run `tox -e fix`.\n\n"
"Alternatively, you can download the fixed notebook from CI by going to this PR's "
"\"Execute notebooks\" job, clicking \"Summary\" on the upper-left "
"of this page, and downloading the \"Executed notebooks\" artifact."
"\n\n"
"For more information, see https://github.com/Qiskit/documentation/blob/main/README.md#lint-notebooks"
"Error while linting notebook. "
"To fix, install tox and run `tox -e fix`."
)
sys.exit(1)
2 changes: 1 addition & 1 deletion .github/workflows/weekly-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,5 @@ jobs:
repo: context.repo.repo,
title: "Extended checks failed",
body: message,
assignees: ["frankharkins", "Eric-Arellano", "arnaucasau"]
assignees: ["frankharkins", "Eric-Arellano"]
})
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ translations
scripts/js/lib/api/testdata
.mypy_cache
public/images
README.md
76 changes: 74 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Read on for more information about how to support this project:
This is the quickest, easiest, and most helpful way to contribute to this project and improve the quality of Qiskit&reg; and IBM Quantum&trade; documentation. There are a few different ways to report issues, depending on where it was found:

- For problems you've found in the [Qiskit SDK API Reference](https://docs.quantum.ibm.com/api/qiskit) section, open an issue in the Qiskit repo [here](https://github.com/Qiskit/qiskit/issues/new/choose).
- For problems you've found in the [Qiskit Runtime Client](https://docs.quantum.ibm.com/api/qiskit-ibm-runtime) section, open an issue in the Qiskit IBM Runtime repo [here](https://github.com/Qiskit/qiskit-ibm-runtime/issues/new/choose).
- For problems you've found in the [Qiskit Runtime client](https://docs.quantum.ibm.com/api/qiskit-ibm-runtime) section, open an issue in the Qiskit IBM Runtime repo [here](https://github.com/Qiskit/qiskit-ibm-runtime/issues/new/choose).
- For problems you've found in any other section of [docs](https://docs.quantum.ibm.com), open a content bug issue [here](https://github.com/Qiskit/documentation/issues/new/choose).

### 2. Suggest new content
Expand Down Expand Up @@ -446,7 +446,7 @@ If your file will have non-trivial code in it, please create a Jupyter notebook
Add the file to these places:
- The folder's `_toc.json`, such as `guides/_toc.json`. The `title` will show up in the left side bar. Note that the `url` leaves off the file extension.
- The appropriate "index" page in the Development workflow section, such as `guides/map-problem-to-circuits` AND the Tools section in the `_toc.json` file. Or, in the rare case that it doesn't belong on any of these pages, list it in `scripts/js/commands/checkPatternsIndex.ts` in the IGNORED_URLS section. For example, `"/guides/qiskit-code-assistant"`.
- The appropriate "index" page in the Development workflow section, such as `guides/map-problem-to-circuits` AND the Tools section in the `_toc.json` file. Or, in the rare case that it doesn't belong on any of these pages, list it in `scripts/js/commands/checkPatternsIndex.ts` in the ALLOWLIST_MISSING_FROM_INDEX or the ALLOWLIST_MISSING_FROM_TOC section. For example, `"/guides/qiskit-code-assistant"`.
- qiskit_bot.yaml. Everyone listed under the file name is notified any time the file is updated. If someone wants to be listed as an owner but does not want to receive notifications, put their ID in single quotes. For example, - "`@NoNotifications`"
## Page metadata
Expand Down Expand Up @@ -592,6 +592,19 @@ By default, the title is the `type` capitalized. You can customize it by setting
</Admonition>
```
We also have a specialized admonition for Qiskit Code Assistant prompt suggestions. Warning: avoid a trailing comma on the last entry in `prompts`!
```mdx
<CodeAssistantAdmonition
tagLine="Need help? Try asking Qiskit Code Assistant."
prompts={[
"# Print the version of Qiskit we're using",
"# Return True if the version of Qiskit is 1.0 or greater",
"# Install Qiskit 1.0.2"
]}
/>
```
### Definition Tooltip
To use a `DefinitionTooltip`, use the following syntax:
Expand Down Expand Up @@ -663,6 +676,65 @@ There is a specific use case where you want to show instructions for different o
</OperatingSystemTabs>
```
### CodeCellPlaceholder
This component only works in notebooks. Notebook code cells are always at the
top-level of content, but sometimes you'll want to have them nested in other
components, such as in tabs or in a list. While you could write your code
as a markdown block, it's usually preferable to keep the code as a code block
so that it is executed and its code can be later used in the notebook. The
CodeCellPlaceholder component allows you to still use a code block, but move
it to render somewhere else in the notebook.
To use this component, add a tag
starting with `id-` to the code cell you'd like to move, then add a
`<CodeCellPlaceholder tag="id-tag" />` component with the same tag somewhere in
your markdown. This will move that code cell into the place of the component.
You can then use this component anywhere in your markdown. While you can move code
cells anywhere, try to keep them relatively close to their position in the
notebook and preserve their order to avoid confusion.
Here's an example of what this might look like in your notebook source.
```json
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"tags": [
"id-example-cell"
]
},
"outputs": [
{
"data": {
"text/plain": [
"Hello, world!"
]
},
}
],
"source": [
"# This is a code cell\n",
"print(\"Hello, world!\")"
]
},
{
"cell_type": "markdown",
"source": [
"This is a notebook markdown cell.",
"\n",
"<Tabs>\n",
"<TabItem value=\"Example\" label=\"Example\">\n",
" This `TabItem` contains a notebook code cell\n",
" <CodeCellPlaceholder tag=\"id-example-cell\" />\n",
"</TabItem>\n",
"</Tabs>"
]
}
```
## Proper marking and attribution
**All information needs to identify, mark, and attribute IBM and applicable third-party trademarks.** We do this the first time an IBM trademark appears on each page. See the [Copyright and trademark information](https://www.ibm.com/legal/copyright-trademark) page for more details.
Expand Down
4 changes: 4 additions & 0 deletions docs/api/qiskit-addon-cutting/_package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "qiskit-addon-cutting",
"version": "0.9.0"
}
155 changes: 155 additions & 0 deletions docs/api/qiskit-addon-cutting/_toc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
{
"title": "Circuit cutting",
"children": [
{
"title": "API index",
"url": "/api/qiskit-addon-cutting"
},
{
"title": "qiskit_addon_cutting",
"children": [
{
"title": "Module overview",
"url": "/api/qiskit-addon-cutting"
},
{
"title": "BaseQPDGate",
"url": "/api/qiskit-addon-cutting/qpd-base-qpd-gate"
},
{
"title": "bit_count",
"url": "/api/qiskit-addon-cutting/utils-bitwise-bit-count"
},
{
"title": "CommutingObservableGroup",
"url": "/api/qiskit-addon-cutting/utils-observable-grouping-commuting-observable-group"
},
{
"title": "ConsolidateResets",
"url": "/api/qiskit-addon-cutting/utils-transpiler-passes-consolidate-resets"
},
{
"title": "cut_gates",
"url": "/api/qiskit-addon-cutting/cut-gates"
},
{
"title": "cut_wires",
"url": "/api/qiskit-addon-cutting/cut-wires"
},
{
"title": "CutWire",
"url": "/api/qiskit-addon-cutting/instructions-cut-wire"
},
{
"title": "decompose_qpd_instructions",
"url": "/api/qiskit-addon-cutting/qpd-decompose-qpd-instructions"
},
{
"title": "DeviceConstraints",
"url": "/api/qiskit-addon-cutting/device-constraints"
},
{
"title": "ExactSampler",
"url": "/api/qiskit-addon-cutting/utils-simulation-exact-sampler"
},
{
"title": "expand_observables",
"url": "/api/qiskit-addon-cutting/expand-observables"
},
{
"title": "find_cuts",
"url": "/api/qiskit-addon-cutting/find-cuts"
},
{
"title": "generate_cutting_experiments",
"url": "/api/qiskit-addon-cutting/generate-cutting-experiments"
},
{
"title": "generate_qpd_weights",
"url": "/api/qiskit-addon-cutting/qpd-generate-qpd-weights"
},
{
"title": "Move",
"url": "/api/qiskit-addon-cutting/instructions-move"
},
{
"title": "ObservableCollection",
"url": "/api/qiskit-addon-cutting/utils-observable-grouping-observable-collection"
},
{
"title": "observables_restricted_to_subsystem",
"url": "/api/qiskit-addon-cutting/utils-observable-grouping-observables-restricted-to-subsystem"
},
{
"title": "OptimizationParameters",
"url": "/api/qiskit-addon-cutting/optimization-parameters"
},
{
"title": "partition_circuit_qubits",
"url": "/api/qiskit-addon-cutting/partition-circuit-qubits"
},
{
"title": "partition_problem",
"url": "/api/qiskit-addon-cutting/partition-problem"
},
{
"title": "PartitionedCuttingProblem",
"url": "/api/qiskit-addon-cutting/partitioned-cutting-problem"
},
{
"title": "QPDBasis",
"url": "/api/qiskit-addon-cutting/qpd-qpd-basis"
},
{
"title": "qpdbasis_from_instruction",
"url": "/api/qiskit-addon-cutting/qpd-qpdbasis-from-instruction"
},
{
"title": "reconstruct_expectation_values",
"url": "/api/qiskit-addon-cutting/reconstruct-expectation-values"
},
{
"title": "RemoveFinalReset",
"url": "/api/qiskit-addon-cutting/utils-transpiler-passes-remove-final-reset"
},
{
"title": "separate_circuit",
"url": "/api/qiskit-addon-cutting/utils-transforms-separate-circuit"
},
{
"title": "SeparatedCircuits",
"url": "/api/qiskit-addon-cutting/utils-transforms-separated-circuits"
},
{
"title": "simulate_statevector_outcomes",
"url": "/api/qiskit-addon-cutting/utils-simulation-simulate-statevector-outcomes"
},
{
"title": "SingleQubitQPDGate",
"url": "/api/qiskit-addon-cutting/qpd-single-qubit-qpd-gate"
},
{
"title": "TwoQubitQPDGate",
"url": "/api/qiskit-addon-cutting/qpd-two-qubit-qpd-gate"
},
{
"title": "unique_by_eq",
"url": "/api/qiskit-addon-cutting/utils-iteration-unique-by-eq"
},
{
"title": "unique_by_id",
"url": "/api/qiskit-addon-cutting/utils-iteration-unique-by-id"
},
{
"title": "WeightType",
"url": "/api/qiskit-addon-cutting/qpd-weight-type"
}
]
},
{
"title": "Release notes",
"url": "/api/qiskit-addon-cutting/release-notes"
}
],
"collapsed": true
}
34 changes: 34 additions & 0 deletions docs/api/qiskit-addon-cutting/cut-gates.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
title: cut_gates
description: API reference for qiskit_addon_cutting.cut_gates
in_page_toc_min_heading_level: 1
python_api_type: function
python_api_name: qiskit_addon_cutting.cut_gates
---

<span id="qiskit-addon-cutting-cut-gates" />

# qiskit\_addon\_cutting.cut\_gates

<Function id="qiskit_addon_cutting.cut_gates" isDedicatedPage={true} github="https://github.com/Qiskit/qiskit-addon-cutting/tree/stable/0.9/qiskit_addon_cutting/cutting_decomposition.py" signature="cut_gates(circuit, gate_ids, inplace=False)">
Transform specified gates into [`TwoQubitQPDGate`](qpd-two-qubit-qpd-gate "qiskit_addon_cutting.qpd.TwoQubitQPDGate")s.

**Parameters**

* **circuit** ([`QuantumCircuit`](/api/qiskit/qiskit.circuit.QuantumCircuit "(in Qiskit v1.2)")) – The circuit containing gates to be decomposed
* **gate\_ids** ([`Sequence`](https://docs.python.org/3/library/collections.abc.html#collections.abc.Sequence "(in Python v3.13)")\[[`int`](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")]) – The indices of the gates to decompose
* **inplace** ([`bool`](https://docs.python.org/3/library/functions.html#bool "(in Python v3.13)")) – Flag denoting whether to copy the input circuit before acting on it

**Return type**

[`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.13)")\[[`QuantumCircuit`](/api/qiskit/qiskit.circuit.QuantumCircuit "(in Qiskit v1.2)"), [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.13)")\[[`QPDBasis`](qpd-qpd-basis "qiskit_addon_cutting.qpd.qpd_basis.QPDBasis")]]

**Returns**

A copy of the input circuit with the specified gates replaced with [`TwoQubitQPDGate`](qpd-two-qubit-qpd-gate "qiskit_addon_cutting.qpd.TwoQubitQPDGate")s and a list of [`QPDBasis`](qpd-qpd-basis "qiskit_addon_cutting.qpd.QPDBasis") instances – one for each decomposed gate.

**Raises**

[**ValueError**](https://docs.python.org/3/library/exceptions.html#ValueError "(in Python v3.13)") – The input circuit should contain no classical bits or registers.
</Function>

Loading

0 comments on commit 74f35f2

Please sign in to comment.