/ docs / conf.py.bak
conf.py.bak
  1  # -*- coding: utf-8 -*-
  2  """
  3  Configuration file for the Sphinx documentation builder.
  4  
  5  For a full list of options see the documentation:
  6  http://www.sphinx-doc.org/en/master/config
  7  """
  8  
  9  import os
 10  import sys
 11  
 12  sys.path.insert(0, os.path.abspath('../src'))
 13  
 14  from importlib import import_module
 15  
 16  import version  # noqa:E402
 17  
 18  
 19  # -- Project information -----------------------------------------------------
 20  
 21  project = u'PyBitmessage'
 22  copyright = u'2019-2022, The Bitmessage Team'  # pylint: disable=redefined-builtin
 23  author = u'The Bitmessage Team'
 24  
 25  # The short X.Y version
 26  version = unicode(version.softwareVersion)
 27  
 28  # The full version, including alpha/beta/rc tags
 29  release = version
 30  
 31  # -- General configuration ---------------------------------------------------
 32  
 33  # If your documentation needs a minimal Sphinx version, state it here.
 34  #
 35  # needs_sphinx = '1.0'
 36  
 37  # Add any Sphinx extension module names here, as strings. They can be
 38  # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
 39  # ones.
 40  extensions = [
 41      'sphinx.ext.autodoc',
 42      'sphinx.ext.coverage',  # FIXME: unused
 43      'sphinx.ext.imgmath',  # legacy unused
 44      'sphinx.ext.intersphinx',
 45      'sphinx.ext.linkcode',
 46      'sphinx.ext.napoleon',
 47      'sphinx.ext.todo',
 48      'sphinxcontrib.apidoc',
 49      'm2r',
 50  ]
 51  
 52  default_role = 'obj'
 53  
 54  # Add any paths that contain templates here, relative to this directory.
 55  templates_path = ['_templates']
 56  
 57  # The suffix(es) of source filenames.
 58  # You can specify multiple suffix as a list of string:
 59  #
 60  source_suffix = ['.rst', '.md']
 61  
 62  # The master toctree document.
 63  master_doc = 'index'
 64  
 65  # The language for content autogenerated by Sphinx. Refer to documentation
 66  # for a list of supported languages.
 67  #
 68  # This is also used if you do content translation via gettext catalogs.
 69  # Usually you set "language" from the command line for these cases.
 70  # language = None
 71  
 72  # List of patterns, relative to source directory, that match files and
 73  # directories to ignore when looking for source files.
 74  # This pattern also affects html_static_path and html_extra_path .
 75  exclude_patterns = ['_build']
 76  
 77  # The name of the Pygments (syntax highlighting) style to use.
 78  pygments_style = 'sphinx'
 79  
 80  # Don't prepend every class or function name with full module path
 81  add_module_names = False
 82  
 83  # A list of ignored prefixes for module index sorting.
 84  modindex_common_prefix = ['pybitmessage.']
 85  
 86  
 87  # -- Options for HTML output -------------------------------------------------
 88  
 89  # The theme to use for HTML and HTML Help pages.  See the documentation for
 90  # a list of builtin themes.
 91  #
 92  html_theme = 'sphinx_rtd_theme'
 93  
 94  # Theme options are theme-specific and customize the look and feel of a theme
 95  # further.  For a list of options available for each theme, see the
 96  # documentation.
 97  #
 98  # html_theme_options = {}
 99  
