Skip to content
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

Automatically publish tutorials to learning platform #1111

Closed
wants to merge 12 commits into from
18 changes: 17 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,20 @@ jobs:
with:
path: ./dist/*
- name: Deploy to Pypi
uses: pypa/gh-action-pypi-publish@release/v1
uses: pypa/gh-action-pypi-publish@release/v1

publish-tutorials:
runs-on: ubuntu-latest
if: "!contains(github.event.release.name, 'rc')"
steps:
- uses: actions/setup-python@v2
with:
python-version: 3.11
- name: Publish tutorials to learning.quantum-computing.ibm.com
env:
LEARNING_API_TOKEN: ${{ secrets.LEARNING_API_TOKEN_PRODUCTION }}
LEARNING_API_ENVIRONMENT: production
run: |
pip install git+https://github.com/frankharkins/learning-content-tools.git@12a71a904b0283b2ee44b63cd04ab8fe96e0df6f#subdirectory=iql-lesson-sync
Copy link
Member

Choose a reason for hiding this comment

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

Should this repo be in the qiskit org? Seems a bit odd to have to install something from your personal repo

Copy link
Member Author

Choose a reason for hiding this comment

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

That's true, I'll look into it. Is it a requirement for this PR?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Could the tools live in qiskit/documentation? I agree this is an issue for sustainability - it's high bus factor.

Copy link
Member Author

Choose a reason for hiding this comment

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

Could the tools live in qiskit/documentation?

That works for me!

cd docs/tutorials
sync-lessons --hide-urls
36 changes: 36 additions & 0 deletions .github/workflows/push-tutorials-to-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
frankharkins marked this conversation as resolved.
Show resolved Hide resolved
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

name: Publish tutorials to staging website

on:
push:
branches:
- "main"

jobs:
publish-tutorials:
runs-on: ubuntu-latest
strategy:
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.11
- name: Push tutorials to learning.www-dev.quantum-computing.ibm.com
env:
LEARNING_API_TOKEN: ${{ secrets.LEARNING_API_TOKEN_STAGING }}
LEARNING_API_ENVIRONMENT: staging
run: |
pip install git+https://github.com/frankharkins/learning-content-tools.git@12a71a904b0283b2ee44b63cd04ab8fe96e0df6f#subdirectory=iql-lesson-sync
cd docs/tutorials
sync-lessons
4 changes: 2 additions & 2 deletions docs/cloud/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,6 @@ Choose a primitive to run

Qiskit Runtime uses primitives to interface with quantum computers and they are publicly available. Choose the appropriate link to continue learning how to run a primitive.

`Getting started with Sampler <https://qiskit.org/documentation/partners/qiskit_ibm_runtime/tutorials/how-to-getting-started-with-sampler.html>`__
`Getting started with Sampler <https://qiskit.org/documentation/partners/qiskit_ibm_runtime/tutorials/how-to-getting-started-with-sampler/index.html>`__

`Getting started with Estimator <https://qiskit.org/documentation/partners/qiskit_ibm_runtime/tutorials/how-to-getting-started-with-estimator.html>`__
`Getting started with Estimator <https://qiskit.org/documentation/partners/qiskit_ibm_runtime/tutorials/how-to-getting-started-with-estimator/index.html>`__
16 changes: 15 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@
'reno.sphinxext',
'nbsphinx',
'sphinx_design',
"qiskit_sphinx_theme",
'sphinxext.rediraffe',
frankharkins marked this conversation as resolved.
Show resolved Hide resolved
'qiskit_sphinx_theme',
]
templates_path = ['_templates']

Expand Down Expand Up @@ -163,3 +164,16 @@
html_sourcelink_suffix = ''

autoclass_content = 'both'

# -- Redirects ---------------------------------------------------------------

rediraffe_redirects = {
"tutorials/chsh_with_estimator.ipynb": "tutorials/chsh-with-estimator/index.ipynb",
"tutorials/Error-Suppression-and-Error-Mitigation.ipynb": "tutorials/error-suppression-and-error-mitigation/index.ipynb",
"tutorials/grover_with_sampler.ipynb": "tutorials/grover-with-sampler/index.ipynb",
"tutorials/how-to-getting-started-with-estimator.ipynb": "tutorials/how-to-getting-started-with-estimator/index.ipynb",
"tutorials/how-to-getting-started-with-sampler.ipynb": "tutorials/how-to-getting-started-with-sampler/index.ipynb",
"tutorials/qaoa_with_primitives.ipynb": "tutorials/qaoa-with-primitives/index.ipynb",
"tutorials/user-transpiled-circuits.ipynb": "tutorials/user-transpiled-circuits/index.ipynb",
"tutorials/vqe_with_estimator.ipynb": "tutorials/vqe-with-estimator/index.ipynb"
frankharkins marked this conversation as resolved.
Show resolved Hide resolved
}
4 changes: 2 additions & 2 deletions docs/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ Getting started with primitives

.. nbgallery::

tutorials/how-to-getting-started-with-sampler
tutorials/how-to-getting-started-with-estimator
tutorials/how-to-getting-started-with-sampler/index
tutorials/how-to-getting-started-with-estimator/index


`See more tutorials <tutorials.html>`_
6 changes: 3 additions & 3 deletions docs/how_to/noisy_simulators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ distribution using the `Sampler primitive
to do the same. To learn how to use the ``Sampler`` primitive and how to
get started using Qiskit Runtime Sessions, you can check this tutorial:
`Get started with the Sampler
primitive <https://qiskit.org/documentation/partners/qiskit_ibm_runtime/tutorials/how-to-getting-started-with-sampler.html>`__.
primitive <https://qiskit.org/documentation/partners/qiskit_ibm_runtime/tutorials/how-to-getting-started-with-sampler/index.html>`__.

.. code-block:: python

Expand Down Expand Up @@ -151,7 +151,7 @@ Run the circuits on Estimator

To learn how to start a session for Estimator, you may check this
tutorial: `Get started with the Estimator
primitive <https://qiskit.org/documentation/partners/qiskit_ibm_runtime/tutorials/how-to-getting-started-with-estimator.html>`__.
primitive <https://qiskit.org/documentation/partners/qiskit_ibm_runtime/tutorials/how-to-getting-started-with-estimator/index.html>`__.

The Estimator will bind single-qubit rotations to get Hamiltonians
before it returns expectation values of quantum operators. Therefore,
Expand Down Expand Up @@ -420,7 +420,7 @@ explore additional options offered by them. If you want to learn more
about activating features like *Digital-ZNE*, *PEC* in addition to *M3*
and *T-REx* as shown in the previous examples, check out this tutorial:
`Error suppression and error mitigation with Qiskit
Runtime <https://qiskit.org/documentation/partners/qiskit_ibm_runtime/tutorials/Error-Suppression-and-Error-Mitigation.html>`__.
Runtime <https://qiskit.org/documentation/partners/qiskit_ibm_runtime/tutorials/error-suppression-and-error-mitigation/index.html>`__.

.. code-block:: python

Expand Down
16 changes: 8 additions & 8 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ Next steps
:hidden:
:caption: Tutorials

Get started with Estimator <tutorials/how-to-getting-started-with-estimator>
Get started with Sampler <tutorials/how-to-getting-started-with-sampler>
Get started with error suppression and error mitigation <tutorials/Error-Suppression-and-Error-Mitigation>
CHSH with Estimator <tutorials/chsh_with_estimator>
VQE with Estimator <tutorials/vqe_with_estimator>
Grover with Sampler <tutorials/grover_with_sampler>
QAOA with Primitives <tutorials/qaoa_with_primitives>
Submit user-transpiled circuits using primitives <tutorials/user-transpiled-circuits>
Get started with Estimator <tutorials/how-to-getting-started-with-estimator/index>
Get started with Sampler <tutorials/how-to-getting-started-with-sampler/index>
Get started with error suppression and error mitigation <tutorials/error-suppression-and-error-mitigation/index>
CHSH with Estimator <tutorials/chsh-with-estimator/index>
VQE with Estimator <tutorials/vqe-with-estimator/index>
Grover with Sampler <tutorials/grover-with-sampler/index>
QAOA with Primitives <tutorials/qaoa-with-primitives/index>
Submit user-transpiled circuits using primitives <tutorials/user-transpiled-circuits/index>
All tutorials <tutorials>

.. toctree::
Expand Down
2 changes: 1 addition & 1 deletion docs/migrate/migrate-estimator.rst
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ Note that the Estimator returns a list of values, as it can perform batched eval
The ``Estimator`` Runtime primitive offers a series of features and tuning options that do not have a legacy alternative
to migrate from, but can help improve your performance and results. For more information, refer to the following:

- `Error mitigation tutorial <https://qiskit.org/documentation/partners/qiskit_ibm_runtime/tutorials/Error-Suppression-and-Error-Mitigation.html>`_
- `Error mitigation tutorial <https://qiskit.org/documentation/partners/qiskit_ibm_runtime/tutorials/error-suppression-and-error-mitigation/index.html>`_
- `Setting execution options topic <https://qiskit.org/documentation/partners/qiskit_ibm_runtime/how_to/options.html>`_
- `Primitive execution options API reference <https://qiskit.org/documentation/partners/qiskit_ibm_runtime/stubs/qiskit_ibm_runtime.options.Options.html#qiskit_ibm_runtime.options.Options>`_
- `How to run a session topic <https://qiskit.org/documentation/partners/qiskit_ibm_runtime/how_to/run_session.html>`_
Expand Down
4 changes: 2 additions & 2 deletions docs/migrate/migrate-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,6 @@ often occurs in optimization problems or chemistry applications. For example, w
Related links
-------------

* `Get started with Estimator <../tutorials/how-to-getting-started-with-estimator.ipynb>`__
* `Get started with Sampler <../tutorials/how-to-getting-started-with-sampler.ipynb>`__
* `Get started with Estimator <../tutorials/how-to-getting-started-with-estimator/index.ipynb>`__
* `Get started with Sampler <../tutorials/how-to-getting-started-with-sampler/index.ipynb>`__
* `Tutorial: Migrate from qiskit-ibmq-provider to qiskit-ibm-provider <https://qiskit.org/documentation/partners/qiskit_ibm_provider/tutorials/Migration_Guide_from_qiskit-ibmq-provider.html>`__
2 changes: 1 addition & 1 deletion docs/migrate/migrate-sampler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ notice that the workflow is now simplified, as the quasi-probability distributio
The ``Sampler`` Runtime primitive offers several features and tuning options that do not have a legacy alternative
to migrate from, but can help improve your performance and results. For more information, refer to the following:

- `Error mitigation tutorial <https://qiskit.org/documentation/partners/qiskit_ibm_runtime/tutorials/Error-Suppression-and-Error-Mitigation.html>`_
- `Error mitigation tutorial <https://qiskit.org/documentation/partners/qiskit_ibm_runtime/tutorials/error-suppression-and-error-mitigation/index.html>`-
- `Setting execution options topic <https://qiskit.org/documentation/partners/qiskit_ibm_runtime/how_to/options.html>`_
- `How to run a session topic <https://qiskit.org/documentation/partners/qiskit_ibm_runtime/how_to/run_session.html>`_

Expand Down
2 changes: 1 addition & 1 deletion docs/migrate/migrate-tuning.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ For more information, and a complete list of advanced transpilation options, see
`Error suppression topic <https://qiskit.org/documentation/partners/qiskit_ibm_runtime/how_to/error-suppression.html#advanced-transpilation-options>`__.

To specify settings that are not available through the primitives interface or use custom transpiler passes, set ``skip_transpilation=True`` to submit user-transpiled circuits. This is described in the
`Submitting user-transpiled circuits using primitives tutorial <https://qiskit.org/documentation/partners/qiskit_ibm_runtime/tutorials/user-transpiled-circuits.html>`_.
`Submitting user-transpiled circuits using primitives tutorial <https://qiskit.org/documentation/partners/qiskit_ibm_runtime/tutorials/user-transpiled-circuits/index.html>`_.

The ``skip_transpilation`` option is an advanced transpilation option, and is set as follows:

Expand Down
4 changes: 2 additions & 2 deletions docs/primitives.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ How to use primitives

Primitive interfaces vary based on the type of task that you want to run on the quantum computer and the corresponding data that you want returned as a result. After identifying the appropriate primitive for your program, you can use Qiskit to prepare inputs, such as circuits, observables (for Estimator), and customizable options to optimize your job. For more information, see the appropriate topic:

* `Getting started with Estimator <./tutorials/how-to-getting-started-with-estimator.ipynb>`__
* `Getting started with Sampler <./tutorials/how-to-getting-started-with-sampler.ipynb>`__
* `Getting started with Estimator <./tutorials/how-to-getting-started-with-estimator/index.ipynb>`__
* `Getting started with Sampler <./tutorials/how-to-getting-started-with-sampler/index.ipynb>`__
* :ref:`Migrate from qiskit-ibmq-provider to qiskit-ibm-runtime <migrate to primitives>`
16 changes: 8 additions & 8 deletions docs/tutorials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ Estimator

.. nbgallery::

tutorials/how-to-getting-started-with-estimator
tutorials/Error-Suppression-and-Error-Mitigation
tutorials/chsh_with_estimator
tutorials/vqe_with_estimator
tutorials/how-to-getting-started-with-estimator/index
tutorials/error-suppression-and-error-mitigation/index
tutorials/chsh-with-estimator/index
tutorials/vqe-with-estimator/index

Sampler
=================================

.. nbgallery::

tutorials/how-to-getting-started-with-sampler
tutorials/grover_with_sampler
tutorials/user-transpiled-circuits
tutorials/qaoa_with_primitives
tutorials/how-to-getting-started-with-sampler/index
tutorials/grover-with-sampler/index
tutorials/user-transpiled-circuits/index
tutorials/qaoa-with-primitives/index


.. Hiding - Indices and tables
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,44 +444,6 @@
"\n",
"qiskit_ibm_runtime.version.get_version_info()"
]
},
{
"cell_type": "code",
"execution_count": 76,
"id": "eb75a5c8",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<h3>Version Information</h3><table><tr><th>Software</th><th>Version</th></tr><tr><td><code>qiskit</code></td><td>0.44.0</td></tr><tr><td><code>qiskit-terra</code></td><td>0.25.0</td></tr><tr><td><code>qiskit_aer</code></td><td>0.12.2</td></tr><tr><td><code>qiskit_ibm_provider</code></td><td>0.6.2</td></tr><tr><td><code>qiskit_ibm_runtime</code></td><td>0.11.2</td></tr><tr><th colspan='2'>System information</th></tr><tr><td>Python version</td><td>3.11.4</td></tr><tr><td>Python compiler</td><td>Clang 15.0.7 </td></tr><tr><td>Python build</td><td>main, Jun 10 2023 18:08:41</td></tr><tr><td>OS</td><td>Darwin</td></tr><tr><td>CPUs</td><td>8</td></tr><tr><td>Memory (Gb)</td><td>16.0</td></tr><tr><td colspan='2'>Wed Aug 02 15:00:01 2023 EDT</td></tr></table>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<div style='width: 100%; background-color:#d5d9e0;padding-left: 10px; padding-bottom: 10px; padding-right: 10px; padding-top: 5px'><h3>This code is a part of Qiskit</h3><p>&copy; Copyright IBM 2017, 2023.</p><p>This code is licensed under the Apache License, Version 2.0. You may<br>obtain a copy of this license in the LICENSE.txt file in the root directory<br> of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.<p>Any modifications or derivative works of this code must retain this<br>copyright notice, and modified files need to carry a notice indicating<br>that they have been altered from the originals.</p></div>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import qiskit.tools.jupyter\n",
"\n",
"%qiskit_version_table\n",
"%qiskit_copyright"
]
}
],
"metadata": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1916,48 +1916,6 @@
"\n",
"qiskit_ibm_runtime.version.get_version_info()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2a773669",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"outputs": [
{
"data": {
"text/html": [
"<h3>Version Information</h3><table><tr><th>Qiskit Software</th><th>Version</th></tr><tr><td><code>qiskit-terra</code></td><td>0.22.2</td></tr><tr><td><code>qiskit-aer</code></td><td>0.11.0</td></tr><tr><td><code>qiskit-ibmq-provider</code></td><td>0.19.2</td></tr><tr><th>System information</th></tr><tr><td>Python version</td><td>3.10.4</td></tr><tr><td>Python compiler</td><td>Clang 12.0.0 </td></tr><tr><td>Python build</td><td>main, Mar 31 2022 03:38:35</td></tr><tr><td>OS</td><td>Darwin</td></tr><tr><td>CPUs</td><td>4</td></tr><tr><td>Memory (Gb)</td><td>16.0</td></tr><tr><td colspan='2'>Tue Nov 08 12:15:46 2022 EST</td></tr></table>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<div style='width: 100%; background-color:#d5d9e0;padding-left: 10px; padding-bottom: 10px; padding-right: 10px; padding-top: 5px'><h3>This code is a part of Qiskit</h3><p>&copy; Copyright IBM 2017, 2022.</p><p>This code is licensed under the Apache License, Version 2.0. You may<br>obtain a copy of this license in the LICENSE.txt file in the root directory<br> of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.<p>Any modifications or derivative works of this code must retain this<br>copyright notice, and modified files need to carry a notice indicating<br>that they have been altered from the originals.</p></div>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from qiskit.tools import jupyter\n",
"\n",
"%qiskit_version_table\n",
"%qiskit_copyright"
]
}
],
"metadata": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,52 +418,6 @@
"\n",
"qiskit_ibm_runtime.version.get_version_info()"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "5e6db65c",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<h3>Version Information</h3><table><tr><th>Qiskit Software</th><th>Version</th></tr><tr><td><code>qiskit-terra</code></td><td>0.24.1</td></tr><tr><td><code>qiskit-aer</code></td><td>0.12.0</td></tr><tr><td><code>qiskit-ibmq-provider</code></td><td>0.20.2</td></tr><tr><td><code>qiskit</code></td><td>0.43.0</td></tr><tr><th>System information</th></tr><tr><td>Python version</td><td>3.11.3</td></tr><tr><td>Python compiler</td><td>Clang 14.0.6 </td></tr><tr><td>Python build</td><td>main, Apr 6 2023 08:58:31</td></tr><tr><td>OS</td><td>Darwin</td></tr><tr><td>CPUs</td><td>8</td></tr><tr><td>Memory (Gb)</td><td>16.0</td></tr><tr><td colspan='2'>Mon Jun 12 17:59:08 2023 EDT</td></tr></table>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<div style='width: 100%; background-color:#d5d9e0;padding-left: 10px; padding-bottom: 10px; padding-right: 10px; padding-top: 5px'><h3>This code is a part of Qiskit</h3><p>&copy; Copyright IBM 2017, 2023.</p><p>This code is licensed under the Apache License, Version 2.0. You may<br>obtain a copy of this license in the LICENSE.txt file in the root directory<br> of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.<p>Any modifications or derivative works of this code must retain this<br>copyright notice, and modified files need to carry a notice indicating<br>that they have been altered from the originals.</p></div>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import qiskit.tools.jupyter\n",
"\n",
"%qiskit_version_table\n",
"%qiskit_copyright"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "984c41ee",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
Loading
Loading