Read the Docs build information Build id: 160102 Project: icb-scanpy Version: latest Commit: 1678beadd7f744d1b166e51d75b2cb176237115f Date: 2018-11-16T09:40:48.629958Z State: finished Success: False [rtd-command-info] start-time: 2018-11-16T15:40:49.090393Z, end-time: 2018-11-16T15:40:49.095243Z, duration: 0, exit-code: 0 git remote set-url origin https://github.com/theislab/scanpy.git [rtd-command-info] start-time: 2018-11-16T15:40:49.156463Z, end-time: 2018-11-16T15:40:49.355992Z, duration: 0, exit-code: 0 git fetch --tags --prune --prune-tags From https://github.com/theislab/scanpy 66e64b4..1678bea master -> origin/master [rtd-command-info] start-time: 2018-11-16T15:40:49.425051Z, end-time: 2018-11-16T15:40:49.432888Z, duration: 0, exit-code: 0 git checkout --force origin/master Previous HEAD position was 66e64b4 Hook up leiden in tl and fix its docs HEAD is now at 1678bea List bbknn in docs [rtd-command-info] start-time: 2018-11-16T15:40:49.493506Z, end-time: 2018-11-16T15:40:49.500360Z, duration: 0, exit-code: 0 git clean -d -f -f [rtd-command-info] start-time: 2018-11-16T15:40:49.588277Z, end-time: 2018-11-16T15:40:49.593732Z, duration: 0, exit-code: 0 git branch -r origin/HEAD -> origin/master origin/VolkerBergen-patch-1 origin/hvg origin/kbet origin/master origin/norml origin/version0 [rtd-command-info] start-time: 2018-11-16T15:40:50.358975Z, end-time: 2018-11-16T15:40:53.880258Z, duration: 3, exit-code: 0 python3.6 -mvirtualenv --no-site-packages --no-download Using base prefix '/home/docs/.pyenv/versions/3.6.2' New python executable in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/bin/python3.6 Not overwriting existing python script /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/bin/python (you must use /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/bin/python3.6) Installing setuptools, pip, wheel...done. [rtd-command-info] start-time: 2018-11-16T15:40:53.951599Z, end-time: 2018-11-16T15:40:56.502485Z, duration: 2, exit-code: 0 python pip install --upgrade --cache-dir /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/.cache/pip Pygments==2.2.0 setuptools<40 docutils==0.13.1 mock==1.0.1 pillow==2.6.1 alabaster>=0.7,<0.8,!=0.7.5 commonmark==0.5.4 recommonmark==0.4.0 sphinx<1.8 sphinx-rtd-theme<0.5 readthedocs-sphinx-ext<0.6 Requirement already up-to-date: Pygments==2.2.0 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages Requirement already up-to-date: setuptools<40 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages Requirement already up-to-date: docutils==0.13.1 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages Requirement already up-to-date: mock==1.0.1 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages Requirement already up-to-date: pillow==2.6.1 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages Requirement already up-to-date: alabaster!=0.7.5,<0.8,>=0.7 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages Requirement already up-to-date: commonmark==0.5.4 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages Requirement already up-to-date: recommonmark==0.4.0 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages Requirement already up-to-date: sphinx<1.8 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages Requirement already up-to-date: sphinx-rtd-theme<0.5 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages Requirement already up-to-date: readthedocs-sphinx-ext<0.6 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages Requirement already up-to-date: requests>=2.0.0 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from sphinx<1.8) Requirement already up-to-date: snowballstemmer>=1.1 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from sphinx<1.8) Requirement already up-to-date: sphinxcontrib-websupport in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from sphinx<1.8) Requirement already up-to-date: imagesize in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from sphinx<1.8) Requirement already up-to-date: packaging in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from sphinx<1.8) Requirement already up-to-date: babel!=2.0,>=1.3 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from sphinx<1.8) Requirement already up-to-date: Jinja2>=2.3 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from sphinx<1.8) Requirement already up-to-date: six>=1.5 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from sphinx<1.8) Requirement already up-to-date: certifi>=2017.4.17 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from requests>=2.0.0->sphinx<1.8) Requirement already up-to-date: chardet<3.1.0,>=3.0.2 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from requests>=2.0.0->sphinx<1.8) Requirement already up-to-date: idna<2.8,>=2.5 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from requests>=2.0.0->sphinx<1.8) Requirement already up-to-date: urllib3<1.25,>=1.21.1 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from requests>=2.0.0->sphinx<1.8) Requirement already up-to-date: pyparsing>=2.0.2 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from packaging->sphinx<1.8) Requirement already up-to-date: pytz>=0a in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from babel!=2.0,>=1.3->sphinx<1.8) Requirement already up-to-date: MarkupSafe>=0.23 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from Jinja2>=2.3->sphinx<1.8) You are using pip version 9.0.3, however version 18.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command. [rtd-command-info] start-time: 2018-11-16T15:40:56.566015Z, end-time: 2018-11-16T15:40:57.354595Z, duration: 0, exit-code: 0 python pip install --exists-action=w --cache-dir /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/.cache/pip -r docs/requires.txt Requirement already satisfied: sphinx_rtd_theme>=0.3.1 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from -r docs/requires.txt (line 2)) Requirement already satisfied: sphinx-autodoc-typehints in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from -r docs/requires.txt (line 3)) Requirement already satisfied: anndata>=0.6.7 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from -r docs/requires.txt (line 5)) Requirement already satisfied: matplotlib>=2.2 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from -r docs/requires.txt (line 6)) Requirement already satisfied: pandas>=0.21 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from -r docs/requires.txt (line 7)) Requirement already satisfied: scipy in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from -r docs/requires.txt (line 8)) Requirement already satisfied: seaborn in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from -r docs/requires.txt (line 9)) Requirement already satisfied: h5py in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from -r docs/requires.txt (line 10)) Requirement already satisfied: tables in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from -r docs/requires.txt (line 11)) Requirement already satisfied: scikit-learn>=0.19.1 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from -r docs/requires.txt (line 12)) Requirement already satisfied: networkx in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from -r docs/requires.txt (line 14)) Requirement already satisfied: natsort in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from -r docs/requires.txt (line 15)) Requirement already satisfied: joblib in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from -r docs/requires.txt (line 16)) Requirement already satisfied: numba in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from -r docs/requires.txt (line 17)) Requirement already satisfied: sphinx in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from sphinx_rtd_theme>=0.3.1->-r docs/requires.txt (line 2)) Requirement already satisfied: numpy~=1.14 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from anndata>=0.6.7->-r docs/requires.txt (line 5)) Requirement already satisfied: cycler>=0.10 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from matplotlib>=2.2->-r docs/requires.txt (line 6)) Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from matplotlib>=2.2->-r docs/requires.txt (line 6)) Requirement already satisfied: python-dateutil>=2.1 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from matplotlib>=2.2->-r docs/requires.txt (line 6)) Requirement already satisfied: kiwisolver>=1.0.1 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from matplotlib>=2.2->-r docs/requires.txt (line 6)) Requirement already satisfied: pytz>=2011k in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from pandas>=0.21->-r docs/requires.txt (line 7)) Requirement already satisfied: six in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from h5py->-r docs/requires.txt (line 10)) Requirement already satisfied: numexpr>=2.5.2 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from tables->-r docs/requires.txt (line 11)) Requirement already satisfied: decorator>=4.3.0 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from networkx->-r docs/requires.txt (line 14)) Requirement already satisfied: llvmlite>=0.25.0dev0 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from numba->-r docs/requires.txt (line 17)) Requirement already satisfied: setuptools in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from sphinx->sphinx_rtd_theme>=0.3.1->-r docs/requires.txt (line 2)) Requirement already satisfied: alabaster<0.8,>=0.7 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from sphinx->sphinx_rtd_theme>=0.3.1->-r docs/requires.txt (line 2)) Requirement already satisfied: imagesize in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from sphinx->sphinx_rtd_theme>=0.3.1->-r docs/requires.txt (line 2)) Requirement already satisfied: requests>=2.0.0 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from sphinx->sphinx_rtd_theme>=0.3.1->-r docs/requires.txt (line 2)) Requirement already satisfied: Pygments>=2.0 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from sphinx->sphinx_rtd_theme>=0.3.1->-r docs/requires.txt (line 2)) Requirement already satisfied: Jinja2>=2.3 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from sphinx->sphinx_rtd_theme>=0.3.1->-r docs/requires.txt (line 2)) Requirement already satisfied: docutils>=0.11 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from sphinx->sphinx_rtd_theme>=0.3.1->-r docs/requires.txt (line 2)) Requirement already satisfied: snowballstemmer>=1.1 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from sphinx->sphinx_rtd_theme>=0.3.1->-r docs/requires.txt (line 2)) Requirement already satisfied: babel!=2.0,>=1.3 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from sphinx->sphinx_rtd_theme>=0.3.1->-r docs/requires.txt (line 2)) Requirement already satisfied: packaging in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from sphinx->sphinx_rtd_theme>=0.3.1->-r docs/requires.txt (line 2)) Requirement already satisfied: sphinxcontrib-websupport in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from sphinx->sphinx_rtd_theme>=0.3.1->-r docs/requires.txt (line 2)) Requirement already satisfied: certifi>=2017.4.17 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from requests>=2.0.0->sphinx->sphinx_rtd_theme>=0.3.1->-r docs/requires.txt (line 2)) Requirement already satisfied: urllib3<1.25,>=1.21.1 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from requests>=2.0.0->sphinx->sphinx_rtd_theme>=0.3.1->-r docs/requires.txt (line 2)) Requirement already satisfied: idna<2.8,>=2.5 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from requests>=2.0.0->sphinx->sphinx_rtd_theme>=0.3.1->-r docs/requires.txt (line 2)) Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from requests>=2.0.0->sphinx->sphinx_rtd_theme>=0.3.1->-r docs/requires.txt (line 2)) Requirement already satisfied: MarkupSafe>=0.23 in /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages (from Jinja2>=2.3->sphinx->sphinx_rtd_theme>=0.3.1->-r docs/requires.txt (line 2)) You are using pip version 9.0.3, however version 18.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command. [rtd-command-info] start-time: 2018-11-16T15:40:57.841688Z, end-time: 2018-11-16T15:40:57.900481Z, duration: 0, exit-code: 0 cat docs/conf.py import sys import inspect import logging from pathlib import Path from datetime import datetime from typing import Optional from sphinx.application import Sphinx from sphinx.ext import autosummary # remove PyCharm’s old six module if 'six' in sys.modules: print(*sys.path, sep='\n') for pypath in list(sys.path): if any(p in pypath for p in ['PyCharm', 'pycharm']) and 'helpers' in pypath: sys.path.remove(pypath) del sys.modules['six'] import matplotlib # noqa # Don’t use tkinter agg when importing scanpy → … → matplotlib matplotlib.use('agg') HERE = Path(__file__).parent sys.path.insert(0, str(HERE.parent)) import scanpy.api # noqa logger = logging.getLogger(__name__) # -- General configuration ------------------------------------------------ needs_sphinx = '1.7' # autosummary bugfix extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.coverage', 'sphinx.ext.mathjax', 'sphinx.ext.autosummary', # 'plot_generator', # 'plot_directive', 'sphinx.ext.napoleon', 'sphinx_autodoc_typehints', 'sphinx.ext.intersphinx', # 'ipython_directive', # 'ipython_console_highlighting', ] # Generate the API documentation when building autosummary_generate = True # both of the following two lines don't work # see falexwolf's issue for numpydoc # autodoc_member_order = 'bysource' # autodoc_default_flags = ['members'] napoleon_google_docstring = False napoleon_numpy_docstring = True napoleon_include_init_with_doc = False napoleon_use_rtype = False napoleon_custom_sections = [('Params', 'Parameters')] intersphinx_mapping = dict( python=('https://docs.python.org/3', None), numpy=('https://docs.scipy.org/doc/numpy/', None), scipy=('https://docs.scipy.org/doc/scipy/reference/', None), pandas=('http://pandas.pydata.org/pandas-docs/stable/', None), matplotlib=('https://matplotlib.org/', None), anndata=('https://anndata.readthedocs.io/en/latest/', None), bbknn=('https://bbknn.readthedocs.io/en/latest/', None), leidenalg=('https://leidenalg.readthedocs.io/en/latest/', None), ) templates_path = ['_templates'] source_suffix = '.rst' master_doc = 'index' project = 'Scanpy' author = 'Alex Wolf, Philipp Angerer, Fidel Ramirez, Isaac Virshup, Davide Cittaro, Gokcen Eraslan, Tom White, Tobias Callies, Andrés R. Muñoz-Rojas.' copyright = f'{datetime.now():%Y}, {author}' version = scanpy.__version__.replace('.dirty', '') release = version exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] pygments_style = 'sphinx' todo_include_todos = False # -- Options for HTML output ---------------------------------------------- html_theme = 'sphinx_rtd_theme' html_theme_options = dict( navigation_depth=2, ) html_context = dict( display_github=True, # Integrate GitHub github_user='theislab', # Username github_repo='scanpy', # Repo name github_version='master', # Version conf_py_path='/docs/', # Path in the checkout to the docs root ) html_static_path = ['_static'] def setup(app): app.add_stylesheet('css/custom.css') # -- Options for other output formats ------------------------------------------ htmlhelp_basename = 'Scanpydoc' latex_documents = [ (master_doc, 'Scanpy.tex', 'Scanpy Documentation', 'Alex Wolf, Philipp Angerer', 'manual'), ] man_pages = [ (master_doc, 'scanpy', 'Scanpy Documentation', [author], 1) ] texinfo_documents = [ (master_doc, 'Scanpy', 'Scanpy Documentation', author, 'Scanpy', 'One line description of project.', 'Miscellaneous'), ] # -- generate_options override ------------------------------------------ # TODO: why? def process_generate_options(app: Sphinx): genfiles = app.config.autosummary_generate if genfiles and not hasattr(genfiles, '__len__'): env = app.builder.env genfiles = [ env.doc2path(x, base=None) for x in env.found_docs if Path(env.doc2path(x)).is_file() ] if not genfiles: return from sphinx.ext.autosummary.generate import generate_autosummary_docs ext = app.config.source_suffix genfiles = [ genfile + (not genfile.endswith(tuple(ext)) and ext[0] or '') for genfile in genfiles ] suffix = autosummary.get_rst_suffix(app) if suffix is None: return generate_autosummary_docs( genfiles, builder=app.builder, warn=logger.warning, info=logger.info, suffix=suffix, base_path=app.srcdir, imported_members=True, app=app, ) autosummary.process_generate_options = process_generate_options # -- GitHub URLs for class and method pages ------------------------------------------ def get_obj_module(qualname): """Get a module/class/attribute and its original module by qualname""" modname = qualname classname = None attrname = None while modname not in sys.modules: attrname = classname modname, classname = modname.rsplit('.', 1) # retrieve object and find original module name if classname: cls = getattr(sys.modules[modname], classname) modname = cls.__module__ obj = getattr(cls, attrname) if attrname else cls else: obj = None return obj, sys.modules[modname] def get_linenos(obj): """Get an object’s line numbers""" try: lines, start = inspect.getsourcelines(obj) except TypeError: return None, None else: return start, start + len(lines) - 1 project_dir = Path(__file__).parent.parent # project/docs/conf.py/../.. → project/ github_url1 = 'https://github.com/{github_user}/{github_repo}/tree/{github_version}'.format_map(html_context) github_url2 = 'https://github.com/theislab/anndata/tree/master' def modurl(qualname: str) -> str: """Get the full GitHub URL for some object’s qualname.""" obj, module = get_obj_module(qualname) github_url = github_url1 try: path = Path(module.__file__).relative_to(project_dir) except ValueError: # trying to document something from another package github_url = github_url2 path = '/'.join(module.__file__.split('/')[-2:]) start, end = get_linenos(obj) fragment = f'#L{start}-L{end}' if start and end else '' return f'{github_url}/{path}{fragment}' def api_image(qualname: str) -> Optional[str]: # I’d like to make this a contextfilter, but the jinja context doesn’t contain the path, # so no chance to not hardcode “api/” here. path = Path(__file__).parent / 'api' / f'{qualname}.png' print(path, path.is_file()) return f'.. image:: {path.name}\n :width: 200\n :align: right' if path.is_file() else '' # html_context doesn’t apply to autosummary templates ☹ # and there’s no way to insert filters into those templates # so we have to modify the default filters from jinja2.defaults import DEFAULT_FILTERS DEFAULT_FILTERS.update(modurl=modurl, api_image=api_image) # -- Override some classnames in autodoc -------------------------------------------- import sphinx_autodoc_typehints qualname_overrides = { 'anndata.base.AnnData': 'anndata.AnnData', 'scipy.sparse.base.spmatrix': 'scipy.sparse.spmatrix', 'scipy.sparse.csr.csr_matrix': 'scipy.sparse.csr_matrix', 'scipy.sparse.csc.csc_matrix': 'scipy.sparse.csc_matrix', } fa_orig = sphinx_autodoc_typehints.format_annotation def format_annotation(annotation): if inspect.isclass(annotation): full_name = '{}.{}'.format(annotation.__module__, annotation.__qualname__) override = qualname_overrides.get(full_name) if override is not None: return ':py:class:`~{}`'.format(qualname_overrides[full_name]) return fa_orig(annotation) sphinx_autodoc_typehints.format_annotation = format_annotation # -- Prettier Param docs -------------------------------------------- from typing import Dict, List, Tuple from docutils import nodes from sphinx import addnodes from sphinx.domains.python import PyTypedField, PyObject from sphinx.environment import BuildEnvironment class PrettyTypedField(PyTypedField): list_type = nodes.definition_list def make_field( self, types: Dict[str, List[nodes.Node]], domain: str, items: Tuple[str, List[nodes.inline]], env: BuildEnvironment = None ) -> nodes.field: def makerefs(rolename, name, node): return self.make_xrefs(rolename, domain, name, node, env=env) def handle_item(fieldarg: str, content: List[nodes.inline]) -> nodes.definition_list_item: head = nodes.term() head += makerefs(self.rolename, fieldarg, addnodes.literal_strong) fieldtype = types.pop(fieldarg, None) if fieldtype is not None: head += nodes.Text(' : ') if len(fieldtype) == 1 and isinstance(fieldtype[0], nodes.Text): text_node, = fieldtype # type: nodes.Text head += makerefs(self.typerolename, text_node.astext(), addnodes.literal_emphasis) else: head += fieldtype body_content = nodes.paragraph('', '', *content) body = nodes.definition('', body_content) return nodes.definition_list_item('', head, body) fieldname = nodes.field_name('', self.label) if len(items) == 1 and self.can_collapse: fieldarg, content = items[0] bodynode = handle_item(fieldarg, content) else: bodynode = self.list_type() for fieldarg, content in items: bodynode += handle_item(fieldarg, content) fieldbody = nodes.field_body('', bodynode) return nodes.field('', fieldname, fieldbody) # replace matching field types with ours PyObject.doc_field_types = [ PrettyTypedField( ft.name, names=ft.names, typenames=ft.typenames, label=ft.label, rolename=ft.rolename, typerolename=ft.typerolename, can_collapse=ft.can_collapse, ) if isinstance(ft, PyTypedField) else ft for ft in PyObject.doc_field_types ] ########################################################################### # auto-created readthedocs.org specific configuration # ########################################################################### # # The following code was added during an automated build on readthedocs.org # It is auto created and injected for every build. The result is based on the # conf.py.tmpl file found in the readthedocs.org codebase: # https://github.com/rtfd/readthedocs.org/blob/master/readthedocs/doc_builder/templates/doc_builder/conf.py.tmpl # import importlib import sys import os.path from six import string_types from sphinx import version_info # Get suffix for proper linking to GitHub # This is deprecated in Sphinx 1.3+, # as each page can have its own suffix if globals().get('source_suffix', False): if isinstance(source_suffix, string_types): SUFFIX = source_suffix else: SUFFIX = source_suffix[0] else: SUFFIX = '.rst' # Add RTD Static Path. Add to the end because it overwrites previous files. if not 'html_static_path' in globals(): html_static_path = [] if os.path.exists('_static'): html_static_path.append('_static') html_static_path.append('/home/docs/checkouts/readthedocs.org/readthedocs/templates/sphinx/_static') # Add RTD Theme only if they aren't overriding it already using_rtd_theme = ( ( 'html_theme' in globals() and html_theme in ['default'] and # Allow people to bail with a hack of having an html_style 'html_style' not in globals() ) or 'html_theme' not in globals() ) if using_rtd_theme: theme = importlib.import_module('sphinx_rtd_theme') html_theme = 'sphinx_rtd_theme' html_style = None html_theme_options = {} if 'html_theme_path' in globals(): html_theme_path.append(theme.get_html_theme_path()) else: html_theme_path = [theme.get_html_theme_path()] if globals().get('websupport2_base_url', False): websupport2_base_url = 'https://readthedocs.com/websupport' websupport2_static_url = 'https://media.readthedocs.com/' #Add project information to the template context. context = { 'using_theme': using_rtd_theme, 'html_theme': html_theme, 'current_version': "latest", 'version_slug': "latest", 'MEDIA_URL': "https://media.readthedocs.com/media/", 'STATIC_URL': "https://media.readthedocs.com/", 'PRODUCTION_DOMAIN': "readthedocs.com", 'versions': [ ("latest", "/en/latest/"), ("stable", "/en/stable/"), ], 'downloads': [ ("htmlzip", "//readthedocs.com/projects/icb-scanpy/downloads/htmlzip/latest/"), ], 'subprojects': [ ], 'slug': 'icb-scanpy', 'name': u'scanpy', 'rtd_language': u'en', 'programming_language': u'py', 'canonical_url': 'https://icb-scanpy.readthedocs-hosted.com/en/latest/', 'analytics_code': '', 'single_version': False, 'conf_py_path': '/docs/', 'api_host': 'https://readthedocs.com', 'github_user': 'theislab', 'github_repo': 'scanpy', 'github_version': 'master', 'display_github': True, 'bitbucket_user': 'None', 'bitbucket_repo': 'None', 'bitbucket_version': 'master', 'display_bitbucket': False, 'gitlab_user': 'None', 'gitlab_repo': 'None', 'gitlab_version': 'master', 'display_gitlab': False, 'READTHEDOCS': True, 'using_theme': (html_theme == "default"), 'new_theme': (html_theme == "sphinx_rtd_theme"), 'source_suffix': SUFFIX, 'ad_free': False, 'user_analytics_code': '', 'global_analytics_code': 'UA-17997319-2', 'commit': '1678bead', } if 'html_context' in globals(): html_context.update(context) else: html_context = context # Add custom RTD extension if 'extensions' in globals(): # Insert at the beginning because it can interfere # with other extensions. # See https://github.com/rtfd/readthedocs.org/pull/4054 extensions.insert(0, "readthedocs_ext.readthedocs") else: extensions = ["readthedocs_ext.readthedocs"] [rtd-command-info] start-time: 2018-11-16T15:40:57.966723Z, end-time: 2018-11-16T15:41:17.736860Z, duration: 19, exit-code: 2 python sphinx-build -T -E -b readthedocs -d _build/doctrees-readthedocs -D language=en . _build/html Running Sphinx v1.7.9 /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/bin /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python36.zip /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6 /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/lib-dynload /home/docs/.pyenv/versions/3.6.2/lib/python3.6 /home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages loading translations [en]... done Traceback (most recent call last): File "/home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages/sphinx/cmdline.py", line 303, in main args.warningiserror, args.tags, args.verbosity, args.jobs) File "/home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages/sphinx/application.py", line 191, in __init__ self.setup_extension(extension) File "/home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages/sphinx/application.py", line 411, in setup_extension self.registry.load_extension(self, extname) File "/home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages/sphinx/registry.py", line 326, in load_extension metadata = mod.setup(app) File "/home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages/sphinx_autodoc_typehints.py", line 228, in setup app.connect('config-inited', config_ready) File "/home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages/sphinx/application.py", line 427, in connect listener_id = self.events.connect(event, callback) File "/home/docs/checkouts/readthedocs.org/user_builds/icb-scanpy/envs/latest/lib/python3.6/site-packages/sphinx/events.py", line 63, in connect raise ExtensionError(__('Unknown event name: %s') % name) sphinx.errors.ExtensionError: Unknown event name: config-inited Extension error: Unknown event name: config-inited