From eb23323280ffe6f7bd5017ae6b961c634f1d1392 Mon Sep 17 00:00:00 2001 From: Dimitri Berthault Date: Mon, 5 Aug 2024 11:23:09 +0200 Subject: [PATCH 1/5] Fix qoqo sphinx documentation --- qoqo/python/qoqo/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/qoqo/python/qoqo/__init__.py b/qoqo/python/qoqo/__init__.py index 95ac7a1f..4f52d029 100644 --- a/qoqo/python/qoqo/__init__.py +++ b/qoqo/python/qoqo/__init__.py @@ -20,10 +20,12 @@ :toctree: generated/ Circuit + CircuitDag operations - registers - measurements QuantumProgram + measurements + devices + noise_models """ from .qoqo import * @@ -32,6 +34,4 @@ from .noise_models import * # type: ignore from .devices import * # type: ignore -__license__ = ( - "Apache-2.0 for linked dependencies see qoqo/LICENSE_FOR_BINARY_DISTRIBUTION" -) +__license__ = "Apache-2.0 for linked dependencies see qoqo/LICENSE_FOR_BINARY_DISTRIBUTION" From f0af5cde18125104cbf03cf2fc18865524aefafb Mon Sep 17 00:00:00 2001 From: Dimitri Berthault Date: Mon, 5 Aug 2024 11:29:04 +0200 Subject: [PATCH 2/5] changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93632e82..a79c95b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ This changelog track changes to the qoqo project starting at version v0.5.0 +## Unreleased + +* Fixed sphinx documentation + ## 1.5.2-alpha.0 ### Added in 1.5.2-alpha.0 From f184305ae6380cedd3f70a73e3e9ea056a80346a Mon Sep 17 00:00:00 2001 From: Dimitri Berthault Date: Mon, 5 Aug 2024 11:33:07 +0200 Subject: [PATCH 3/5] black format --- qoqo/docs/conf.py | 99 ++++++++++++++++++++---------------- qoqo/python/qoqo/__init__.py | 4 +- 2 files changed, 57 insertions(+), 46 deletions(-) diff --git a/qoqo/docs/conf.py b/qoqo/docs/conf.py index b211bb1f..04546944 100644 --- a/qoqo/docs/conf.py +++ b/qoqo/docs/conf.py @@ -3,6 +3,7 @@ # """Configuration of sphinx documentation module""" import tomli + main_version = tomli.load(open("../pyproject.toml", "rb"))["project"]["version"] # -- General configuration ------------------------------------------------ @@ -14,16 +15,18 @@ # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. -extensions = ['sphinx.ext.autodoc', - 'sphinx.ext.doctest', - 'sphinx.ext.todo', - 'sphinx.ext.coverage', - 'sphinx.ext.mathjax', - 'sphinx.ext.viewcode', - 'sphinx.ext.napoleon', - 'sphinx.ext.autosummary', - 'nbsphinx', - 'myst_parser'] +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.doctest", + "sphinx.ext.todo", + "sphinx.ext.coverage", + "sphinx.ext.mathjax", + "sphinx.ext.viewcode", + "sphinx.ext.napoleon", + "sphinx.ext.autosummary", + "nbsphinx", + "myst_parser", +] # automatically use sphinx-autogen autosummary_generate = True autosummary_imported_members = True @@ -34,43 +37,44 @@ # 'both': class and __init__ docstring are concatenated and inserted # 'class': only class docstring inserted # 'init': only init docstring inserted -autoclass_content = 'class' +autoclass_content = "class" # This value is a list of autodoc directive flags that should be automatically applied to # all autodoc directives. The supported flags are 'members', 'undoc-members', # 'private-members', 'special-members', 'inherited-members', 'show-inheritance', # 'ignore-module-all' and 'exclude-members'. -#autodoc_default_flags = ['members', 'exclude-members'] +# autodoc_default_flags = ['members', 'exclude-members'] # The default options for autodoc directives. They are applied to all autodoc directives # automatically. It must be a dictionary which maps option names to the values. autodoc_default_options = { - 'members': True, - 'special-members': False, - 'imported-members': False, - 'private-members': False, - 'inherited-members': False, + "members": True, + "special-members": False, + "imported-members": False, + "private-members": False, + "inherited-members": False, # 'member-order': 'bysource', - 'special-members': False, - 'undoc-members': False, - 'exclude-members': '__init__'} + "special-members": False, + "undoc-members": False, + "exclude-members": "__init__", +} # This value controls the docstrings inheritance. If set to True the docstring for classes # or methods, if not explicitly set, is inherited form parents. autodoc_inherit_docstrings = False # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] source_suffix = { - '.rst': 'restructuredtext', - '.txt': 'markdown', - '.md': 'markdown', + ".rst": "restructuredtext", + ".txt": "markdown", + ".md": "markdown", } # The master toctree document. -master_doc = 'index' +master_doc = "index" # General information about the project. -project = 'qoqo' -copyright = '2021, HQS Quantum Simulations GmbH' -author = 'The qoqo developers' +project = "qoqo" +copyright = "2021, HQS Quantum Simulations GmbH" +author = "The qoqo developers" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -82,15 +86,15 @@ release = version -language = 'English' +language = "English" # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This patterns also effect to html_static_path and html_extra_path -exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'default' +pygments_style = "default" # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = True @@ -119,7 +123,7 @@ # -- Options for HTMLHelp output ------------------------------------------ # Output file base name for HTML help builder. -htmlhelp_basename = 'qoqodoc' +htmlhelp_basename = "qoqodoc" # -- Options for LaTeX output --------------------------------------------- @@ -128,15 +132,12 @@ # The paper size ('letterpaper' or 'a4paper'). # # 'papersize': 'letterpaper', - # The font size ('10pt', '11pt' or '12pt'). # # 'pointsize': '10pt', - # Additional stuff for the LaTeX preamble. # # 'preamble': '', - # Latex figure (float) alignment # # 'figure_align': 'htbp', @@ -146,8 +147,13 @@ # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (master_doc, 'qoqo.tex', 'qoqo Documentation', - 'HQS Quantum Simulations GmbH', 'manual'), + ( + master_doc, + "qoqo.tex", + "qoqo Documentation", + "HQS Quantum Simulations GmbH", + "manual", + ), ] @@ -155,10 +161,7 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [ - (master_doc, 'qoqo', 'qoqo Documentation', - [author], 1) -] +man_pages = [(master_doc, "qoqo", "qoqo Documentation", [author], 1)] # -- Options for Texinfo output ------------------------------------------- @@ -167,10 +170,16 @@ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - (master_doc, 'qoqo', 'qoqo Documentation', - author, 'qoqo', 'One line description of project.', - 'Miscellaneous'), + ( + master_doc, + "qoqo", + "qoqo Documentation", + author, + "qoqo", + "One line description of project.", + "Miscellaneous", + ), ] # Turning off executing notebooks when adding them to Documentation -nbsphinx_execute = 'never' +nbsphinx_execute = "never" diff --git a/qoqo/python/qoqo/__init__.py b/qoqo/python/qoqo/__init__.py index 4f52d029..de778773 100644 --- a/qoqo/python/qoqo/__init__.py +++ b/qoqo/python/qoqo/__init__.py @@ -34,4 +34,6 @@ from .noise_models import * # type: ignore from .devices import * # type: ignore -__license__ = "Apache-2.0 for linked dependencies see qoqo/LICENSE_FOR_BINARY_DISTRIBUTION" +__license__ = ( + "Apache-2.0 for linked dependencies see qoqo/LICENSE_FOR_BINARY_DISTRIBUTION" +) From eb18d874b87c13afdc4809a04e893e103042f0fc Mon Sep 17 00:00:00 2001 From: Dimitri Berthault Date: Mon, 5 Aug 2024 11:34:11 +0200 Subject: [PATCH 4/5] Revert "black format" This reverts commit f184305ae6380cedd3f70a73e3e9ea056a80346a. --- qoqo/docs/conf.py | 99 ++++++++++++++++-------------------- qoqo/python/qoqo/__init__.py | 4 +- 2 files changed, 46 insertions(+), 57 deletions(-) diff --git a/qoqo/docs/conf.py b/qoqo/docs/conf.py index 04546944..b211bb1f 100644 --- a/qoqo/docs/conf.py +++ b/qoqo/docs/conf.py @@ -3,7 +3,6 @@ # """Configuration of sphinx documentation module""" import tomli - main_version = tomli.load(open("../pyproject.toml", "rb"))["project"]["version"] # -- General configuration ------------------------------------------------ @@ -15,18 +14,16 @@ # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. -extensions = [ - "sphinx.ext.autodoc", - "sphinx.ext.doctest", - "sphinx.ext.todo", - "sphinx.ext.coverage", - "sphinx.ext.mathjax", - "sphinx.ext.viewcode", - "sphinx.ext.napoleon", - "sphinx.ext.autosummary", - "nbsphinx", - "myst_parser", -] +extensions = ['sphinx.ext.autodoc', + 'sphinx.ext.doctest', + 'sphinx.ext.todo', + 'sphinx.ext.coverage', + 'sphinx.ext.mathjax', + 'sphinx.ext.viewcode', + 'sphinx.ext.napoleon', + 'sphinx.ext.autosummary', + 'nbsphinx', + 'myst_parser'] # automatically use sphinx-autogen autosummary_generate = True autosummary_imported_members = True @@ -37,44 +34,43 @@ # 'both': class and __init__ docstring are concatenated and inserted # 'class': only class docstring inserted # 'init': only init docstring inserted -autoclass_content = "class" +autoclass_content = 'class' # This value is a list of autodoc directive flags that should be automatically applied to # all autodoc directives. The supported flags are 'members', 'undoc-members', # 'private-members', 'special-members', 'inherited-members', 'show-inheritance', # 'ignore-module-all' and 'exclude-members'. -# autodoc_default_flags = ['members', 'exclude-members'] +#autodoc_default_flags = ['members', 'exclude-members'] # The default options for autodoc directives. They are applied to all autodoc directives # automatically. It must be a dictionary which maps option names to the values. autodoc_default_options = { - "members": True, - "special-members": False, - "imported-members": False, - "private-members": False, - "inherited-members": False, + 'members': True, + 'special-members': False, + 'imported-members': False, + 'private-members': False, + 'inherited-members': False, # 'member-order': 'bysource', - "special-members": False, - "undoc-members": False, - "exclude-members": "__init__", -} + 'special-members': False, + 'undoc-members': False, + 'exclude-members': '__init__'} # This value controls the docstrings inheritance. If set to True the docstring for classes # or methods, if not explicitly set, is inherited form parents. autodoc_inherit_docstrings = False # Add any paths that contain templates here, relative to this directory. -templates_path = ["_templates"] +templates_path = ['_templates'] source_suffix = { - ".rst": "restructuredtext", - ".txt": "markdown", - ".md": "markdown", + '.rst': 'restructuredtext', + '.txt': 'markdown', + '.md': 'markdown', } # The master toctree document. -master_doc = "index" +master_doc = 'index' # General information about the project. -project = "qoqo" -copyright = "2021, HQS Quantum Simulations GmbH" -author = "The qoqo developers" +project = 'qoqo' +copyright = '2021, HQS Quantum Simulations GmbH' +author = 'The qoqo developers' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -86,15 +82,15 @@ release = version -language = "English" +language = 'English' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This patterns also effect to html_static_path and html_extra_path -exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] # The name of the Pygments (syntax highlighting) style to use. -pygments_style = "default" +pygments_style = 'default' # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = True @@ -123,7 +119,7 @@ # -- Options for HTMLHelp output ------------------------------------------ # Output file base name for HTML help builder. -htmlhelp_basename = "qoqodoc" +htmlhelp_basename = 'qoqodoc' # -- Options for LaTeX output --------------------------------------------- @@ -132,12 +128,15 @@ # The paper size ('letterpaper' or 'a4paper'). # # 'papersize': 'letterpaper', + # The font size ('10pt', '11pt' or '12pt'). # # 'pointsize': '10pt', + # Additional stuff for the LaTeX preamble. # # 'preamble': '', + # Latex figure (float) alignment # # 'figure_align': 'htbp', @@ -147,13 +146,8 @@ # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - ( - master_doc, - "qoqo.tex", - "qoqo Documentation", - "HQS Quantum Simulations GmbH", - "manual", - ), + (master_doc, 'qoqo.tex', 'qoqo Documentation', + 'HQS Quantum Simulations GmbH', 'manual'), ] @@ -161,7 +155,10 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [(master_doc, "qoqo", "qoqo Documentation", [author], 1)] +man_pages = [ + (master_doc, 'qoqo', 'qoqo Documentation', + [author], 1) +] # -- Options for Texinfo output ------------------------------------------- @@ -170,16 +167,10 @@ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - ( - master_doc, - "qoqo", - "qoqo Documentation", - author, - "qoqo", - "One line description of project.", - "Miscellaneous", - ), + (master_doc, 'qoqo', 'qoqo Documentation', + author, 'qoqo', 'One line description of project.', + 'Miscellaneous'), ] # Turning off executing notebooks when adding them to Documentation -nbsphinx_execute = "never" +nbsphinx_execute = 'never' diff --git a/qoqo/python/qoqo/__init__.py b/qoqo/python/qoqo/__init__.py index de778773..4f52d029 100644 --- a/qoqo/python/qoqo/__init__.py +++ b/qoqo/python/qoqo/__init__.py @@ -34,6 +34,4 @@ from .noise_models import * # type: ignore from .devices import * # type: ignore -__license__ = ( - "Apache-2.0 for linked dependencies see qoqo/LICENSE_FOR_BINARY_DISTRIBUTION" -) +__license__ = "Apache-2.0 for linked dependencies see qoqo/LICENSE_FOR_BINARY_DISTRIBUTION" From 15756c6934b6e9377b90a3f2004ffaad73920be7 Mon Sep 17 00:00:00 2001 From: Dimitri Berthault Date: Mon, 5 Aug 2024 11:34:55 +0200 Subject: [PATCH 5/5] black format --- qoqo/python/qoqo/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/qoqo/python/qoqo/__init__.py b/qoqo/python/qoqo/__init__.py index 4f52d029..de778773 100644 --- a/qoqo/python/qoqo/__init__.py +++ b/qoqo/python/qoqo/__init__.py @@ -34,4 +34,6 @@ from .noise_models import * # type: ignore from .devices import * # type: ignore -__license__ = "Apache-2.0 for linked dependencies see qoqo/LICENSE_FOR_BINARY_DISTRIBUTION" +__license__ = ( + "Apache-2.0 for linked dependencies see qoqo/LICENSE_FOR_BINARY_DISTRIBUTION" +)