Skip to content

Commit

Permalink
docs: Generate docs using sphinx-autoapi (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
navasvarela authored Nov 13, 2024
1 parent 7c622cc commit cfddbb9
Show file tree
Hide file tree
Showing 23 changed files with 130 additions and 202 deletions.
8 changes: 0 additions & 8 deletions docs/_source/nada_dsl.audit.abstract.rst

This file was deleted.

8 changes: 0 additions & 8 deletions docs/_source/nada_dsl.audit.report.rst

This file was deleted.

8 changes: 0 additions & 8 deletions docs/_source/nada_dsl.audit.strict.rst

This file was deleted.

9 changes: 0 additions & 9 deletions docs/_source/nada_dsl.circuit_io.rst

This file was deleted.

9 changes: 0 additions & 9 deletions docs/_source/nada_dsl.compile.rst

This file was deleted.

9 changes: 0 additions & 9 deletions docs/_source/nada_dsl.compiler_frontend.rst

This file was deleted.

21 changes: 0 additions & 21 deletions docs/_source/nada_dsl.nada_types.rst

This file was deleted.

9 changes: 0 additions & 9 deletions docs/_source/nada_dsl.operations.rst

This file was deleted.

1 change: 0 additions & 1 deletion docs/_source/nada_dsl.rst

This file was deleted.

9 changes: 0 additions & 9 deletions docs/_source/nada_dsl.source_ref.rst

This file was deleted.

9 changes: 0 additions & 9 deletions docs/_templates/module.rst_t

This file was deleted.

36 changes: 0 additions & 36 deletions docs/_templates/package.rst_t

This file was deleted.

8 changes: 0 additions & 8 deletions docs/_templates/toc.rst_t

This file was deleted.

84 changes: 45 additions & 39 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,78 +12,85 @@
#
import os
import sys
sys.path.insert(0, os.path.abspath('..'))

sys.path.insert(0, os.path.abspath(".."))


# -- Project information -----------------------------------------------------

# The name and version are retrieved from ``pyproject.toml`` in the root
# directory.
import toml
with open('../pyproject.toml') as pyproject_file:

with open("../pyproject.toml") as pyproject_file:
pyproject_data = toml.load(pyproject_file)
project = pyproject_data['project']['name']
version = pyproject_data['project']['version']
project = pyproject_data["project"]["name"]
version = pyproject_data["project"]["version"]
release = version

# The copyright year and holder information is retrieved from the
# ``LICENSE`` file.
try:
import re
with open('../LICENSE', 'r') as license_file:
license_string = license_file.read().split('Copyright (c) ')[1]

with open("../LICENSE", "r") as license_file:
license_string = license_file.read().split("Copyright (c) ")[1]
year = license_string[:4]
author = license_string[5:].split('\n')[0]
copyright = year + ', ' + re.sub(r"\.$", "", author) # Period already in HTML.
author = license_string[5:].split("\n")[0]
copyright = year + ", " + re.sub(r"\.$", "", author) # Period already in HTML.
except:
year = ''
author = ''
copyright = ''
year = ""
author = ""
copyright = ""

# -- General configuration ---------------------------------------------------

# 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.napoleon',
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode'
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"sphinx.ext.napoleon",
"sphinx.ext.intersphinx",
"sphinx.ext.viewcode",
"autoapi.extension",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build']
exclude_patterns = ["_build"]

# Options to configure autodoc extension behavior.
autodoc_member_order = 'bysource'
autodoc_member_order = "bysource"
autodoc_default_options = {
'special-members': True,
'exclude-members': ','.join([
'__init__',
'__weakref__',
'__module__',
'__hash__',
'__dict__',
'__annotations__',
'__dataclass_params__',
'__dataclass_fields__',
'__match_args__',
'__repr__',

])
"special-members": True,
"exclude-members": ",".join(
[
"__init__",
"__weakref__",
"__module__",
"__hash__",
"__dict__",
"__annotations__",
"__dataclass_params__",
"__dataclass_fields__",
"__match_args__",
"__repr__",
]
),
}
autodoc_preserve_defaults = True

autoapi_dirs = ["../nada_dsl"]

# Allow references/links to definitions found in the Python documentation.
intersphinx_mapping = {
'python': ('https://docs.python.org/3', None),
"python": ("https://docs.python.org/3", None),
}

# Do not display fully qualified names.
Expand All @@ -95,12 +102,11 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
html_theme = "sphinx_rtd_theme"

# Theme options for Read the Docs.
html_theme_options = {
'display_version': True,
'collapse_navigation': True,
'navigation_depth': 1,
'titles_only': True
"collapse_navigation": True,
"navigation_depth": 4,
"titles_only": True,
}
12 changes: 11 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
.. include:: ../README.rst
.. include:: toc.rst

.. toctree::
:maxdepth: 3
:caption: Reference

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
14 changes: 0 additions & 14 deletions docs/toc.rst

This file was deleted.

11 changes: 9 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,18 @@ version = "0.7.1"
description = "Nillion Nada DSL to create Nillion MPC programs."
requires-python = ">=3.10"
readme = "README.pyproject.md"
dependencies = ["asttokens~=2.4", "richreports~=0.2", "parsial~=0.1", "sortedcontainers~=2.4", "typing_extensions~=4.12.2"]
dependencies = [
"asttokens~=2.4",
"richreports~=0.2",
"parsial~=0.1",
"sortedcontainers~=2.4",
"typing_extensions~=4.12.2",
]
classifiers = ["License :: OSI Approved :: Apache Software License"]
license = { file = "LICENSE" }

[project.optional-dependencies]
docs = ["toml~=0.10.2", "sphinx>=5,<9", "sphinx-rtd-theme>=1.0,<3.1"]
docs = ["toml~=0.10.2", "sphinx>=5,<9", "sphinx-rtd-theme>=1.0,<3.1", "sphinx-autoapi~=3.3.2"]
test = ["pytest>=7.4,<9.0", "pytest-cov>=4,<7"]
lint = ["pylint>=2.17,<3.4"]

Expand All @@ -28,6 +34,7 @@ dev-dependencies = [
"toml~=0.10.2",
"sphinx>=5,<9",
"sphinx-rtd-theme>=1.0,<3.1",
"sphinx-autoapi~=3.3.2",
"pytest>=7.4,<9.0",
"pytest-cov>=4,<7",
"pylint>=2.17,<3.4",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit cfddbb9

Please sign in to comment.