100  # Add any paths that contain custom static files (such as style sheets) here,
101  # relative to this directory. They are copied after the builtin static files,
102  # so a file named "default.css" will overwrite the builtin "default.css".
103  html_static_path = ['_static']
104  
105  html_css_files = [
106      'custom.css',
107  ]
108  
109  # Custom sidebar templates, must be a dictionary that maps document names
110  # to template names.
111  #
112  # The default sidebars (for documents that don't match any pattern) are
113  # defined by theme itself.  Builtin themes are using these templates by
114  # default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
115  # 'searchbox.html']``.
116  #
117  # html_sidebars = {}
118  
119  html_show_sourcelink = False
120  
121  # -- Options for HTMLHelp output ---------------------------------------------
122  
123  # Output file base name for HTML help builder.
124  htmlhelp_basename = 'PyBitmessagedoc'
125  
126  
127  # -- Options for LaTeX output ------------------------------------------------
128  
129  latex_elements = {
130      # The paper size ('letterpaper' or 'a4paper').
131      #
132      # 'papersize': 'letterpaper',
133  
134      # The font size ('10pt', '11pt' or '12pt').
135      #
136      # 'pointsize': '10pt',
137  
138      # Additional stuff for the LaTeX preamble.
139      #
140      # 'preamble': '',
141  
142      # Latex figure (float) alignment
143      #
144      # 'figure_align': 'htbp',
145  }
146  
147  # Grouping the document tree into LaTeX files. List of tuples
148  # (source start file, target name, title,
149  #  author, documentclass [howto, manual, or own class]).
150  latex_documents = [
151      (master_doc, 'PyBitmessage.tex', u'PyBitmessage Documentation',
152       u'The Bitmessage Team', 'manual'),
153  ]
154  
155  
156  # -- Options for manual page output ------------------------------------------
157  
158  # One entry per manual page. List of tuples
159  # (source start file, name, description, authors, manual section).
160  man_pages = [
161      (master_doc, 'pybitmessage', u'PyBitmessage Documentation',
162       [author], 1)
163  ]
164  
165  
166  # -- Options for Texinfo output ----------------------------------------------
167  
168  # Grouping the document tree into Texinfo files. List of tuples
169  # (source start file, target name, title, author,
170  #  dir menu entry, description, category)
171  texinfo_documents = [
172      (master_doc, 'PyBitmessage', u'PyBitmessage Documentation',
173       author, 'PyBitmessage', 'One line description of project.',
174       'Miscellaneous'),
175  ]
176  
177  
178  # -- Options for Epub output -------------------------------------------------
179  
180  # Bibliographic Dublin Core info.
181  epub_title = project
182  epub_author = author
183  epub_publisher = author
184  epub_copyright = copyright
185  
186  # The unique identifier of the text. This can be a ISBN number
187  # or the project homepage.
188  #
189  # epub_identifier = ''
190  
191  # A unique identification for the text.
192  #
193  # epub_uid = ''
194  
195  # A list of files that should not be packed into the epub file.
196  epub_exclude_files = ['search.html']
197  
198  
199  # -- Extension configuration -------------------------------------------------
200  
201  autodoc_mock_imports = [
202      'debug',
203      'pybitmessage.bitmessagekivy',
204      'pybitmessage.bitmessageqt.foldertree',
205      'pybitmessage.helper_startup',
206      'pybitmessage.mockbm',
207      'pybitmessage.network.httpd',
208      'pybitmessage.network.https',
209      'ctypes',
210      'dialog',
211      'gi',
212      'kivy',
213      'logging',
214      'msgpack',
215      'numpy',
216      'pkg_resources',
217      'pycanberra',
218      'pyopencl',
219      'PyQt4',
220      'PyQt5',
221      'qrcode',
222      'stem',
223      'xdg',
224  ]
225  autodoc_member_order = 'bysource'
226  
227  # Apidoc settings
228  apidoc_module_dir = '../pybitmessage'
229  apidoc_output_dir = 'autodoc'
230  apidoc_excluded_paths = [
231      'bitmessagekivy', 'build_osx.py',
232      'bitmessageqt/addressvalidator.py', 'bitmessageqt/foldertree.py',
233      'bitmessageqt/migrationwizard.py', 'bitmessageqt/newaddresswizard.py',
234      'helper_startup.py',
235      'kivymd', 'mockbm', 'main.py', 'navigationdrawer', 'network/http*',
236      'src', 'tests', 'version.py'
237  ]
238  apidoc_module_first = True
239  apidoc_separate_modules = True
240  apidoc_toc_file = False
241  apidoc_extra_args = ['-a']
242  
243  # Napoleon settings
244  napoleon_google_docstring = True
245  
246  
247  # linkcode function
248  def linkcode_resolve(domain, info):
249      """This generates source URL's for sphinx.ext.linkcode"""
250      if domain != 'py' or not info['module']:
251          return
252      try:
253          home = os.path.abspath(import_module('pybitmessage').__path__[0])
254          mod = import_module(info['module']).__file__
255      except ImportError:
256          return
257      repo = 'https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src%s'
258      path = mod.replace(home, '')
259      if path != mod:
260          # put the link only for top level definitions
261          if len(info['fullname'].split('.')) > 1:
262              return
263          if path.endswith('.pyc'):
264              path = path[:-1]
265          return repo % path
266  
267  
268  # -- Options for intersphinx extension ---------------------------------------
269  
270  # Example configuration for intersphinx: refer to the Python standard library.
271  intersphinx_mapping = {'https://docs.python.org/2.7/': None}
272  
273  # -- Options for todo extension ----------------------------------------------
274  
275  # If true, `todo` and `todoList` produce output, else they produce nothing.
276  todo_include_todos = True