-
Notifications
You must be signed in to change notification settings - Fork 80
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 5 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,28 @@ | ||
| # This code is part of Qiskit. | ||
| # | ||
| # (C) Copyright IBM 2018. | ||
| # | ||
| # 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 @@ | ||
| {# | ||
| 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: |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| # This code is part of Qiskit. | ||
| # | ||
| # (C) Copyright IBM 2018. | ||
| # | ||
| # 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. | ||
|
|
||
| # pylint: disable=invalid-name | ||
|
|
||
| """Sphinx documentation builder.""" | ||
|
|
||
| # -- General configuration --------------------------------------------------- | ||
| import datetime | ||
| import doctest | ||
|
|
||
| import os | ||
| import sys | ||
|
|
||
| sys.path.insert(0, os.path.abspath("..")) | ||
| sys.path.append(os.path.abspath(".")) | ||
|
ElePT marked this conversation as resolved.
|
||
|
|
||
| project = "Qiskit Algorithms" | ||
| copyright = f"2017-{datetime.date.today().year}, Qiskit Algorithms Development Team" # pylint: disable=redefined-builtin | ||
|
woodsp-ibm marked this conversation as resolved.
|
||
| author = "Qiskit Algorithms Development Team" | ||
|
|
||
| # The short X.Y version | ||
| version = "0.1" | ||
| # The full version, including alpha/beta/rc tags | ||
| release = "0.1.0" | ||
|
|
||
| extensions = [ | ||
| "sphinx.ext.napoleon", | ||
| "sphinx.ext.autodoc", | ||
| "sphinx.ext.autosummary", | ||
| "sphinx.ext.mathjax", | ||
| "sphinx.ext.viewcode", | ||
| "sphinx.ext.extlinks", | ||
| "sphinx.ext.intersphinx", | ||
| "sphinx.ext.doctest", | ||
| "reno.sphinxext", | ||
| "sphinx_design", | ||
| "matplotlib.sphinxext.plot_directive", | ||
| "sphinx.ext.doctest" | ||
| ] | ||
|
ElePT marked this conversation as resolved.
|
||
|
|
||
| templates_path = ["_templates"] | ||
|
|
||
| # Number figures, tables and code-blocks if they have a caption. | ||
| numfig = True | ||
| # Available keys are 'figure', 'table', 'code-block' and 'section'. '%s' is the number. | ||
| numfig_format = {"table": "Table %s"} | ||
|
|
||
| # The language for content autogenerated by Sphinx or the default for gettext content translation. | ||
|
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 personally find all of these comments noisy. |
||
| language = "en" | ||
|
|
||
| # Relative to source directory, affects general discovery, and html_static_path and html_extra_path. | ||
| exclude_patterns = ["_build", "**.ipynb_checkpoints"] | ||
|
|
||
| pygments_style = "colorful" | ||
|
|
||
| # Whether module names are included in crossrefs of functions, classes, etc. | ||
| add_module_names = False | ||
|
|
||
| # A list of prefixes that are ignored for sorting the Python module index | ||
| # (e.g., if this is set to ['foo.'], then foo.bar is shown under B, not F). | ||
| modindex_common_prefix = ["qiskit."] | ||
|
|
||
| intersphinx_mapping = { | ||
| "rustworkx": ("https://qiskit.org/ecosystem/rustworkx/", None), | ||
| "qiskit-ibm-runtime": ("https://qiskit.org/ecosystem/ibm-runtime/", None), | ||
| "qiskit-aer": ("https://qiskit.org/ecosystem/aer/", None), | ||
| "numpy": ("https://numpy.org/doc/stable/", None), | ||
| "matplotlib": ("https://matplotlib.org/stable/", None), | ||
|
ElePT marked this conversation as resolved.
Outdated
|
||
| } | ||
|
|
||
| # -- Options for HTML output ------------------------------------------------- | ||
|
|
||
| html_theme = "qiskit_sphinx_theme" | ||
| html_last_updated_fmt = "%Y/%m/%d" | ||
| html_theme_options = { | ||
| "logo_only": True, | ||
| "display_version": True, | ||
| "prev_next_buttons_location": "bottom", | ||
| "style_external_links": True, | ||
| } | ||
|
ElePT marked this conversation as resolved.
Outdated
|
||
|
|
||
|
|
||
| # -- Options for Autosummary and Autodoc ------------------------------------- | ||
|
|
||
| # Note that setting autodoc defaults here may not have as much of an effect as you may expect; any | ||
| # documentation created by autosummary uses a template file (in autosummary in the templates path), | ||
| # which likely overrides the autodoc defaults. | ||
|
|
||
| # Move type hints from signatures to the parameter descriptions (except in overload cases, where | ||
| # that's not possible). | ||
| autodoc_typehints = "description" | ||
| # Only add type hints from signature to description body if the parameter has documentation. The | ||
| # return type is always added to the description (if in the signature). | ||
| autodoc_typehints_description_target = "documented_params" | ||
|
|
||
| autosummary_generate = True | ||
| autosummary_generate_overwrite = False | ||
| autoclass_content = "both" | ||
|
|
||
|
|
||
| # -- Options for Doctest -------------------------------------------------------- | ||
|
|
||
| doctest_default_flags = ( | ||
|
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. Are you using doctest?
Collaborator
Author
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. It's ran but not used anywhere yet. I think it could be useful if we added a "getting started" page with a code example like the apps modules do. |
||
| doctest.ELLIPSIS | ||
| | doctest.NORMALIZE_WHITESPACE | ||
| | doctest.IGNORE_EXCEPTION_DETAIL | ||
| | doctest.DONT_ACCEPT_TRUE_FOR_1 | ||
| ) | ||
|
|
||
| # Leaving this string empty disables testing of doctest blocks from docstrings. | ||
| # Doctest blocks are structures like this one: | ||
| # >> code | ||
| # output | ||
| doctest_test_doctest_blocks = "" | ||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,17 @@ | ||||||||||
| ################################ | ||||||||||
| Qiskit Algorithms documentation | ||||||||||
| ################################ | ||||||||||
|
|
||||||||||
|
|
||||||||||
|
Comment on lines
+4
to
+21
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. I guess this really ought to have something in it as otherwise one is looking more or less a blank page when things start out. An overview for example like we have in the apps. We should also have a Getting Started too. (Once CI is running ok with what is already here of course!) |
||||||||||
| .. toctree:: | ||||||||||
| :hidden: | ||||||||||
|
|
||||||||||
| API References <apidocs/algorithms> | ||||||||||
|
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.
Suggested change
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. A minor comment. In the apps the reference text is 'Overview' which is also what is on the page. As
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 don't have a strong preference :) Others use |
||||||||||
| Tutorials <tutorials/index> | ||||||||||
| Release Notes <release_notes> | ||||||||||
| GitHub <https://github.com/qiskit-community/qiskit-algorithms> | ||||||||||
|
|
||||||||||
| .. Hiding - Indices and tables | ||||||||||
| :ref:`genindex` | ||||||||||
| :ref:`modindex` | ||||||||||
| :ref:`search` | ||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| .. release-notes:: Release Notes |
Uh oh!
There was an error while loading. Please reload this page.