Skip to content

Commit

Permalink
Add sphinx doc
Browse files Browse the repository at this point in the history
  • Loading branch information
jschueller committed Sep 19, 2024
1 parent 187d152 commit 6f65394
Show file tree
Hide file tree
Showing 30 changed files with 1,428 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
flake8 otbenchmark
black-nb --check examples
black-nb --check examples-on-server
make html -C doc
- name: Test
shell: bash -l {0}
run: |
Expand Down
20 changes: 20 additions & 0 deletions doc/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?= -W -T
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
25 changes: 25 additions & 0 deletions doc/_static/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.toggle .header {
display: block;
clear: both;
cursor: pointer;
}


.toggle .header:after {
content: " ▼";
}

.toggle .header.open:after {
content: " ▲";
}

/* hide the top link */
div.sphx-glr-download-link-note {
height: 0px;
visibility: hidden;
}

/* Remove big whitespace to solve #1642 */
pre, div[class*="highlight-"] {
clear: left;
}
12 changes: 12 additions & 0 deletions doc/_templates/class.rst_t
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{ objname }}
{{ underline }}

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}

{% block methods %}
.. automethod:: __init__
{% endblock %}


16 changes: 16 additions & 0 deletions doc/_templates/page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{% extends "!page.html" %}

{% set css_files = css_files + ["_static/custom.css"] %}

{% block footer %}
<script type="text/javascript">
$(document).ready(function() {
$(".toggle > *").hide();
$(".toggle .header").show();
$(".toggle .header").click(function() {
$(this).parent().children().not(".header").toggle(400);
$(this).parent().children(".header").toggleClass("open");
})
});
</script>
{% endblock %}
298 changes: 298 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,298 @@
# -*- coding: utf-8 -*-
#
# otbenchmark documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 19 15:57:39 2015.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.

import os
import sys
import subprocess

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath("../"))

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

extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.todo",
"sphinx.ext.intersphinx",
"sphinx.ext.autosummary",
"sphinx.ext.coverage",
"numpydoc",
"sphinx_gallery.gen_gallery",
]

sphinx_gallery_conf = {
'examples_dirs': ['examples'],
'gallery_dirs': ['auto_examples'],
'show_signature': False,
}

autodoc_default_options = {
"members": None,
"inherited-members": None,
"exclude-members": "thisown",
}

extensions.append("sphinx.ext.imgmath")
imgmath_latex_preamble = r"\usepackage{{{0}math_notations}}".format(
os.path.dirname(__file__) + os.sep
)
imgmath_use_preview = True
if (
subprocess.call(
"dvisvgm -V", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
== 0
):
imgmath_image_format = "svg"
# embed image files inside html
imgmath_embed = True

extensions.append("matplotlib.sphinxext.plot_directive")

intersphinx_mapping = {
"python": ("http://openturns.github.io/openturns/1.23", "openturns-objects.inv")
}
autosummary_generate = True

numpydoc_show_class_members = True
numpydoc_class_members_toctree = False


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

# The suffix(es) of source filenames.
source_suffix = [".rst"]

# The master toctree document.
master_doc = "index"

# General information about the project.
project = u"otbenchmark"
copyright = u"2005-2024 Airbus-EDF-IMACS-ONERA-Phimeca"
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = "0.1"
# The full version, including alpha/beta/rc tags.
release = "0.1"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
# language = None

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
# today = ''
# Else, today_fmt is used as the format for a strftime call.
# today_fmt = '%B %d, %Y'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = []

# The reST default role (used for this markup: `text`) to use for all documents.
# default_role = None

# If true, '()' will be appended to :func: etc. cross-reference text.
# add_function_parentheses = True


# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
add_module_names = False

# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
# show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = "friendly" # sphinx

# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True


# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = "openturns"
html_sourcelink_suffix = ""

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
# html_theme_options = {}
# import alabaster
html_theme_path = ["themes"]

html_sidebars = {
"**": ["globaltoc.html", "relations.html", "sourcelink.html", "searchbox.html"]
}

# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
# html_favicon = 'None'

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
html_last_updated_fmt = "%b %d, %Y"

# Output file base name for HTML help builder.
# htmlhelp_basename = 'otbenchmarkdoc'

# Additional templates that should be rendered to pages, maps page names to
# template names.
# html_additional_pages = {}

# If false, no module index is generated.
# html_domain_indices = True

# If false, no index is generated.
# html_use_index = True

# If true, the index is split into individual pages for each letter.
# html_split_index = False

# If true, links to the reST sources are added to the pages.
html_show_sourcelink = True

# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
# html_show_sphinx = True

# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
# html_show_copyright = True

# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
# html_use_opensearch = ''

# This is the file name suffix for HTML files (e.g. ".xhtml").
# html_file_suffix = None

# -- Options for LaTeX output ---------------------------------------------
latex_preamble = r"""
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{expdlist}
\usepackage{math_notations}
\usepackage{stackrel}
\let\latexdescription=\description
\def\description{\latexdescription{}{} \breaklabel}
\DeclareMathOperator*{\argmin}{Argmin}
"""


latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
"papersize": "a4paper",
# The font size ('10pt', '11pt' or '12pt').
"pointsize": "10pt",
# Additional stuff for the LaTeX preamble.
"preamble": latex_preamble,
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(
"index",
"otbenchmark.tex",
u"otbenchmark Documentation",
u"Airbus-EDF-IMACS-Phimeca-ONERA",
"manual",
),
]

# The name of an image file (relative to this directory) to place at the top of
# the title page.
# latex_logo = None

# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
# latex_use_parts = False

# If true, show page references after internal links.
# latex_show_pagerefs = False

# If true, show URL addresses after external links.
# latex_show_urls = False

# Documents to append as an appendix to all manuals.
# latex_appendices = []

# If false, no module index is generated.
# latex_domain_indices = True


# -- Options for manual page output --------------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(
"index",
"otbenchmark",
u"otbenchmark Documentation",
[u"Airbus-EDF-IMACS-Phimeca-ONERA"],
1,
)
]

# If true, show URL addresses after external links.
# man_show_urls = False


# -- Options for Texinfo output ------------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(
"index",
"otbenchmark",
u"otbenchmark Documentation",
u"Airbus-EDF-IMACS-Phimeca-ONERA",
"otbenchmark",
"One line description of project.",
"Miscellaneous",
),
]

# Documents to append as an appendix to all manuals.
# texinfo_appendices = []

# If false, no module index is generated.
# texinfo_domain_indices = True

# How to display URL addresses: 'footnote', 'no', or 'inline'.
# texinfo_show_urls = 'footnote'

# If true, do not generate a @detailmenu in the "Top" node's menu.
# texinfo_no_detailmenu = False
Loading

0 comments on commit 6f65394

Please sign in to comment.