tortoise-orm

../../_images/tortoise_orm.png

Fichier config.py

  1 # -*- coding: utf-8 -*-
  2 #
  3 # Configuration file for the Sphinx documentation builder.
  4 #
  5 # This file does only contain a selection of the most common options. For a
  6 # full list see the documentation:
  7 # http://www.sphinx-doc.org/en/stable/config
  8
  9 # -- Path setup --------------------------------------------------------------
 10
 11 # If extensions (or modules to document with autodoc) are in another directory,
 12 # add these directories to sys.path here. If the directory is relative to the
 13 # documentation root, use os.path.abspath to make it absolute, like shown here.
 14 #
 15 import os
 16 import re
 17 import sys
 18 sys.path.insert(0, os.path.abspath('.'))
 19 sys.path.insert(0, os.path.abspath('..'))
 20
 21 from unittest.mock import MagicMock
 22
 23 class Mock(MagicMock):
 24     @classmethod
 25     def __getattr__(cls, name):
 26         return MagicMock()
 27
 28 MOCK_MODULES = ['aiosqlite', 'astroid', 'asyncpg', 'asynctest', 'aiomysql']
 29 sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
 30
 31
 32 # -- Project information -----------------------------------------------------
 33
 34
 35 project = 'Tortoise'
 36 copyright = '2018, Andrey Bondar'
 37 author = 'Andrey Bondar'
 38
 39
 40 def get_version():
 41     verstrline = open('../tortoise/__init__.py', "rt").read()
 42     mob = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", verstrline, re.M)
 43     if mob:
 44         return mob.group(1)
 45     else:
 46         raise RuntimeError("Unable to find version string")
 47
 48
 49 # The short X.Y version
 50 version = get_version()
 51 # The full version, including alpha/beta/rc tags
 52 release = version
 53
 54
 55 # -- General configuration ---------------------------------------------------
 56
 57 # If your documentation needs a minimal Sphinx version, state it here.
 58 #
 59 # needs_sphinx = '1.0'
 60
 61 # Add any Sphinx extension module names here, as strings. They can be
 62 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
 63 # ones.
 64 extensions = [
 65     'sphinx.ext.autodoc',
 66     'sphinx.ext.napoleon',
 67     'sphinx_autodoc_typehints',
 68     'sphinx.ext.todo',
 69
 70     # cloud's extensions
 71     'cloud_sptheme.ext.autodoc_sections',
 72     'cloud_sptheme.ext.relbar_links',
 73     'cloud_sptheme.ext.escaped_samp_literals',
 74     'cloud_sptheme.ext.table_styling',
 75 ]
 76
 77 # Add any paths that contain templates here, relative to this directory.
 78 templates_path = ['_templates']
 79
 80 # The suffix(es) of source filenames.
 81 # You can specify multiple suffix as a list of string:
 82 #
 83 # source_suffix = ['.rst', '.md']
 84 source_suffix = '.rst'
 85
 86 # The master toctree document.
 87 master_doc = 'toc'
 88
 89 # The frontpage document.
 90 index_doc = 'index'
 91
 92 # The language for content autogenerated by Sphinx. Refer to documentation
 93 # for a list of supported languages.
 94 #
 95 # This is also used if you do content translation via gettext catalogs.
 96 # Usually you set "language" from the command line for these cases.
 97 language = None
 98
 99 # List of patterns, relative to source directory, that match files and
