Skip to content
Myr

conf.py

This file

Path

docs/conf.py

299 lines · 9.4 KiB · Python

Last changed by

clean up code formatting in some docsDavid Lordbefore adoption1928f28

History of this file

Take it

1# -*- coding: utf-8 -*-2#3# Flask documentation build configuration file, created by4# sphinx-quickstart on Tue Apr  6 15:24:58 2010.5#6# This file is execfile()d with the current directory set to its containing dir.7#8# Note that not all possible configuration values are present in this9# autogenerated file.10#11# All configuration values have a default; values that are commented out12# serve to show the default.13from __future__ import print_function14from datetime import datetime15import os16import sys17import pkg_resources1819# If extensions (or modules to document with autodoc) are in another directory,20# add these directories to sys.path here. If the directory is relative to the21# documentation root, use os.path.abspath to make it absolute, like shown here.22sys.path.append(os.path.join(os.path.dirname(__file__), '_themes'))23sys.path.append(os.path.dirname(__file__))2425# -- General configuration -----------------------------------------------------2627# If your documentation needs a minimal Sphinx version, state it here.28#needs_sphinx = '1.0'2930# Add any Sphinx extension module names here, as strings. They can be extensions31# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.32extensions = [33    'sphinx.ext.autodoc',34    'sphinx.ext.intersphinx',35    'flaskdocext'36]3738# Add any paths that contain templates here, relative to this directory.39templates_path = ['_templates']4041# The suffix of source filenames.42source_suffix = '.rst'4344# The encoding of source files.45#source_encoding = 'utf-8-sig'4647# The master toctree document.48master_doc = 'index'4950# General information about the project.51project = u'Flask'52copyright = u'2010 - {0}, Armin Ronacher'.format(datetime.utcnow().year)5354# The version info for the project you're documenting, acts as replacement for55# |version| and |release|, also used in various other places throughout the56# built documents.57try:58    release = pkg_resources.get_distribution('Flask').version59except pkg_resources.DistributionNotFound:60    print('Flask must be installed to build the documentation.')61    print('Install from source using `pip install -e .` in a virtualenv.')62    sys.exit(1)6364if 'dev' in release:65    release = ''.join(release.partition('dev')[:2])6667version = '.'.join(release.split('.')[:2])6869# The language for content autogenerated by Sphinx. Refer to documentation70# for a list of supported languages.71#language = None7273# There are two options for replacing |today|: either, you set today to some74# non-false value, then it is used:75#today = ''76# Else, today_fmt is used as the format for a strftime call.77#today_fmt = '%B %d, %Y'7879# List of patterns, relative to source directory, that match files and80# directories to ignore when looking for source files.81exclude_patterns = ['_build']8283# The reST default role (used for this markup: `text`) to use for all documents.84#default_role = None8586# If true, '()' will be appended to :func: etc. cross-reference text.87#add_function_parentheses = True8889# If true, the current module name will be prepended to all description90# unit titles (such as .. function::).91#add_module_names = True9293# If true, sectionauthor and moduleauthor directives will be shown in the94# output. They are ignored by default.95#show_authors = False9697# A list of ignored prefixes for module index sorting.98#modindex_common_prefix = []99100101# -- Options for HTML output ---------------------------------------------------102103# The theme to use for HTML and HTML Help pages.  Major themes that come with104# Sphinx are currently 'default' and 'sphinxdoc'.105# html_theme = 'default'106107# Theme options are theme-specific and customize the look and feel of a theme108# further.  For a list of options available for each theme, see the109# documentation.110# html_theme_options = {}111112# Add any paths that contain custom themes here, relative to this directory.113html_theme_path = ['_themes']114115# The name for this set of Sphinx documents.  If None, it defaults to116# "<project> v<release> documentation".117#html_title = None118119# A shorter title for the navigation bar.  Default is the same as html_title.120#html_short_title = None121122# The name of an image file (relative to this directory) to place at the top123# of the sidebar.  Do not set, template magic!124#html_logo = None125126# The name of an image file (within the static path) to use as favicon of the127# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32128# pixels large.129html_favicon = '_static/flask-favicon.ico'130131# Add any paths that contain custom static files (such as style sheets) here,132# relative to this directory. They are copied after the builtin static files,133# so a file named "default.css" will overwrite the builtin "default.css".134html_static_path = ['_static']135136# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,137# using the given strftime format.138#html_last_updated_fmt = '%b %d, %Y'139140# If true, SmartyPants will be used to convert quotes and dashes to141# typographically correct entities.142#html_use_smartypants = True143144# Custom sidebar templates, maps document names to template names.145html_sidebars = {146    'index': [147        'sidebarintro.html',148        'sourcelink.html',149        'searchbox.html'150    ],151    '**': [152        'sidebarlogo.html',153        'localtoc.html',154        'relations.html',155        'sourcelink.html',156        'searchbox.html'157    ]158}159160# Additional templates that should be rendered to pages, maps page names to161# template names.162#html_additional_pages = {}163164# If false, no module index is generated.165html_use_modindex = False166167# If false, no index is generated.168#html_use_index = True169170# If true, the index is split into individual pages for each letter.171#html_split_index = False172173# If true, links to the reST sources are added to the pages.174#html_show_sourcelink = True175176# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.177html_show_sphinx = False178179# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.180#html_show_copyright = True181182# If true, an OpenSearch description file will be output, and all pages will183# contain a <link> tag referring to it.  The value of this option must be the184# base URL from which the finished HTML is served.185#html_use_opensearch = ''186187# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").188#html_file_suffix = ''189190# Output file base name for HTML help builder.191htmlhelp_basename = 'Flaskdoc'192193194# -- Options for LaTeX output --------------------------------------------------195196# Grouping the document tree into LaTeX files. List of tuples197# (source start file, target name, title, author, documentclass [howto/manual]).198latex_documents = [199  ('latexindex', 'Flask.tex', u'Flask Documentation', u'Armin Ronacher', 'manual'),200]201202# Documents to append as an appendix to all manuals.203#latex_appendices = []204205# If false, no module index is generated.206latex_use_modindex = False207208latex_elements = {209    'fontpkg': r'\usepackage{mathpazo}',210    'papersize': 'a4paper',211    'pointsize': '12pt',212    'preamble': r'\usepackage{flaskstyle}'213}214latex_use_parts = True215216latex_additional_files = ['flaskstyle.sty', 'logo.pdf']217218219# -- Options for Epub output ---------------------------------------------------220221# Bibliographic Dublin Core info.222#epub_title = ''223#epub_author = ''224#epub_publisher = ''225#epub_copyright = ''226227# The language of the text. It defaults to the language option228# or en if the language is not set.229#epub_language = ''230231# The scheme of the identifier. Typical schemes are ISBN or URL.232#epub_scheme = ''233234# The unique identifier of the text. This can be a ISBN number235# or the project homepage.236#epub_identifier = ''237238# A unique identification for the text.239#epub_uid = ''240241# HTML files that should be inserted before the pages created by sphinx.242# The format is a list of tuples containing the path and title.243#epub_pre_files = []244245# HTML files shat should be inserted after the pages created by sphinx.246# The format is a list of tuples containing the path and title.247#epub_post_files = []248249# A list of files that should not be packed into the epub file.250#epub_exclude_files = []251252# The depth of the table of contents in toc.ncx.253#epub_tocdepth = 3254255intersphinx_mapping = {256    'python': ('https://docs.python.org/3/', None),257    'werkzeug': ('http://werkzeug.pocoo.org/docs/', None),258    'click': ('http://click.pocoo.org/', None),259    'jinja': ('http://jinja.pocoo.org/docs/', None),260    'sqlalchemy': ('http://docs.sqlalchemy.org/en/latest/', None),261    'wtforms': ('https://wtforms.readthedocs.io/en/latest/', None),262    'blinker': ('https://pythonhosted.org/blinker/', None)263}264265try:266    __import__('flask_theme_support')267    pygments_style = 'flask_theme_support.FlaskyStyle'268    html_theme = 'flask'269    html_theme_options = {270        'touch_icon': 'touch-icon.png'271    }272except ImportError:273    print('-' * 74)274    print('Warning: Flask themes unavailable.  Building with default theme')275    print('If you want the Flask themes, run this command and build again:')276    print()277    print('  git submodule update --init')278    print('-' * 74)279280281# unwrap decorators282def unwrap_decorators():283    import sphinx.util.inspect as inspect284    import functools285286    old_getargspec = inspect.getargspec287    def getargspec(x):288        return old_getargspec(getattr(x, '_original_function', x))289    inspect.getargspec = getargspec290291    old_update_wrapper = functools.update_wrapper292    def update_wrapper(wrapper, wrapped, *a, **kw):293        rv = old_update_wrapper(wrapper, wrapped, *a, **kw)294        rv._original_function = wrapped295        return rv296    functools.update_wrapper = update_wrapper297298unwrap_decorators()299del unwrap_decorators