-
Notifications
You must be signed in to change notification settings - Fork 79
Add docs infrastructure #13
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
Changes from all commits
4410ed1
c1440b9
4df457b
7b78664
836903f
3343012
4bee472
4e5ea25
ac0b99e
9fa5dbc
5242b34
987c15e
bd2c87e
2433d27
bee2d0c
cefe5b1
c05062f
3c74953
af620dd
684e4be
71e3650
0c985c5
268c479
546ee09
9892b71
9ed17ea
8cdda77
0aa2198
128a0c4
9958d7a
bc50a8d
385a5bd
e33ddfb
6d797ba
8e4f83f
d6f7499
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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) }} | ||
| 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 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto tox |
||
| if: ${{ !cancelled() }} | ||
| shell: bash | ||
| Algorithms: | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
|
|
@@ -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 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| 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 | ||
|
|
||
| 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) |
| 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; | ||
| } |
| 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 %} |
| 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 %} |
| 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: |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.