diff options
Diffstat (limited to 'docs/conf.py')
-rw-r--r-- | docs/conf.py | 48 |
1 files changed, 37 insertions, 11 deletions
diff --git a/docs/conf.py b/docs/conf.py index 98742f6..9e5ae92 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -2,9 +2,6 @@ import sys import os -# local imports -from blessings import Terminal - # 3rd-party import sphinx_rtd_theme import sphinx.environment @@ -32,12 +29,33 @@ github_project_url = "https://github.com/erikrose/blessings" # # https://github.com/SuperCowPowers/workbench/issues/172 # https://groups.google.com/forum/#!topic/sphinx-users/GNx7PVXoZIU -# http://stackoverflow.com/questions/12772927/specifying-an-online-image-in-sphinx-restructuredtext-format +# http://stackoverflow.com/a/28778969 +# def _warn_node(self, msg, node): if not msg.startswith('nonlocal image URI found:'): self._warnfunc(msg, '%s:%s' % get_source_line(node)) sphinx.environment.BuildEnvironment.warn_node = _warn_node +# Monkey-patch functools.wraps and contextlib.wraps +# https://github.com/sphinx-doc/sphinx/issues/1711#issuecomment-93126473 +import functools +def no_op_wraps(func): + """ + Replaces functools.wraps in order to undo wrapping when generating Sphinx documentation + """ + import sys + if func.__module__ is None or 'blessings' not in func.__module__: + return functools.orig_wraps(func) + def wrapper(decorator): + sys.stderr.write('patched for function signature: {0!r}\n'.format(func)) + return func + return wrapper +functools.orig_wraps = functools.wraps +functools.wraps = no_op_wraps +import contextlib +contextlib.wraps = no_op_wraps +from blessings.terminal import * + # -- General configuration ---------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. @@ -45,8 +63,12 @@ sphinx.environment.BuildEnvironment.warn_node = _warn_node # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx', - 'sphinx.ext.viewcode', 'github', ] +extensions = ['sphinx.ext.autodoc', + 'sphinx.ext.intersphinx', + 'sphinx.ext.viewcode', + 'github', + 'sphinx_paramlinks', + ] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -93,7 +115,7 @@ exclude_patterns = ['_build'] # default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. -# add_function_parentheses = True +add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). @@ -167,16 +189,16 @@ html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] # html_use_index = True # If true, the index is split into individual pages for each letter. -# html_split_index = False +html_split_index = True # If true, links to the reST sources are added to the pages. -# html_show_sourcelink = True +html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -# html_show_sphinx = True +html_show_sphinx = False # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -# html_show_copyright = True +html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a <link> tag referring to it. The value of this option must be the @@ -245,3 +267,7 @@ autodoc_member_order = 'bysource' # when linking to standard python library, use and prefer python 3 # documentation. intersphinx_mapping = {'http://docs.python.org/3/': None} + +# Both the class’ and the __init__ method’s docstring are concatenated and +# inserted. +autoclass_content = "both" |