-
Notifications
You must be signed in to change notification settings - Fork 144
first pass at quick start page #4041
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
Open
abbycross
wants to merge
47
commits into
main
Choose a base branch
from
ajc/quick-start
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
8c3da1e
first pass at quick start page
abbycross f0126ce
change to code in markdown
abbycross 42cf423
redundant
abbycross ecd74f4
Merge branch 'main' of https://github.com/Qiskit/documentation into a…
abbycross a284eff
put overview first
abbycross 582cfd2
link to quickstart from intro page
abbycross baf1b78
add venv and python twisties
abbycross 9c625f3
update to use preset_pass_manager
abbycross 391c75c
tox -e fix
abbycross 9580b2d
it's actually nine lines
abbycross 28fb093
clarify python and venv info
abbycross 1bf7191
reword
abbycross 16a1733
simplify
abbycross 83b75d2
tox -e fix
abbycross 3e3048d
wording tweak
abbycross 3ba2a49
more tweak
abbycross 25e7de8
bullets to add spacing
abbycross c98a458
don't need aer or viz
abbycross 0776f8d
actually yes we need viz
abbycross edee7e0
update code
abbycross bbddec3
extra parens
abbycross a027cfa
Add numbers
abbycross b0bd173
tweaks
abbycross 4edbbf1
Apply suggestions from code review
abbycross 029bc71
It's a word!
abbycross 33f3902
Merge branch 'main' into ajc/quick-start
abbycross c310ab6
start to add auth instructions
abbycross 9a83be9
first draft of install/auth for hello world
abbycross 99d72c0
Bring in Kaelyn's examples
abbycross 3ec54a9
cap Matplotlib
abbycross 571e298
protect your API key
abbycross 5fd92f9
Leron feedback
abbycross d60fd6a
leron feedback
abbycross 0d24ad9
Merge branch 'main' into ajc/quick-start
abbycross c231f7f
Need to point to "find access cred"
abbycross 7605f3c
tweak
abbycross 19e9541
Merge branch 'main' into ajc/quick-start
abbycross 510e8ab
Next iteration of edits to Hello world
abbycross 0617a70
./fix
abbycross 0fb0d34
Merge branch 'main' into ajc/quick-start
abbycross 5b6f98a
Merge branch 'main' into ajc/quick-start
abbycross e16c344
Add to the Next steps
abbycross c002cbf
Move intro pph below install instructions
abbycross 20b4a72
tox -e fix
abbycross f0a11fc
meh I didn't like it
abbycross 9a44e44
feedback from the team
abbycross 7b8d4e8
point to beginning of the course
abbycross File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,263 @@ | ||
| { | ||
| "cells": [ | ||
| { | ||
| "cell_type": "markdown", | ||
| "id": "2e2023d1", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "# Quickstart" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "id": "a82fbaaa", | ||
| "metadata": { | ||
| "tags": [ | ||
| "version-info" | ||
| ] | ||
| }, | ||
| "source": [] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "id": "7bbbdb4b", | ||
| "metadata": { | ||
| "jp-MarkdownHeadingCollapsed": true | ||
| }, | ||
| "source": [ | ||
| "Build your first quantum circuit in under two minutes, on your local environment - no sign-in or API key necessary.\n", | ||
| "\n", | ||
| "<Admonition type=\"note\" title=\"New to Python and virtual environments?\">\n", | ||
| "\n", | ||
| "* Download Python and use a virtual environment with Qiskit (recommended).\n", | ||
| "\n", | ||
| "<details>\n", | ||
| "<summary>Click to expand for more information about **Python**.</summary>\n", | ||
| "\n", | ||
| "- To install Python, first check the \"Programming Language\" section on the [Qiskit PyPI project page](https://pypi.org/project/qiskit/) to determine which Python versions are supported by the most recent release. For download instructions, see the [Python Beginners Guide.](https://wiki.python.org/moin/BeginnersGuide/Download)\n", | ||
| "\n", | ||
| "<Admonition type = \"note\">\n", | ||
| "These instructions use the standard Python distribution from [pypi.org](https://pypi.org/). However, you can use other Python distributions, such as [Anaconda](https://docs.anaconda.com/anaconda/) or [miniconda](https://docs.anaconda.com/miniconda/), along with other dependency management workflows like [Poetry](https://python-poetry.org/docs/).\n", | ||
| "</Admonition>\n", | ||
| "</details>\n", | ||
| "\n", | ||
| " <details>\n", | ||
| " <summary>\n", | ||
| " Click to expand for more information on **virtual environments**.\n", | ||
| " </summary>\n", | ||
| " - Use [Python virtual environments](https://docs.python.org/3.10/tutorial/venv.html) to separate Qiskit from other applications.\n", | ||
| " A Python virtual environment is an isolated space to work with Python for a specific purpose — so you can install whatever packages you wish, and set up libraries, dependencies, and so on, without affecting the \"base\" Python environment on your machine.\n", | ||
| "\n", | ||
| " One important advantage of a virtual environment is that if your Python environment becomes corrupted somewhere along the way, you can easily delete the virtual environment and start over!\n", | ||
| "\n", | ||
| " Choose a preferred location in which to store information about your virtual environments. Typically they're stored in a directory named `.venv` within each project directory you're working in.\n", | ||
| "\n", | ||
| " To work in your virtual environment, navigate to your project directory and create a minimal environment with only Python installed in it.\n", | ||
| "\n", | ||
| " <OperatingSystemTabs>\n", | ||
| " <TabItem value=\"mac\" label=\"macOS\">\n", | ||
| " ```shell\n", | ||
| " python3 -m venv .venv\n", | ||
| " ```\n", | ||
| " </TabItem>\n", | ||
| "\n", | ||
| " <TabItem value=\"linux\" label=\"Linux\">\n", | ||
| " ```shell\n", | ||
| " python3 -m venv .venv\n", | ||
| " ```\n", | ||
| " </TabItem>\n", | ||
| "\n", | ||
| " <TabItem value=\"win\" label=\"Windows\">\n", | ||
| " ```text\n", | ||
| " python -m venv .venv\n", | ||
| " ```\n", | ||
| " </TabItem>\n", | ||
| " </OperatingSystemTabs>\n", | ||
| "\n", | ||
| " Next, activate your new environment.\n", | ||
| "\n", | ||
| " <OperatingSystemTabs>\n", | ||
| " <TabItem value=\"mac\" label=\"macOS\">\n", | ||
| " ```shell\n", | ||
| " source .venv/bin/activate\n", | ||
| " ```\n", | ||
| " </TabItem>\n", | ||
| "\n", | ||
| " <TabItem value=\"linux\" label=\"Linux\">\n", | ||
| " ```shell\n", | ||
| " source .venv/bin/activate\n", | ||
| " ```\n", | ||
| " </TabItem>\n", | ||
| "\n", | ||
| " <TabItem value=\"win\" label=\"Windows\">\n", | ||
| " If using PowerShell:\n", | ||
| "\n", | ||
| " ```text\n", | ||
| " .venv\\Scripts\\Activate.ps1\n", | ||
| " ```\n", | ||
| " If using Git Bash:\n", | ||
| "\n", | ||
| " ```text\n", | ||
| " source .venv/scripts/activate\n", | ||
| " ```\n", | ||
| " If using command prompt:\n", | ||
| "\n", | ||
| " ```text\n", | ||
| " .venv\\Scripts\\activate\n", | ||
| " ```\n", | ||
| " </TabItem>\n", | ||
| " </OperatingSystemTabs>\n", | ||
| " </details>\n", | ||
| "\n", | ||
| "</Admonition>\n", | ||
| "\n", | ||
| "\n", | ||
| "## 1. Install Qiskit\n", | ||
| "\n", | ||
| "Run the following command in your terminal to install the Qiskit and Matplotlib packages, as well as the Qiskit visualization module.\n", | ||
| "\n", | ||
| "```shell\n", | ||
| "pip install qiskit matplotlib qiskit[visualization]\n", | ||
| "\n", | ||
| "# On a zsh terminal, use this line instead:\n", | ||
| "# pip install qiskit matplotlib 'qiskit[visualization]'\n", | ||
| "```" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "id": "c8da788c", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "## 2. Build your circuit\n", | ||
| "\n", | ||
| "Open a Python environment, then run this code, which builds a Bell state (two entangled qubits)." | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "id": "86784142", | ||
| "metadata": {}, | ||
| "outputs": [ | ||
| { | ||
| "name": "stdout", | ||
| "output_type": "stream", | ||
| "text": [ | ||
| "{'00': 505, '11': 519}\n" | ||
| ] | ||
| } | ||
| ], | ||
| "source": [ | ||
| "from qiskit import QuantumCircuit\n", | ||
| "from qiskit.primitives import StatevectorSampler\n", | ||
| "\n", | ||
| "qc = QuantumCircuit(2)\n", | ||
| "qc.h(0)\n", | ||
| "qc.cx(0, 1)\n", | ||
| "qc.measure_all()\n", | ||
| "\n", | ||
| "sampler = StatevectorSampler()\n", | ||
| "result = sampler.run([qc], shots=1024).result()\n", | ||
| "print(result[0].data.meas.get_counts())" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "id": "9a3180c2-56d7-4224-91fa-13d8cb87d93d", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "The expected output is a near-even split between '00' and '11'." | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "id": "a110ac90", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "## 3. Visualize your results\n", | ||
| "\n", | ||
| "To get a histogram of your results, add the following code to your program." | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "id": "dc4ff012", | ||
| "metadata": {}, | ||
| "outputs": [ | ||
| { | ||
| "data": { | ||
| "text/plain": [ | ||
| "<Image src=\"/docs/images/guides/quick-start/extracted-outputs/dc4ff012-0.avif\" alt=\"Output of the previous code cell\" />" | ||
| ] | ||
| }, | ||
| "execution_count": 10, | ||
| "metadata": {}, | ||
| "output_type": "execute_result" | ||
| } | ||
| ], | ||
| "source": [ | ||
| "from qiskit.visualization import plot_histogram\n", | ||
| "\n", | ||
| "counts = result[0].data.meas.get_counts()\n", | ||
| "plot_histogram(counts)\n", | ||
| "\n", | ||
| "# Include the next line if you are not using Python in a Jupyter notebook\n", | ||
| "# plt.show()" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "id": "738d4fc4-29c9-46ab-9879-3365e2149d04", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "This result is a signature of quantum entanglement.\n", | ||
| "\n", | ||
| "## 4. See what happens\n", | ||
| "\n", | ||
| "Try changing the code to see how it affects the results. For example:\n", | ||
| "\n", | ||
| "- Add a third qubit by changing to `QuantumCircuit(3)`, and add a second CX gate with `qc.cx(1,2)`. The measurements should then change to 000 and 111, which means all three of these qubits have been entangled.\n", | ||
| "\n", | ||
| "- See your results shift by adding `qc.x(1)` to the end of the circuit." | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "id": "b6062a16", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "## Next steps\n", | ||
| "\n", | ||
| "<Admonition type=\"tip\" title=\"Recommendations\">\n", | ||
| "- Run a circuit on real quantum hardware in the [Hello world](/docs/tutorials/hello-world) tutorial.\n", | ||
| "- Not ready to run on hardware? Start your quantum journey with the [Basics of quantum information](/learning/courses/basics-of-quantum-information) course.\n", | ||
| "</Admonition>" | ||
| ] | ||
| } | ||
| ], | ||
| "metadata": { | ||
| "description": "Build and visualize a quantum circuit in under two minutes, no sign-in or API key necessary.", | ||
| "kernelspec": { | ||
| "display_name": "Python 3", | ||
| "language": "python", | ||
| "name": "python3" | ||
| }, | ||
| "language_info": { | ||
| "codemirror_mode": { | ||
| "name": "ipython", | ||
| "version": 3 | ||
| }, | ||
| "file_extension": ".py", | ||
| "mimetype": "text/x-python", | ||
| "name": "python", | ||
| "nbconvert_exporter": "python", | ||
| "pygments_lexer": "ipython3", | ||
| "version": "3" | ||
| }, | ||
| "title": "Quickstart" | ||
| }, | ||
| "nbformat": 4, | ||
| "nbformat_minor": 5 | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+2.19 KB
public/docs/images/guides/quick-start/extracted-outputs/dc4ff012-0.avif
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.