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