Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
4410ed1
Add docs from terra + dummy tutorial
ElePT Jul 24, 2023
c1440b9
Update requirements-dev
ElePT Jul 24, 2023
4df457b
Update index
ElePT Jul 24, 2023
7b78664
Update init
ElePT Jul 24, 2023
836903f
Update config
ElePT Jul 24, 2023
3343012
Fix copyright
ElePT Jul 24, 2023
4bee472
Add config to makefile
ElePT Jul 24, 2023
4e5ea25
Add config to tox
ElePT Jul 24, 2023
ac0b99e
Update workflows
ElePT Jul 24, 2023
9fa5dbc
Bump tutorials python
ElePT Jul 24, 2023
5242b34
Update deploy docs
ElePT Jul 24, 2023
987c15e
Add docs deploy to tools
ElePT Jul 24, 2023
bd2c87e
Add ignore untagged
ElePT Jul 24, 2023
2433d27
Apply suggestions from Eric's code review
ElePT Jul 24, 2023
bee2d0c
Apply suggestions from Eric's code review
ElePT Jul 24, 2023
cefe5b1
Apply suggestions from code review
ElePT Jul 24, 2023
c05062f
Merge branch 'add-docs-1' of https://github.com/ElePT/qiskit-algorith…
ElePT Jul 24, 2023
3c74953
Add nbsphinx to config
ElePT Jul 24, 2023
af620dd
Add executable attribute
ElePT Jul 24, 2023
684e4be
Fix headers
ElePT Jul 24, 2023
71e3650
Update reqs
ElePT Jul 24, 2023
0c985c5
Remove earliest version
ElePT Jul 24, 2023
268c479
Merge branch 'add-docs-1' of https://github.com/ElePT/qiskit-algorith…
ElePT Jul 24, 2023
546ee09
Update reqs
ElePT Jul 24, 2023
9892b71
Add nbsphinx config
ElePT Jul 25, 2023
9ed17ea
Remove OptimizerSupportLevel
ElePT Jul 25, 2023
8cdda77
Add index and getting started page
ElePT Jul 25, 2023
0aa2198
Merge branch 'main' into add-docs-1
woodsp-ibm Jul 25, 2023
128a0c4
Fix release note and add intersphinx mappings
woodsp-ibm Jul 25, 2023
9958d7a
Apply suggestions from code review
ElePT Jul 26, 2023
bc50a8d
Merge branch 'add-docs-1' of https://github.com/ElePT/qiskit-algorith…
ElePT Jul 26, 2023
385a5bd
Add first release note (#19)
ElePT Jul 25, 2023
e33ddfb
Remove deprecated logic from algorithms (#18)
ElePT Jul 25, 2023
6d797ba
Fix release note and add intersphinx mappings
woodsp-ibm Jul 25, 2023
8e4f83f
Add manual CSS config
ElePT Jul 26, 2023
d6f7499
Merge branch 'add-docs-1' of https://github.com/ElePT/qiskit-algorith…
ElePT Jul 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# This code is part of a Qiskit project.
#
# (C) Copyright IBM 2023.
#
# 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: Deploy Docs

on:
workflow_dispatch:

concurrency:
group: ${{ github.repository }}-${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
docs_publish:
if: ${{ startsWith(github.ref, 'refs/heads/stable') && contains('["mtreinish","Cryoris","ElePT","woodsp-ibm"]', github.actor) }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why this part about the maintainer?

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.

Docs deploy is manually run which publishes them to the live site - we didn't want just anyone to be able to run this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Only people with write access could run it though. Is it necessary to have the extra check?

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.

As far as I am aware anyone can run actions - we set it up for the apps and this is what they have. One could do some more checking again. For now I want to keep it.

runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.8]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: ./.github/actions/install-optimization
with:
os: ${{ matrix.os }}
- name: Install Dependencies
run: |
pip install jupyter qiskit-terra[visualization]
sudo apt-get install -y pandoc graphviz
shell: bash
- name: Build and publish
env:
encrypted_rclone_key: ${{ secrets.encrypted_rclone_key }}
encrypted_rclone_iv: ${{ secrets.encrypted_rclone_iv }}
QISKIT_PARALLEL: False
QISKIT_DOCS_BUILD_TUTORIALS: 'always'
run: |
echo "earliest_version: 0.1.0" >> releasenotes/config.yaml
tools/ignore_untagged_notes.sh
make html
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm surprised these aren't using Tox. I'd recommend that because it will move the configuration of your third-party dependencies (the virtualenv) into tox.ini rather than this YAML file. tox -e docs will install all the right requirements already without CI needing to know about e.g. pip install jupyter.

Copy link
Copy Markdown
Member

@woodsp-ibm woodsp-ibm Jul 24, 2023

Choose a reason for hiding this comment

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

Since the VM is created for each job and requirements etv installed into that base it was all done via makes rather than have yet another virtual env on top of that. I am trying to recall why pip install jupyter - I think it was just a workaround as some transitive dependent that used to be installed did not. Either way this all needs to get setup in an expedited fashion and following what we have working in the apps was the chosen path. Things can be toxified if wanted later, we need to get this all setup and running asap to have the release in the next couple of days.

tools/deploy_documentation.sh
shell: bash
72 changes: 71 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,38 @@ jobs:
run: |
sudo apt-get -y install pandoc graphviz python3-enchant hunspell-en-us
pip install pyenchant
echo "earliest_version: 0.1.0" >> releasenotes/config.yaml
shell: bash
- run: pip check
if: ${{ !cancelled() }}
shell: bash
- name: Copyright Check
run: |
python tools/check_copyright.py -check
if: ${{ !cancelled() }}
shell: bash
- name: Style Check
run: |
make style
if: ${{ !cancelled() }}
shell: bash
- name: Run make html
run: |
make clean_sphinx
make html
Comment on lines +85 to +86
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ditto using tox

cd docs/_build/html
mkdir artifacts
tar -zcvf artifacts/documentation.tar.gz --exclude=./artifacts .
if: ${{ !cancelled() }}
shell: bash
- name: Run upload documentation
uses: actions/upload-artifact@v3
with:
name: documentation
path: docs/_build/html/artifacts/documentation.tar.gz
if: ${{ !cancelled() }}
- run: make doctest
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ditto tox

if: ${{ !cancelled() }}
shell: bash
Algorithms:
runs-on: ${{ matrix.os }}
strategy:
Expand Down Expand Up @@ -129,6 +151,54 @@ jobs:
with:
name: ${{ matrix.os }}-${{ matrix.python-version }}
path: ./ci-artifact-data/*
Tutorials:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
python-version: [ 3.8, 3.11 ]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: |
setup.py
requirements.txt
requirements-dev.txt
- uses: ./.github/actions/install-main-dependencies
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
if: ${{ !startsWith(github.ref, 'refs/heads/stable') && !startsWith(github.base_ref, 'stable/') }}
- uses: ./.github/actions/install-algorithms
with:
os: ${{ matrix.os }}
- name: Install Dependencies
run: |
pip install jupyter qiskit-terra[visualization]
sudo apt-get install -y pandoc graphviz
shell: bash
- name: Run Qiskit Algorithms Tutorials
env:
QISKIT_PARALLEL: False
QISKIT_DOCS_BUILD_TUTORIALS: 'always'
run: |
tools/ignore_untagged_notes.sh
make html
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ditto tox. But also this is much slower than necessary. This will rebuild all the docs. Instead, you only need to run the tutorials to check if they've broken. See Qiskit/qiskit#10443 for how I use nbconvert.

cd docs/_build/html
mkdir artifacts
tar -zcvf artifacts/tutorials.tar.gz --exclude=./artifacts .
shell: bash
- name: Run upload tutorials
uses: actions/upload-artifact@v3
with:
name: tutorials${{ matrix.python-version }}
path: docs/_build/html/artifacts/tutorials.tar.gz
Deprecation_Messages_and_Coverage:
needs: [Checks, Algorithms]
runs-on: ubuntu-latest
Expand Down
14 changes: 12 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ endif
# You can set this variable from the command line.
SPHINXOPTS =

.PHONY: lint style black test test_ci spell copyright coverage clean
.PHONY: lint style black test test_ci spell copyright html doctest clean_sphinx coverage clean

all_check: spell style lint copyright
all_check: spell style lint copyright clean_sphinx html doctest

lint:
pylint -rn qiskit_algorithms test tools
Expand All @@ -58,10 +58,20 @@ test_ci:

spell:
pylint -rn --disable=all --enable=spelling --spelling-dict=en_US --spelling-private-dict-file=.pylintdict qiskit_algorithms test tools
sphinx-build -M spelling docs docs/_build -W -T --keep-going $(SPHINXOPTS)

copyright:
python tools/check_copyright.py

html:
sphinx-build -M html docs docs/_build -W -T --keep-going $(SPHINXOPTS)

doctest:
sphinx-build -M doctest docs docs/_build -W -T --keep-going $(SPHINXOPTS)

clean_sphinx:
make -C docs clean

coverage:
coverage3 run --source qiskit_algorithms -m unittest discover -s test -q
coverage3 report
Expand Down
28 changes: 28 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2023.
#
# 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.

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
31 changes: 31 additions & 0 deletions docs/_static/nbsphinx-gallery.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.nbsphinx-gallery {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
gap: 5px;
margin-top: 1em;
margin-bottom: 1em;
}

.nbsphinx-gallery>a {
padding: 5px;
border: 1px dotted currentColor;
border-radius: 2px;
text-align: center;
}

.nbsphinx-gallery>a:hover {
border-style: solid;
}

.nbsphinx-gallery img {
max-width: 100%;
max-height: 100%;
}

.nbsphinx-gallery>a>div:first-child {
display: flex;
align-items: start;
justify-content: center;
height: 120px;
margin-bottom: 5px;
}
31 changes: 31 additions & 0 deletions docs/_templates/autosummary/class.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{#
We show all the class's methods and attributes on the same page. By default, we document
all methods, including those defined by parent classes.
-#}

{{ objname | escape | underline }}

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}
:no-members:
:show-inheritance:

{% block attributes_summary %}
{% if attributes %}
.. rubric:: Attributes
{% for item in attributes %}
.. autoattribute:: {{ item }}
{%- endfor %}
{% endif %}
{% endblock -%}

{% block methods_summary %}
{% set wanted_methods = (methods | reject('==', '__init__') | list) %}
{% if wanted_methods %}
.. rubric:: Methods
{% for item in wanted_methods %}
.. automethod:: {{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
28 changes: 28 additions & 0 deletions docs/_templates/autosummary/class_no_inherited_members.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{# This is identical to class.rst, except for the filtering in `set wanted_methods`. -#}

{{ objname | escape | underline }}

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}
:no-members:
:show-inheritance:

{% block attributes_summary %}
{% if attributes %}
.. rubric:: Attributes
{% for item in attributes %}
.. autoattribute:: {{ item }}
{%- endfor %}
{% endif %}
{% endblock -%}

{% block methods_summary %}
{% set wanted_methods = (methods | reject('in', inherited_members) | reject('==', '__init__') | list) %}
{% if wanted_methods %}
.. rubric:: Methods
{% for item in wanted_methods %}
.. automethod:: {{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
6 changes: 6 additions & 0 deletions docs/apidocs/algorithms.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.. _qiskit-algorithms:

.. automodule:: qiskit_algorithms
:no-members:
:no-inherited-members:
:no-special-members:
Loading