Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into IS-1182
Browse files Browse the repository at this point in the history
  • Loading branch information
ItamarGoldman committed Nov 9, 2023
2 parents 9f4aa73 + d4b9d14 commit fe64f8e
Show file tree
Hide file tree
Showing 38 changed files with 304 additions and 148 deletions.
33 changes: 32 additions & 1 deletion .github/workflows/cron-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,35 @@ jobs:
if: runner.os == 'macOS'
env:
TEST_TIMEOUT: 120
OMP_NUM_THREADS: 1
OMP_NUM_THREADS: 1
docs:
name: docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-docs-${{ hashFiles('setup.py','requirements.txt','requirements-extras.txt','requirements-dev.txt','constraints.txt') }}
- name: Install Deps
run: |
python -m pip install -U tox
sudo apt-get install -y pandoc graphviz
- name: Build Docs
run: tox -edocs-terra-main
- name: Compress Artifacts
run: |
mkdir artifacts
tar -Jcvf html_docs.tar.xz docs/_build/html
mv html_docs.tar.xz artifacts/.
- uses: actions/upload-artifact@v3
with:
name: html_docs
path: artifacts
12 changes: 4 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,21 +104,17 @@ https://stestr.readthedocs.io/en/stable/MANUAL.html#test-selection
If you want to run a single test module, test class, or individual test method you can
do this faster with the `-n`/`--no-discover` option. For example, to run a module:
```
tox -- -n test.python.test_examples
tox -epy310 -- -n test.framework.test_composite
```
Or to run the same module by path:

```
tox -- -n test/python/test_examples.py
```
To run a class:

```
tox -- -n test.python.test_examples.TestPythonExamples
tox -epy310 -- -n test.framework.test_composite.TestCompositeExperimentData
```

To run a method:
```
tox -- -n test.python.test_examples.TestPythonExamples.test_all_examples
tox -epy310 -- -n test.framework.test_composite.TestCompositeExperimentData.test_composite_save_load
```

Note that tests will fail automatically if they do not finish execution within 60 seconds.
Expand Down
4 changes: 2 additions & 2 deletions docs/_ext/custom_styles/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def format_header(self, lines: List[str]) -> List[str]:
def format_overview(self, lines: List[str]) -> List[str]:
"""Format overview section."""
format_lines = [
""
"",
".. rubric:: Overview",
"",
]
Expand Down Expand Up @@ -167,7 +167,7 @@ def format_analysis_opts(self, lines: List[str]) -> List[str]:
format_lines = [
".. rubric:: Analysis options",
"",
"These are the keyword arguments of :meth:`run` method.",
"These are the keyword arguments of the :meth:`run` method.",
"",
]
for line in _write_options(lines, self.indent):
Expand Down
7 changes: 5 additions & 2 deletions docs/_ext/custom_styles/option_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from sphinx.ext.napoleon import GoogleDocstring


_parameter_doc_regex = re.compile(r'(.+?)\(\s*(.*[^\s]+)\s*\):(.*[^\s]+)')
_parameter_doc_regex = re.compile(r"(.+?)\(\s*(.*[^\s]+)\s*\):(.*[^\s]+)")


class QiskitExperimentsOptionsDocstring(GoogleDocstring):
Expand Down Expand Up @@ -201,8 +201,11 @@ def _value_repr(value: Any) -> str:
return f"{{{dict_repr}}}"
if value.__class__.__module__ == "builtins":
return f":obj:`{value}`"
if value.__class__.__module__.startswith("qiskit"):
if value.__class__.__module__ and value.__class__.__module__.startswith("qiskit"):
return f"Instance of :class:`.{value.__class__.__name__}`"
# for singleton gates that don't have directly accessible module names
if hasattr(value, "base_class") and value.base_class.__module__.startswith("qiskit"):
return f"Instance of :class:`.{value.base_class.__name__}`"
if callable(value):
return f"Callable :func:`{value.__name__}`"
if isinstance(value, np.ndarray):
Expand Down
10 changes: 3 additions & 7 deletions docs/_templates/autosummary/analysis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@

.. rubric:: Attributes

