conf.py
This file
Path
docs/conf.py
310 lines · 9.8 KiB · Python
Last changed by
Merge pull request #2271 from davidism/collapse-changelogsDavid Lordbefore adoption255375d
History of this fileTake 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_function14import os15import sys16import pkg_resources17import time18import datetime1920BUILD_DATE = datetime.datetime.utcfromtimestamp(int(os.environ.get('SOURCE_DATE_EPOCH', time.time())))2122# If extensions (or modules to document with autodoc) are in another directory,23# add these directories to sys.path here. If the directory is relative to the24# documentation root, use os.path.abspath to make it absolute, like shown here.25sys.path.append(os.path.join(os.path.dirname(__file__), '_themes'))26sys.path.append(os.path.dirname(__file__))2728# -- General configuration -----------------------------------------------------2930# If your documentation needs a minimal Sphinx version, state it here.31#needs_sphinx = '1.0'3233# Add any Sphinx extension module names here, as strings. They can be extensions34# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.35extensions = [36 'sphinx.ext.autodoc',37 'sphinx.ext.intersphinx',38 'flaskdocext'39]4041try:42 __import__('sphinxcontrib.log_cabinet')43except ImportError:44 print('sphinxcontrib-log-cabinet is not installed.')45 print('Changelog directives will not be re-organized.')46else:47 extensions.append('sphinxcontrib.log_cabinet')4849# Add any paths that contain templates here, relative to this directory.50templates_path = ['_templates']5152# The suffix of source filenames.53source_suffix = '.rst'5455# The encoding of source files.56#source_encoding = 'utf-8-sig'5758# The master toctree document.59master_doc = 'index'6061# General information about the project.62project = u'Flask'63copyright = u'2010 - {0}, Armin Ronacher'.format(BUILD_DATE.year)6465# The version info for the project you're documenting, acts as replacement for66# |version| and |release|, also used in various other places throughout the67# built documents.68try:69 release = pkg_resources.get_distribution('Flask').version70except pkg_resources.DistributionNotFound:71 print('Flask must be installed to build the documentation.')72 print('Install from source using `pip install -e .` in a virtualenv.')73 sys.exit(1)7475if 'dev' in release:76 release = ''.join(release.partition('dev')[:2])7778version = '.'.join(release.split('.')[:2])7980# The language for content autogenerated by Sphinx. Refer to documentation81# for a list of supported languages.82#language = None8384# There are two options for replacing |today|: either, you set today to some85# non-false value, then it is used:86#today = ''87# Else, today_fmt is used as the format for a strftime call.88#today_fmt = '%B %d, %Y'8990# List of patterns, relative to source directory, that match files and91# directories to ignore when looking for source files.92exclude_patterns = ['_build']9394# The reST default role (used for this markup: `text`) to use for all documents.95#default_role = None9697# If true, '()' will be appended to :func: etc. cross-reference text.98#add_function_parentheses = True99100# If true, the current module name will be prepended to all description101# unit titles (such as .. function::).102#add_module_names = True103104# If true, sectionauthor and moduleauthor directives will be shown in the105# output. They are ignored by default.106#show_authors = False107108# A list of ignored prefixes for module index sorting.109#modindex_common_prefix = []110111112# -- Options for HTML output ---------------------------------------------------113114# The theme to use for HTML and HTML Help pages. Major themes that come with115# Sphinx are currently 'default' and 'sphinxdoc'.116# html_theme = 'default'117118# Theme options are theme-specific and customize the look and feel of a theme119# further. For a list of options available for each theme, see the120# documentation.121# html_theme_options = {}122123# Add any paths that contain custom themes here, relative to this directory.124html_theme_path = ['_themes']125126# The name for this set of Sphinx documents. If None, it defaults to127# "<project> v<release> documentation".128#html_title = None129130# A shorter title for the navigation bar. Default is the same as html_title.131#html_short_title = None132133# The name of an image file (relative to this directory) to place at the top134# of the sidebar. Do not set, template magic!135#html_logo = None136137# The name of an image file (within the static path) to use as favicon of the138# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32139# pixels large.140html_favicon = '_static/flask-favicon.ico'141142# Add any paths that contain custom static files (such as style sheets) here,143# relative to this directory. They are copied after the builtin static files,144# so a file named "default.css" will overwrite the builtin "default.css".145html_static_path = ['_static']146147# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,148# using the given strftime format.149#html_last_updated_fmt = '%b %d, %Y'150151# If true, SmartyPants will be used to convert quotes and dashes to152# typographically correct entities.153#html_use_smartypants = True154155# Custom sidebar templates, maps document names to template names.156html_sidebars = {157 'index': [158 'sidebarintro.html',159 'sourcelink.html',160 'searchbox.html'161 ],162 '**': [163 'sidebarlogo.html',164 'localtoc.html',165 'relations.html',166 'sourcelink.html',167 'searchbox.html'168 ]169}170171# Additional templates that should be rendered to pages, maps page names to172# template names.173#html_additional_pages = {}174175# If false, no module index is generated.176html_use_modindex = False177178# If false, no index is generated.179#html_use_index = True180181# If true, the index is split into individual pages for each letter.182#html_split_index = False183184# If true, links to the reST sources are added to the pages.185#html_show_sourcelink = True186187# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.188html_show_sphinx = False189190# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.191#html_show_copyright = True192193# If true, an OpenSearch description file will be output, and all pages will194# contain a <link> tag referring to it. The value of this option must be the195# base URL from which the finished HTML is served.196#html_use_opensearch = ''197198# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").199#html_file_suffix = ''200201# Output file base name for HTML help builder.202htmlhelp_basename = 'Flaskdoc'203204205# -- Options for LaTeX output --------------------------------------------------206207# Grouping the document tree into LaTeX files. List of tuples208# (source start file, target name, title, author, documentclass [howto/manual]).209latex_documents = [210 ('latexindex', 'Flask.tex', u'Flask Documentation', u'Armin Ronacher', 'manual'),211]212213# Documents to append as an appendix to all manuals.214#latex_appendices = []215216# If false, no module index is generated.217latex_use_modindex = False218219latex_elements = {220 'fontpkg': r'\usepackage{mathpazo}',221 'papersize': 'a4paper',222 'pointsize': '12pt',223 'preamble': r'\usepackage{flaskstyle}'224}225latex_use_parts = True226227latex_additional_files = ['flaskstyle.sty', 'logo.pdf']228229230# -- Options for Epub output ---------------------------------------------------231232# Bibliographic Dublin Core info.233#epub_title = ''234#epub_author = ''235#epub_publisher = ''236#epub_copyright = ''237238# The language of the text. It defaults to the language option239# or en if the language is not set.240#epub_language = ''241242# The scheme of the identifier. Typical schemes are ISBN or URL.243#epub_scheme = ''244245# The unique identifier of the text. This can be an ISBN number246# or the project homepage.247#epub_identifier = ''248249# A unique identification for the text.250#epub_uid = ''251252# HTML files that should be inserted before the pages created by sphinx.253# The format is a list of tuples containing the path and title.254#epub_pre_files = []255256# HTML files shat should be inserted after the pages created by sphinx.257# The format is a list of tuples containing the path and title.258#epub_post_files = []259260# A list of files that should not be packed into the epub file.261#epub_exclude_files = []262263# The depth of the table of contents in toc.ncx.264#epub_tocdepth = 3265266intersphinx_mapping = {267 'python': ('https://docs.python.org/3/', None),268 'werkzeug': ('http://werkzeug.pocoo.org/docs/', None),269 'click': ('http://click.pocoo.org/', None),270 'jinja': ('http://jinja.pocoo.org/docs/', None),271 'sqlalchemy': ('https://docs.sqlalchemy.org/en/latest/', None),272 'wtforms': ('https://wtforms.readthedocs.io/en/latest/', None),273 'blinker': ('https://pythonhosted.org/blinker/', None)274}275276try:277 __import__('flask_theme_support')278 pygments_style = 'flask_theme_support.FlaskyStyle'279 html_theme = 'flask'280 html_theme_options = {281 'touch_icon': 'touch-icon.png'282 }283except ImportError:284 print('-' * 74)285 print('Warning: Flask themes unavailable. Building with default theme')286 print('If you want the Flask themes, run this command and build again:')287 print()288 print(' git submodule update --init')289 print('-' * 74)290291292# unwrap decorators293def unwrap_decorators():294 import sphinx.util.inspect as inspect295 import functools296297 old_getargspec = inspect.getargspec298 def getargspec(x):299 return old_getargspec(getattr(x, '_original_function', x))300 inspect.getargspec = getargspec301302 old_update_wrapper = functools.update_wrapper303 def update_wrapper(wrapper, wrapped, *a, **kw):304 rv = old_update_wrapper(wrapper, wrapped, *a, **kw)305 rv._original_function = wrapped306 return rv307 functools.update_wrapper = update_wrapper308309unwrap_decorators()310del unwrap_decorators