-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sphinx documentation for the Python API (#40)
* Add reST stubs for Jet Python package * Add generated Python API docs to 'clean' target * Update conf.py to generate Python API docs * Include autosummary templates based on SF and PL * Fix Doxygen comment formatting in Tensor.hpp * Add module docstring to jet package * Move constructor docstrings to class docstrings * Update changelog * Update PR number in changelog * Update name of TBCC to TBC after merge * Remove trivial inheritance diagram from circuit.py * Fix 'Key Concepts' and 'Getting Started' quick links * Replace tensors.html link with introduction.html * Add API documentation for Python bindings * Update TensorNetworkIO docstrings to match Python package conventions * Update TensorNetwork docstrings to match Python package conventions * Update Tensor docstrings to match Python package conventions * Update TBC docstrings to match Python package conventions * Update PathInfo docstrings to match Python package conventions * Apply C++ formatter * Remove redundant import * Add examples to interpreter.py docstrings * Build Python wheel in documentation workflow * Apply suggestions from code review Co-authored-by: Josh Izaac <[email protected]> * Remove MagicMock() modules * Restore tildes to remove class ambiguity * Update 'docs' target to install Python package * Install wheel prior to installing quantum-jet wheel * Defer *.whl wildcard expansion by creating 'dist' target * Fix typo in 'dist' target * Fix accidental blockquote caused by docstring indentation * Distinguish overloaded functions and methods * Restore use of josh146/sphinx-action GitHub Action * Apply suggested Sphinx build options * Move Sphinx options to 'docs' target of Makefile * Use Haskell syntax highlighting in XIR blocks * Replace 'cd' with Makefile '-C' flag * Try quotes around build command * Restore GitHub Actions workflow * Replace '.Class' with 'jet.Class' Co-authored-by: Josh Izaac <[email protected]>
- Loading branch information
1 parent
ab94b1a
commit 29805e4
Showing
33 changed files
with
1,142 additions
and
606 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,4 +51,5 @@ docs/__pycache__/* | |
docs/_build/* | ||
docs/_ext/__pycache__/* | ||
docs/api/* | ||
docs/code/api/* | ||
docs/doxyoutput/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{{ fullname | escape | underline}} | ||
|
||
.. currentmodule:: {{ module }} | ||
|
||
.. auto{{ objtype }}:: {{ objname }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
{{ fullname }} | ||
{{ underline }} | ||
|
||
.. autoclass:: {{ fullname }} | ||
:show-inheritance: | ||
|
||
{% if '__init__' in methods %} | ||
{% set caught_result = methods.remove('__init__') %} | ||
{% endif %} | ||
|
||
{% block attributes_documentation %} | ||
{% if attributes %} | ||
|
||
.. raw:: html | ||
|
||
<a class="attr-details-header collapse-header" data-toggle="collapse" href="#attrDetails" aria-expanded="false" aria-controls="attrDetails"> | ||
<h2 style="font-size: 24px;"> | ||
<i class="fas fa-angle-down rotate" style="float: right;"></i> Attributes | ||
</h2> | ||
</a> | ||
<div class="collapse" id="attrDetails"> | ||
|
||
{% block attributes_summary %} | ||
{% if attributes %} | ||
|
||
.. autosummary:: | ||
:nosignatures: | ||
{% for item in attributes %} | ||
~{{ name }}.{{ item }} | ||
{%- endfor %} | ||
|
||
{% endif %} | ||
{% endblock %} | ||
|
||
{% for item in attributes %} | ||
.. autoattribute:: {{ item }} | ||
{%- endfor %} | ||
|
||
.. raw:: html | ||
|
||
</div> | ||
|
||
{% endif %} | ||
{% endblock %} | ||
|
||
{% block methods_documentation %} | ||
{% if methods %} | ||
|
||
.. raw:: html | ||
|
||
<a class="meth-details-header collapse-header" data-toggle="collapse" href="#methDetails" aria-expanded="false" aria-controls="methDetails"> | ||
<h2 style="font-size: 24px;"> | ||
<i class="fas fa-angle-down rotate" style="float: right;"></i> Methods | ||
</h2> | ||
</a> | ||
<div class="collapse" id="methDetails"> | ||
|
||
{% block methods_summary %} | ||
{% if methods %} | ||
|
||
.. autosummary:: | ||
{% for item in methods %} | ||
~{{ name }}.{{ item }} | ||
{%- endfor %} | ||
|
||
{% endif %} | ||
{% endblock %} | ||
|
||
{% for item in methods %} | ||
.. automethod:: {{ item }} | ||
{%- endfor %} | ||
|
||
.. raw:: html | ||
|
||
</div> | ||
|
||
{% endif %} | ||
{% endblock %} | ||
|
||
.. raw:: html | ||
|
||
<script type="text/javascript"> | ||
$(".collapse-header").click(function () { | ||
$(this).children('h2').eq(0).children('i').eq(0).toggleClass("up"); | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{{ fullname | escape | underline}} | ||
|
||
.. automodule:: {{ fullname }} | ||
|
||
{% block classes %} | ||
{% if classes %} | ||
.. rubric:: Classes | ||
|
||
.. autosummary:: | ||
:toctree: | ||
|
||
{% for item in classes %} | ||
{{ item }} | ||
{%- endfor %} | ||
{% endif %} | ||
{% endblock %} | ||
|
||
{% block functions %} | ||
{% if functions %} | ||
.. rubric:: Functions | ||
|
||
.. autosummary:: | ||
:toctree: | ||
|
||
{% for item in functions %} | ||
{{ item }} | ||
{%- endfor %} | ||
{% endif %} | ||
{% endblock %} | ||
|
||
{% block exceptions %} | ||
{% if exceptions %} | ||
.. rubric:: Exceptions | ||
|
||
.. autosummary:: | ||
{% for item in exceptions %} | ||
{{ item }} | ||
{%- endfor %} | ||
{% endif %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{% if referencefile %} | ||
.. include:: {{ referencefile }} | ||
{% endif %} | ||
|
||
{% if module.split(".")[1:] | length >= 1 %} | ||
{% set mod = module.split(".")[1:] | join(".") %} | ||
{% set mod = "jet." + mod %} | ||
{% else %} | ||
{% set mod = "jet" %} | ||
{% endif %} | ||
|
||
{{ mod }}.{{ objname }} | ||
={% for i in range(mod|length) %}={% endfor %}{{ underline }} | ||
|
||
.. currentmodule:: {{ module }} | ||
|
||
.. auto{{ objtype }}:: {{ objname }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
{% if referencefile %} | ||
.. include:: {{ referencefile }} | ||
{% endif %} | ||
|
||
{% if module.split(".")[1:] | length >= 1 %} | ||
{% set mod = module.split(".")[1:] | join(".") %} | ||
{% set mod = "jet." + mod %} | ||
{% else %} | ||
{% set mod = "jet" %} | ||
{% endif %} | ||
|
||
{{ mod }}.{{ objname }} | ||
={% for i in range(mod|length) %}={% endfor %}{{ underline }} | ||
|
||
.. currentmodule:: {{ module }} | ||
|
||
.. autoclass:: {{ objname }} | ||
:show-inheritance: | ||
|
||
{% if '__init__' in methods %} | ||
{% set caught_result = methods.remove('__init__') %} | ||
{% endif %} | ||
|
||
{% block attributes_documentation %} | ||
{% if attributes %} | ||
|
||
.. raw:: html | ||
|
||
<a class="attr-details-header collapse-header" data-toggle="collapse" href="#attrDetails" aria-expanded="false" aria-controls="attrDetails"> | ||
<h2 style="font-size: 24px;"> | ||
<i class="fas fa-angle-down rotate" style="float: right;"></i> Attributes | ||
</h2> | ||
</a> | ||
<div class="collapse" id="attrDetails"> | ||
|
||
{% block attributes_summary %} | ||
{% if attributes %} | ||
|
||
.. autosummary:: | ||
:nosignatures: | ||
{% for item in attributes %} | ||
~{{ name }}.{{ item }} | ||
{%- endfor %} | ||
|
||
{% endif %} | ||
{% endblock %} | ||
|
||
{% for item in attributes %} | ||
.. autoattribute:: {{ item }} | ||
{%- endfor %} | ||
|
||
.. raw:: html | ||
|
||
</div> | ||
|
||
{% endif %} | ||
{% endblock %} | ||
|
||
{% block methods_documentation %} | ||
{% if methods %} | ||
|
||
.. raw:: html | ||
|
||
<a class="meth-details-header collapse-header" data-toggle="collapse" href="#methDetails" aria-expanded="false" aria-controls="methDetails"> | ||
<h2 style="font-size: 24px;"> | ||
<i class="fas fa-angle-down rotate" style="float: right;"></i> Methods | ||
</h2> | ||
</a> | ||
<div class="collapse" id="methDetails"> | ||
|
||
{% block methods_summary %} | ||
{% if methods %} | ||
|
||
.. autosummary:: | ||
{% for item in methods %} | ||
~{{ name }}.{{ item }} | ||
{%- endfor %} | ||
|
||
{% endif %} | ||
{% endblock %} | ||
|
||
{% for item in methods %} | ||
.. automethod:: {{ item }} | ||
{%- endfor %} | ||
|
||
.. raw:: html | ||
|
||
</div> | ||
|
||
{% endif %} | ||
{% endblock %} | ||
|
||
.. raw:: html | ||
|
||
<script type="text/javascript"> | ||
$(".collapse-header").click(function () { | ||
$(this).children('h2').eq(0).children('i').eq(0).toggleClass("up"); | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{% if referencefile %} | ||
.. include:: {{ referencefile }} | ||
{% endif %} | ||
|
||
{% if module.split(".")[1:] | length >= 1 %} | ||
{% set mod = module.split(".")[1:] | join(".") %} | ||
{% set mod = "jet." + mod %} | ||
{% else %} | ||
{% set mod = "jet" %} | ||
{% endif %} | ||
|
||
{{ mod }}.{{ objname }} | ||
={% for i in range(mod|length) %}={% endfor %}{{ underline }} | ||
|
||
.. automodule:: {{ fullname }} | ||
|
||
{% block functions %} | ||
{% if functions %} | ||
.. rubric:: Functions | ||
|
||
.. autosummary:: | ||
{% for item in functions %} | ||
{{ item }} | ||
{%- endfor %} | ||
{% endif %} | ||
{% endblock %} | ||
|
||
{% block classes %} | ||
{% if classes %} | ||
.. rubric:: Classes | ||
|
||
.. autosummary:: | ||
{% for item in classes %} | ||
{{ item }} | ||
{%- endfor %} | ||
{% endif %} | ||
{% endblock %} | ||
|
||
{% block exceptions %} | ||
{% if exceptions %} | ||
.. rubric:: Exceptions | ||
|
||
.. autosummary:: | ||
{% for item in exceptions %} | ||
{{ item }} | ||
{%- endfor %} | ||
{% endif %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
jet | ||
=== | ||
|
||
.. currentmodule:: jet | ||
|
||
.. automodapi:: jet | ||
:no-heading: | ||
:include-all-objects: | ||
:skip: version | ||
:skip: TaskBasedContractorType | ||
:skip: TensorNetworkFileType | ||
:skip: TensorNetworkSerializerType | ||
:skip: TensorNetworkType | ||
:skip: TensorType |
Oops, something went wrong.