1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285
|
# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE.txt, distributed with this software.
# ----------------------------------------------------------------------------
# Configuration file for the Sphinx documentation builder.
# Instructions:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
import sys
import inspect
from datetime import datetime
from os.path import abspath, relpath, dirname
import skbio
sys.path.insert(0, abspath('.'))
# -- Project information -----------------------------------------------------
project = 'scikit-bio'
author = f'{project} development team'
copyright = f'2014-{datetime.now().year}, {author}'
version = skbio.__version__
release = skbio.__version__
# -- General configuration ---------------------------------------------------
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.mathjax',
'sphinx.ext.linkcode',
'sphinx.ext.coverage',
'sphinx.ext.doctest',
'sphinx.ext.autosummary',
'sphinx.ext.intersphinx',
'sphinx.ext.extlinks',
'numpydoc',
'sphinx_design',
'sphinx_copybutton',
'matplotlib.sphinxext.plot_directive',
'sphinx_sitemap',
]
mathjax_path='MathJax.js'
root_doc = 'index'
templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# -- Options for manual page output ------------------------------------------
# Elements: startdocname, name, description, authors, section
man_pages = [
(root_doc, project, f'{project} Documentation', author, 1),
]
# -- Options for Texinfo output ----------------------------------------------
# Elements: startdocname, targetname, title, author, dir_entry, description,
# category, [toctree_only]
texinfo_documents = [
(root_doc, project, f'{project} Documentation', author, project,
'Data structures, algorithms, and educational resources for working with '
'biological data in Python.', 'Science'),
]
# -- Options for HTML output -------------------------------------------------
html_title = f'{project} {version} documentation'
html_short_title = project
html_baseurl = 'https://scikit.bio'
html_logo = '_static/logo.svg'
html_favicon = '_static/favicon.ico'
htmlhelp_basename = 'skbio-doc'
# static files
html_static_path = ['_static']
html_css_files = ['css/style.css']
# do not show source links
html_show_sourcelink = False
# do not show () after function link
add_function_parentheses = False
# -- External links ----------------------------------------------------------
github_url = f'https://github.com/{project}/{project}'
twitter_url = 'https://twitter.com/scikitbio'
wiki_url = 'https://en.wikipedia.org/wiki'
extlinks = {
'home': (f'{html_baseurl}/%s', None),
'repo': (f'{github_url}/%s', None),
'wiki': (f'{wiki_url}/%s', None),
}
# -- Sitemap configuration ---------------------------------------------------
doc_dir = 'dev' if version.endswith('-dev') else version
sitemap_url_scheme = f'/docs/{doc_dir}/{{link}}'
# -- numpydoc configuration --------------------------------------------------
# References:
# https://numpydoc.readthedocs.io/en/latest/install.html#configuration
numpydoc_class_members_toctree = False
numpydoc_show_class_members = False
numpydoc_show_inherited_class_members = False
# -- PyData Theme configuration ----------------------------------------------
# References:
# https://pydata-sphinx-theme.readthedocs.io/en/stable/user_guide/layout.html#
# references
html_theme = 'pydata_sphinx_theme'
html_theme_options = {
# logo image for light/dark modes
# image files must be placed under _static/
'logo': {
'link': html_baseurl,
'alt_text': html_title,
'image_light': '_static/logo.svg',
'image_dark': '_static/logo_inv.svg',
},
# social media links displayed as icons
'github_url': github_url,
'twitter_url': twitter_url,
# show warning if not latest stable version
# 'show_version_warning_banner': True,
# version switcher
'switcher': {
'json_url': f'{html_baseurl}/versions.json',
'version_match': doc_dir,
},
# simplify section navigation
'navigation_depth': 2,
'collapse_navigation': True,
# display all header links
'header_links_before_dropdown': 7,
# header layout
'navbar_start': ['navbar-logo', 'version-switcher'],
# footer layout
'footer_start': ['copyright'],
'footer_center': ['sphinx-version'],
'footer_end': ['theme-version'],
# google analytics
'analytics': {
'google_analytics_id': 'UA-6636235-9',
}
}
# -- Intersphinx configuration -----------------------------------------------
# References:
# https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html
intersphinx_mapping = {
'python': ('/usr/share/doc/python3/html/', None),
'numpy': ('/usr/share/doc/python-numpy/html/', None),
'scipy': ('/usr/share/doc/python-scipy-doc/html/', None),
'matplotlib': ('/usr/share/doc/python-matplotlib-doc/html/', None),
'pandas': ('/usr/share/doc/python-pandas-doc/html/', None),
'sklearn': ('/usr/share/doc/python-sklearn-doc/html/', None),
'statsmodels': ('/usr/share/doc/python-statsmodels-doc/html/', None),
'biom-format': ('/usr/share/doc/python-biom-format-doc/html/', None)
}
# -- matplotlib.sphinxext.plot_directive -------------------------------------
# References:
# https://matplotlib.org/stable/api/sphinxext_plot_directive_api.html
plot_include_source = True
plot_html_show_source_link = False
plot_formats = ['png']
plot_html_show_formats = False
# -- Source code links --------------------------------------------------------
def linkcode_resolve(domain, info):
"""Determine the URL corresponding to a Python object.
"""
if domain != 'py':
return None
modname = info['module']
fullname = info['fullname']
submod = sys.modules.get(modname)
if submod is None:
return None
obj = submod
for part in fullname.split('.'):
try:
obj = getattr(obj, part)
except:
return None
try:
fn = inspect.getsourcefile(obj)
except:
fn = None
if not fn:
try:
fn = inspect.getsourcefile(sys.modules[obj.__module__])
except:
fn = None
if not fn:
return None
try:
_, lineno = inspect.findsource(obj)
except:
lineno = None
branch = 'main' if 'dev' in version else version
fn = relpath(fn, start=dirname(skbio.__file__))
linespec = f'#L{lineno + 1}' if lineno else ''
return f'{github_url}/blob/{branch}/skbio/{fn}{linespec}'
# You might see the following exception when building the documentation:
# TypeError: 'abstractproperty' object is not iterable
from skbio.util._decorator import classproperty
def _closure():
def __get__(self, cls, owner):
return self
classproperty.__get__ = __get__
_closure()
# Import the patched autosummary extension to support automatic inheritance.
from autoinherit import InheritedAutosummary
# Let autosummary skip members that have a "skipdoc" attribute that is True.
def skip_member(app, what, name, obj, skip, options):
return getattr(obj, "_skipdoc", None)
def setup(app):
app.add_directive('autoinherit', InheritedAutosummary)
app.connect("autodoc-skip-member", skip_member)
|