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

Fix type hints in docs for PUBs and improve Sphinx config #2052

Merged
merged 2 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 0 additions & 10 deletions docs/_templates/autosummary/base.rst

This file was deleted.

15 changes: 8 additions & 7 deletions docs/_templates/autosummary/class.rst
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
{% if referencefile %}
.. include:: {{ referencefile }}
{% endif %}
{#
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 }}
{{ underline }}
{{ objname | escape | underline }}

.. currentmodule:: {{ module }}

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

{% block attributes_summary %}
{% if attributes %}
.. rubric:: Attributes
{% for item in all_attributes %}
{%- if not item.startswith('_') %}
.. autoattribute:: {{ name }}.{{ item }}
.. autoattribute:: {{ item }}
{%- endif -%}
{%- endfor %}
{% endif %}
Expand All @@ -28,7 +29,7 @@
.. rubric:: Methods
{% for item in all_methods %}
{%- if not item.startswith('_') or item in ['__call__', '__mul__', '__getitem__', '__len__'] %}
.. automethod:: {{ name }}.{{ item }}
.. automethod:: {{ item }}
{%- endif -%}
{%- endfor %}

Expand Down
6 changes: 3 additions & 3 deletions docs/apidocs/index.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.. vale off

********************************
qiskit-ibm-runtime API reference
********************************
************************************
``qiskit-ibm-runtime`` API reference
************************************

.. toctree::
:maxdepth: 1
Expand Down
15 changes: 11 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
# This is used by qiskit/documentation to generate links to github.com.
"sphinx.ext.linkcode",
'jupyter_sphinx',
'sphinx_autodoc_typehints',
'nbsphinx',
'sphinxcontrib.katex',
'matplotlib.sphinxext.plot_directive',
Expand Down Expand Up @@ -83,10 +82,19 @@
# -----------------------------------------------------------------------------

autosummary_generate = True

autosummary_generate_overwrite = False
autoclass_content = "both"
autodoc_typehints = "description"
autodoc_default_options = {
'inherited-members': None,
"inherited-members": None,
"show-inheritance": True,
}
autodoc_type_aliases = {
"EstimatorPubLike": "EstimatorPubLike",
"SamplerPubLike": "SamplerPubLike",
}
napoleon_google_docstring = True
napoleon_numpy_docstring = False


# If true, figures, tables and code-blocks are automatically numbered if they
Expand Down Expand Up @@ -130,7 +138,6 @@

html_last_updated_fmt = '%Y/%m/%d'
html_sourcelink_suffix = ''
autoclass_content = 'both'


# ----------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions qiskit_ibm_runtime/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
=======
.. autosummary::
:toctree: ../stubs/
:nosignatures:
QiskitRuntimeService
Estimator
Expand Down
1 change: 1 addition & 0 deletions qiskit_ibm_runtime/debug_tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

.. autosummary::
:toctree: ../stubs/
:nosignatures:

Neat
NeatResult
Expand Down
1 change: 1 addition & 0 deletions qiskit_ibm_runtime/execution_span/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

.. autosummary::
:toctree: ../stubs/
:nosignatures:

DoubleSliceSpan
ExecutionSpan
Expand Down
2 changes: 2 additions & 0 deletions qiskit_ibm_runtime/fake_provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
.. autosummary::
:toctree: ../stubs/
:nosignatures:
FakeProviderForBackendV2
Expand All @@ -106,6 +107,7 @@
.. autosummary::
:toctree: ../stubs/
:nosignatures:
FakeAlgiers
FakeAlmadenV2
Expand Down
2 changes: 2 additions & 0 deletions qiskit_ibm_runtime/options/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@

.. autosummary::
:toctree: ../stubs/
:nosignatures:

EstimatorOptions
SamplerOptions
Expand All @@ -67,6 +68,7 @@

.. autosummary::
:toctree: ../stubs/
:nosignatures:

NoiseLearnerOptions
DynamicalDecouplingOptions
Expand Down
1 change: 1 addition & 0 deletions qiskit_ibm_runtime/transpiler/passes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
.. autosummary::
:toctree: ../stubs/
:nosignatures:
ConvertIdToDelay
ConvertISAToClifford
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
=======
.. autosummary::
:toctree: ../stubs/
:nosignatures:
BlockBasePadder
ALAPScheduleAnalysis
Expand Down
1 change: 1 addition & 0 deletions qiskit_ibm_runtime/utils/noise_learner_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
.. autosummary::
:toctree: ../stubs/
:nosignatures:
PauliLindbladError
LayerError
Expand Down
1 change: 1 addition & 0 deletions qiskit_ibm_runtime/visualization/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
.. autosummary::
:toctree: ../stubs/
:nosignatures:
draw_execution_spans
draw_layer_error_map
Expand Down
2 changes: 0 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ ddt>=1.2.0,!=1.4.0,!=1.4.3
# Documentation
nbsphinx
Sphinx>=6
sphinx-automodapi
sphinx-autodoc-typehints<=1.19.2
jupyter-sphinx
sphinxcontrib-katex==0.9.9
packaging