/ docs / conf.py
conf.py
  1  # -*- coding: utf-8 -*-
  2  
  3  # SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
  4  #
  5  # SPDX-License-Identifier: MIT
  6  
  7  import os
  8  import sys
  9  import datetime
 10  
 11  sys.path.insert(0, os.path.abspath(".."))
 12  
 13  # -- General configuration ------------------------------------------------
 14  
 15  # Add any Sphinx extension module names here, as strings. They can be
 16  # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
 17  # ones.
 18  extensions = [
 19      "sphinx.ext.autodoc",
 20      "sphinx.ext.intersphinx",
 21      "sphinx.ext.napoleon",
 22      "sphinx.ext.todo",
 23  ]
 24  
 25  # TODO: Please Read!
 26  # Uncomment the below if you use native CircuitPython modules such as
 27  # digitalio, micropython and busio. List the modules you use. Without it, the
 28  # autodoc module docs will fail to generate with a warning.
 29  autodoc_mock_imports = ["microcontroller"]
 30  
 31  
 32  intersphinx_mapping = {
 33      "python": ("https://docs.python.org/3", None),
 34      "CircuitPython": ("https://docs.circuitpython.org/en/latest/", None),
 35  }
 36  
 37  # Show the docstring from both the class and its __init__() method.
 38  autoclass_content = "both"
 39  
 40  # Do not evaluate default argument values.
 41  autodoc_preserve_defaults = True
 42  
 43  # Add any paths that contain templates here, relative to this directory.
 44  templates_path = ["_templates"]
 45  
 46  source_suffix = ".rst"
 47  
 48  # The master toctree document.
 49  master_doc = "index"
 50  
 51  # General information about the project.
 52  project = "Adafruit CircuitPython HTTPServer Library"
 53  creation_year = "2022"
 54  current_year = str(datetime.datetime.now().year)
 55  year_duration = (
 56      current_year
 57      if current_year == creation_year
 58      else creation_year + " - " + current_year
 59  )
 60  copyright = year_duration + " Dan Halbert"
 61  author = "Dan Halbert"
 62  
 63  # The version info for the project you're documenting, acts as replacement for
 64  # |version| and |release|, also used in various other places throughout the
 65  # built documents.
 66  #
 67  # The short X.Y version.
 68  version = "1.0"
 69  # The full version, including alpha/beta/rc tags.
 70  release = "1.0"
 71  
 72  # The language for content autogenerated by Sphinx. Refer to documentation
 73  # for a list of supported languages.
 74  #
 75  # This is also used if you do content translation via gettext catalogs.
 76  # Usually you set "language" from the command line for these cases.
 77  language = "en"
 78  
 79  # List of patterns, relative to source directory, that match files and
 80  # directories to ignore when looking for source files.
 81  # This patterns also effect to html_static_path and html_extra_path
 82  exclude_patterns = [
 83      "_build",
 84      "Thumbs.db",
 85      ".DS_Store",
 86      ".env",
 87      "CODE_OF_CONDUCT.md",
 88  ]
 89  
 90  # The reST default role (used for this markup: `text`) to use for all
 91  # documents.
 92  #
 93  default_role = "any"
 94  
 95  # If true, '()' will be appended to :func: etc. cross-reference text.
 96  #
 97  add_function_parentheses = True
 98  
 99  # The name of the Pygments (syntax highlighting) style to use.
100  pygments_style = "sphinx"
101  
102  # If true, `todo` and `todoList` produce output, else they produce nothing.
103  todo_include_todos = False
104  
105  # If this is True, todo emits a warning for each TODO entries. The default is False.
106  todo_emit_warnings = True
107  
108  napoleon_numpy_docstring = False
109  
110  # -- Options for HTML output ----------------------------------------------
111  
112  # The theme to use for HTML and HTML Help pages.  See the documentation for
113  # a list of builtin themes.
114  #
115  on_rtd = os.environ.get("READTHEDOCS", None) == "True"
116  
117  if not on_rtd:  # only import and set the theme if we're building docs locally
118      try:
119          import sphinx_rtd_theme
120  
121          html_theme = "sphinx_rtd_theme"
122          html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."]
123      except:
124          html_theme = "default"
125          html_theme_path = ["."]
126  else:
127      html_theme_path = ["."]
128  
129  # Add any paths that contain custom static files (such as style sheets) here,
130  # relative to this directory. They are copied after the builtin static files,
131  # so a file named "default.css" will overwrite the builtin "default.css".
132  html_static_path = ["_static"]
133  
134  # The name of an image file (relative to this directory) to use as a favicon of
135  # the docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
136  # pixels large.
137  #
138  html_favicon = "_static/favicon.ico"
139  
140  # Output file base name for HTML help builder.
141  htmlhelp_basename = "Adafruit_CircuitPython_Httpserver_Librarydoc"
142  
143  # -- Options for LaTeX output ---------------------------------------------
144  
145  latex_elements = {
146      # The paper size ('letterpaper' or 'a4paper').
147      # 'papersize': 'letterpaper',
148      # The font size ('10pt', '11pt' or '12pt').
149      # 'pointsize': '10pt',
150      # Additional stuff for the LaTeX preamble.
151      # 'preamble': '',
152      # Latex figure (float) alignment
153      # 'figure_align': 'htbp',
154  }
155  
156  # Grouping the document tree into LaTeX files. List of tuples
157  # (source start file, target name, title,
158  #  author, documentclass [howto, manual, or own class]).
159  latex_documents = [
160      (
161          master_doc,
162          "Adafruit_CircuitPython_HTTPServer_Library.tex",
163          "Adafruit CircuitPython HTTPServer Library Documentation",
164          author,
165          "manual",
166      ),
167  ]
168  
169  # -- Options for manual page output ---------------------------------------
170  
171  # One entry per manual page. List of tuples
172  # (source start file, name, description, authors, manual section).
173  man_pages = [
174      (
175          master_doc,
176          "Adafruit_CircuitPython_HTTPServer_Library",
177          "Adafruit CircuitPython HTTPServer Library Documentation",
178          [author],
179          1,
180      ),
181  ]
182  
183  # -- Options for Texinfo output -------------------------------------------
184  
185  # Grouping the document tree into Texinfo files. List of tuples
186  # (source start file, target name, title, author,
187  #  dir menu entry, description, category)
188  texinfo_documents = [
189      (
190          master_doc,
191          "Adafruit_CircuitPython_HTTPServer_Library",
192          "Adafruit CircuitPython HTTPServer Library Documentation",
193          author,
194          "Adafruit_CircuitPython_HTTPServer_Library",
195          "One line description of project.",
196          "Miscellaneous",
197      ),
198  ]