.. autosummary::
:toctree: ../stubs/
{% for item in all_attributes %}
{%- if not item.startswith('_') %}
{{ name }}.{{ item }}
.. autoattribute:: {{ name }}.{{ item }}
{%- endif -%}
{%- endfor %}
{% endif %}
Expand All @@ -32,16 +30,14 @@

.. rubric:: Methods

.. autosummary::
:toctree: ../stubs/
{% for item in all_methods %}
{%- if not item.startswith('_') or item in ['__call__', '__mul__', '__getitem__', '__len__'] %}
{{ name }}.{{ item }}
.. automethod:: {{ name }}.{{ item }}
{%- endif -%}
{%- endfor %}
{% for item in inherited_members %}
{%- if item in ['__call__', '__mul__', '__getitem__', '__len__'] %}
{{ name }}.{{ item }}
.. automethod:: {{ name }}.{{ item }}
{%- endif -%}
{%- endfor %}

Expand Down
61 changes: 20 additions & 41 deletions docs/_templates/autosummary/class.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,58 +12,37 @@
:no-inherited-members:
:no-special-members:

{% block attributes_summary %}
{% if attributes %}
{% block attributes_summary %}

{# This counter lets us only render the heading if there's at least
one valid entry. #}
{% set count = namespace(value=0) %}
{% set wanted_attributes = [] %}
{% for item in attributes%}
{%- if not item.startswith('_') %}
{% set _ = wanted_attributes.append(item)%}
{%- endif -%}
{%- endfor %}

{% for item in attributes %}
{% if not item.startswith('_') %}
{% set count.value = count.value + 1 %}
{% if count.value == 1 %}
{% if wanted_attributes %}
.. rubric:: Attributes

.. autosummary::
:toctree: ../stubs/
{% endif %}

{{ name }}.{{ item }}
{% endif %}
{% endfor %}
{% for item in wanted_attributes %}
.. autoattribute:: {{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
{% endblock %}

{% block methods_summary %}
{% if methods %}
{% block methods_summary %}

{% set count = namespace(value=0) %}
{% set wanted_methods = [] %}
{% for item in all_methods %}

{%- if not item.startswith('_') or item in ['__call__', '__mul__', '__getitem__', '__len__'] %}
{% set count.value = count.value + 1 %}
{% if count.value == 1 %}
.. rubric:: Methods

.. autosummary::
:toctree: ../stubs/
{% endif %}
{{ name }}.{{ item }}
{% set _ = wanted_methods.append(item)%}
{%- endif -%}
{%- endfor %}
{% for item in inherited_members %}
{%- if item in ['__call__', '__mul__', '__getitem__', '__len__'] %}
{% set count.value = count.value + 1 %}
{% if count.value == 1 %}
.. rubric:: Methods

.. autosummary::
:toctree: ../stubs/
{% endif %}
{{ name }}.{{ item }}
{%- endif -%}
{% if wanted_methods%}
.. rubric:: Methods
{% for item in wanted_methods %}
.. automethod:: {{ name }}.{{ item }}
{%- endfor %}

{% endif %}
{% endblock %}
{% endblock %}
52 changes: 52 additions & 0 deletions docs/_templates/autosummary/class_no_inherited_members.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{# This is identical to class.rst, except for the filtering of the inherited_members. -#}

{% if referencefile %}
.. include:: {{ referencefile }}
{% endif %}

{{ objname }}
{{ underline }}

.. currentmodule:: {{ module }}

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

{% block attributes_summary %}

{% set wanted_attributes = [] %}
{% for item in attributes%}
{%- if not item.startswith('_') %}
{% set _ = wanted_attributes.append(item)%}
{%- endif -%}
{%- endfor %}

{% if wanted_attributes%}
.. rubric:: Attributes
{% for item in wanted_attributes %}
.. autoattribute:: {{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block methods_summary %}

{% set wanted_methods = [] %}
{% for item in all_methods %}
{%- if item not in inherited_members %}
{%- if not item.startswith('_') or item in ['__call__', '__mul__', '__getitem__', '__len__'] %}
{% set _ = wanted_methods.append(item)%}
{%- endif -%}
{%- endif -%}
{%- endfor %}

{% if wanted_methods %}
.. rubric:: Methods
{% for item in wanted_methods %}
.. automethod:: {{ name }}.{{ item }}
{%- endfor %}

{% endif %}
{% endblock %}
10 changes: 3 additions & 7 deletions docs/_templates/autosummary/drawer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@

.. rubric:: Attributes

.. autosummary::
:toctree: ../stubs/
{% for item in all_attributes %}
{%- if not item.startswith('_') %}
{{ name }}.{{ item }}
.. autoattribute:: {{ name }}.{{ item }}
{%- endif -%}
{%- endfor %}
{% endif %}
Expand All @@ -32,16 +30,14 @@

.. rubric:: Methods

.. autosummary::
:toctree: ../stubs/
{% for item in all_methods %}
{%- if not item.startswith('_') or item in ['__call__', '__mul__', '__getitem__', '__len__'] %}
{{ name }}.{{ item }}
.. automethod:: {{ name }}.{{ item }}
{%- endif -%}
{%- endfor %}
{% for item in inherited_members %}
{%- if item in ['__call__', '__mul__', '__getitem__', '__len__'] %}
{{ name }}.{{ item }}
.. automethod:: {{ name }}.{{ item }}
{%- endif -%}
{%- endfor %}

Expand Down
10 changes: 3 additions & 7 deletions docs/_templates/autosummary/experiment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@

.. rubric:: Attributes

.. autosummary::
:toctree: ../stubs/
{% for item in all_attributes %}
{%- if not item.startswith('_') %}
{{ name }}.{{ item }}
.. autoattribute:: {{ name }}.{{ item }}
{%- endif -%}
{%- endfor %}
{% endif %}
Expand All @@ -32,16 +30,14 @@

.. rubric:: Methods

.. autosummary::
:toctree: ../stubs/
{% for item in all_methods %}
{%- if not item.startswith('_') or item in ['__call__', '__mul__', '__getitem__', '__len__'] %}
{{ name }}.{{ item }}
.. automethod:: {{ name }}.{{ item }}
{%- endif -%}
{%- endfor %}
{% for item in inherited_members %}
{%- if item in ['__call__', '__mul__', '__getitem__', '__len__'] %}
{{ name }}.{{ item }}
.. automethod:: {{ name }}.{{ item }}
{%- endif -%}
{%- endfor %}

Expand Down
11 changes: 3 additions & 8 deletions docs/_templates/autosummary/plotter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@

.. rubric:: Attributes

.. autosummary::
:toctree: ../stubs/
{% for item in all_attributes %}
{%- if not item.startswith('_') %}
{{ name }}.{{ item }}
.. autoattribute:: {{ name }}.{{ item }}
{%- endif -%}
{%- endfor %}
{% endif %}
Expand All @@ -32,17 +30,14 @@

.. rubric:: Methods

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

{% for item in all_methods %}
{%- if not item.startswith('_') or item in ['__call__', '__mul__', '__getitem__', '__len__'] %}
{{ name }}.{{ item }}
.. automethod:: {{ name }}.{{ item }}
{%- endif -%}
{%- endfor %}
{% for item in inherited_members %}
{%- if item in ['__call__', '__mul__', '__getitem__', '__len__'] %}
{{ name }}.{{ item }}
.. automethod:: {{ name }}.{{ item }}
{%- endif -%}
{%- endfor %}

Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@
"qiskit_ibm_provider": ("https://qiskit.org/ecosystem/ibm-provider/", None),
"qiskit_aer": ("https://qiskit.org/ecosystem/aer", None),
"qiskit_dynamics": ("https://qiskit.org/documentation/dynamics", None),
"qiskit_ibm_runtime": ("https://qiskit.org/ecosystem/ibm-runtime/", None),
}


Expand Down
9 changes: 1 addition & 8 deletions docs/howtos/cloud_service.rst
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,4 @@ Web interface

You can also view experiment results as well as change the tags and share level at the `IBM Quantum Experiments
pane <https://quantum-computing.ibm.com/experiments?date_interval=last-90-days&owner=me>`__
on the cloud. The documentation below explains how to view, search, and share experiment
data entries.

See also
--------

* `Experiments web interface documentation <https://quantum-computing.ibm.com/lab/docs/iql/manage/experiments/>`__

on the cloud.
Loading

0 comments on commit fe64f8e

Please sign in to comment.