100 # directories to ignore when looking for source files.
101 # This pattern also affects html_static_path and html_extra_path .
102 exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
103
104 # The name of the Pygments (syntax highlighting) style to use.
105 pygments_style = 'sphinx'
106
107 # Todo settings
108 todo_include_todos = True
109 todo_emit_warnings = True
110
111 # Napoleon settings
112 napoleon_google_docstring = False
113 napoleon_numpy_docstring = True
114 napoleon_include_init_with_doc = False
115 napoleon_include_private_with_doc = False
116 napoleon_include_special_with_doc = True
117 napoleon_use_admonition_for_examples = True
118 napoleon_use_admonition_for_notes = True
119 napoleon_use_admonition_for_references = True
120 napoleon_use_ivar = True
121 napoleon_use_param = True
122 napoleon_use_rtype = True
123
124 # -- Options for HTML output -------------------------------------------------
125 import cloud_sptheme as csp
126
127 # The theme to use for HTML and HTML Help pages.  See the documentation for
128 # a list of builtin themes.
129 #
130 html_theme = 'greencloud'
131
132 # Theme options are theme-specific and customize the look and feel of a theme
133 # further.  For a list of options available for each theme, see the
134 # documentation.
135 #
136 html_theme_options = {
137     'borderless_decor': True,
138     'roottarget': index_doc,
139     'sidebarwidth': '3in',
140     'hyphenation_language': 'en',
141 }
142
143 # Add any paths that contain custom themes here, relative to this directory.
144 html_theme_path = [csp.get_theme_dir()]
145
146 # The name for this set of Sphinx documents.  If None, it defaults to
147 # "<project> v<release> documentation".
148 html_title = "%s v%s Documentation" % (project, release)
149
150 # A shorter title for the navigation bar.  Default is the same as html_title.
151 html_short_title = "%s %s Documentation" % (project, version)
152
153 # The name of an image file (relative to this directory) to place at the top
154 # of the sidebar.
155 #
156 html_logo = os.path.join("_static", "tortoise.png")
157
158 # Add any paths that contain custom static files (such as style sheets) here,
159 # relative to this directory. They are copied after the builtin static files,
160 # so a file named "default.css" will overwrite the builtin "default.css".
161 html_static_path = ['_static']
162
163 # Custom sidebar templates, must be a dictionary that maps document names
164 # to template names.
165 #
166 # The default sidebars (for documents that don't match any pattern) are
167 # defined by theme itself.  Builtin themes are using these templates by
168 # default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
169 # 'searchbox.html']``.
170 #
171 html_sidebars = {
172     '**': [
173         'searchbox.html',
174         'space.html',
175         'globaltoc.html',
176     ]
177 }
178
179
180 # -- Options for HTMLHelp output ---------------------------------------------
181
182 # Output file base name for HTML help builder.
183 htmlhelp_basename = 'tortoisedoc'
184
185
186 # -- Options for LaTeX output ------------------------------------------------
187
188 latex_elements = {
189     # The paper size ('letterpaper' or 'a4paper').
190     #
191     # 'papersize': 'letterpaper',
192
193     # The font size ('10pt', '11pt' or '12pt').
194     #
195     # 'pointsize': '10pt',
196
197     # Additional stuff for the LaTeX preamble.
198     #
199     # 'preamble': '',
200
201     # Latex figure (float) alignment
202     #
203     # 'figure_align': 'htbp',
204 }
205
206 # Grouping the document tree into LaTeX files. List of tuples
207 # (source start file, target name, title,
208 #  author, documentclass [howto, manual, or own class]).
209 latex_documents = [
210     (master_doc, 'tortoise.tex', 'tortoise Documentation',
211      'Andrey Bondar', 'manual'),
212 ]
213
214
215 # -- Options for manual page output ------------------------------------------
216
217 # One entry per manual page. List of tuples
218 # (source start file, name, description, authors, manual section).
219 man_pages = [
220     (master_doc, 'tortoise', 'tortoise Documentation',
221      [author], 1)
222 ]
223
224
225 # -- Options for Texinfo output ----------------------------------------------
226
227 # Grouping the document tree into Texinfo files. List of tuples
228 # (source start file, target name, title, author,
229 #  dir menu entry, description, category)
230 texinfo_documents = [
231     (master_doc, 'tortoise', 'tortoise Documentation',
232      author, 'tortoise', 'One line description of project.',
233      'Miscellaneous'),
234 ]
235
236
237 # -- Extension configuration -------------------------------------------------