|
| 1 | +# -*- coding: utf-8 -*- |
| 2 | +# Copyright 2019 Google LLC |
| 3 | +# |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | +# |
| 16 | +# google-cloud-bigquery documentation build configuration file |
| 17 | +# |
| 18 | +# This file is execfile()d with the current directory set to its |
| 19 | +# containing dir. |
| 20 | +# |
| 21 | +# Note that not all possible configuration values are present in this |
| 22 | +# autogenerated file. |
| 23 | +# |
| 24 | +# All configuration values have a default; values that are commented out |
| 25 | +# serve to show the default. |
| 26 | + |
| 27 | +import sys |
| 28 | +import os |
| 29 | +import shutil |
| 30 | + |
| 31 | +from sphinx.util import logging |
| 32 | + |
| 33 | +logger = logging.getLogger(__name__) |
| 34 | + |
| 35 | +# If extensions (or modules to document with autodoc) are in another directory, |
| 36 | +# add these directories to sys.path here. If the directory is relative to the |
| 37 | +# documentation root, use os.path.abspath to make it absolute, like shown here. |
| 38 | +sys.path.insert(0, os.path.abspath("..")) |
| 39 | + |
| 40 | +__version__ = "0.1.0" |
| 41 | + |
| 42 | +# -- General configuration ------------------------------------------------ |
| 43 | + |
| 44 | +# If your documentation needs a minimal Sphinx version, state it here. |
| 45 | +# needs_sphinx = '1.0' |
| 46 | + |
| 47 | +# Add any Sphinx extension module names here, as strings. They can be |
| 48 | +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom |
| 49 | +# ones. |
| 50 | +extensions = [ |
| 51 | + "sphinx.ext.autodoc", |
| 52 | + "sphinx.ext.autosummary", |
| 53 | + "sphinx.ext.intersphinx", |
| 54 | + "sphinx.ext.coverage", |
| 55 | + "sphinx.ext.napoleon", |
| 56 | + "sphinx.ext.viewcode", |
| 57 | +] |
| 58 | + |
| 59 | +# autodoc/autosummary flags |
| 60 | +autoclass_content = "both" |
| 61 | +autodoc_default_flags = ["members"] |
| 62 | +autosummary_generate = True |
| 63 | + |
| 64 | +# Add any paths that contain templates here, relative to this directory. |
| 65 | +templates_path = ["_templates", os.path.join("..", "..", "docs", "_templates")] |
| 66 | + |
| 67 | +# Allow markdown includes (so releases.md can include CHANGLEOG.md) |
| 68 | +# http://www.sphinx-doc.org/en/master/markdown.html |
| 69 | +source_parsers = {".md": "recommonmark.parser.CommonMarkParser"} |
| 70 | + |
| 71 | +# The suffix(es) of source filenames. |
| 72 | +source_suffix = [".rst", ".md"] |
| 73 | + |
| 74 | +# The encoding of source files. |
| 75 | +# source_encoding = 'utf-8-sig' |
| 76 | + |
| 77 | +# The master toctree document. |
| 78 | +master_doc = "index" |
| 79 | + |
| 80 | +# General information about the project. |
| 81 | +project = u"google-cloud-bigquery" |
| 82 | +copyright = u"2015, Google" |
| 83 | +author = u"Google APIs" |
| 84 | + |
| 85 | +# The version info for the project you're documenting, acts as replacement for |
| 86 | +# |version| and |release|, also used in various other places throughout the |
| 87 | +# built documents. |
| 88 | +# |
| 89 | +# The full version, including alpha/beta/rc tags. |
| 90 | +release = __version__ |
| 91 | +# The short X.Y version. |
| 92 | +version = ".".join(release.split(".")[0:2]) |
| 93 | + |
| 94 | +# The language for content autogenerated by Sphinx. Refer to documentation |
| 95 | +# for a list of supported languages. |
| 96 | +# |
| 97 | +# This is also used if you do content translation via gettext catalogs. |
| 98 | +# Usually you set "language" from the command line for these cases. |
| 99 | +language = None |
| 100 | + |
| 101 | +# There are two options for replacing |today|: either, you set today to some |
| 102 | +# non-false value, then it is used: |
| 103 | +# today = '' |
| 104 | +# Else, today_fmt is used as the format for a strftime call. |
| 105 | +# today_fmt = '%B %d, %Y' |
| 106 | + |
| 107 | +# List of patterns, relative to source directory, that match files and |
| 108 | +# directories to ignore when looking for source files. |
| 109 | +exclude_patterns = ["_build"] |
| 110 | + |
| 111 | +# The reST default role (used for this markup: `text`) to use for all |
| 112 | +# documents. |
| 113 | +# default_role = None |
| 114 | + |
| 115 | +# If true, '()' will be appended to :func: etc. cross-reference text. |
| 116 | +# add_function_parentheses = True |
| 117 | + |
| 118 | +# If true, the current module name will be prepended to all description |
| 119 | +# unit titles (such as .. function::). |
| 120 | +# add_module_names = True |
| 121 | + |
| 122 | +# If true, sectionauthor and moduleauthor directives will be shown in the |
| 123 | +# output. They are ignored by default. |
| 124 | +# show_authors = False |
| 125 | + |
| 126 | +# The name of the Pygments (syntax highlighting) style to use. |
| 127 | +pygments_style = "sphinx" |
| 128 | + |
| 129 | +# A list of ignored prefixes for module index sorting. |
| 130 | +# modindex_common_prefix = [] |
| 131 | + |
| 132 | +# If true, keep warnings as "system message" paragraphs in the built documents. |
| 133 | +# keep_warnings = False |
| 134 | + |
| 135 | +# If true, `todo` and `todoList` produce output, else they produce nothing. |
| 136 | +todo_include_todos = True |
| 137 | + |
| 138 | +# -- Options for HTML output ---------------------------------------------- |
| 139 | + |
| 140 | +# The theme to use for HTML and HTML Help pages. See the documentation for |
| 141 | +# a list of builtin themes. |
| 142 | +html_theme = "sphinx_rtd_theme" |
| 143 | + |
| 144 | +# Theme options are theme-specific and customize the look and feel of a theme |
| 145 | +# further. For a list of options available for each theme, see the |
| 146 | +# documentation. |
| 147 | +# html_theme_options = {} |
| 148 | + |
| 149 | +# Add any paths that contain custom themes here, relative to this directory. |
| 150 | +# html_theme_path = [] |
| 151 | + |
| 152 | +# The name for this set of Sphinx documents. If None, it defaults to |
| 153 | +# "<project> v<release> documentation". |
| 154 | +# html_title = None |
| 155 | + |
| 156 | +# A shorter title for the navigation bar. Default is the same as html_title. |
| 157 | +# html_short_title = None |
| 158 | + |
| 159 | +# The name of an image file (relative to this directory) to place at the top |
| 160 | +# of the sidebar. |
| 161 | +# html_logo = None |
| 162 | + |
| 163 | +# The name of an image file (within the static path) to use as favicon of the |
| 164 | +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 |
| 165 | +# pixels large. |
| 166 | +# html_favicon = None |
| 167 | + |
| 168 | +# Add any paths that contain custom static files (such as style sheets) here, |
| 169 | +# relative to this directory. They are copied after the builtin static files, |
| 170 | +# so a file named "default.css" will overwrite the builtin "default.css". |
| 171 | +# html_static_path = [] |
| 172 | + |
| 173 | +# Add any extra paths that contain custom files (such as robots.txt or |
| 174 | +# .htaccess) here, relative to this directory. These files are copied |
| 175 | +# directly to the root of the documentation. |
| 176 | +# html_extra_path = [] |
| 177 | + |
| 178 | +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, |
| 179 | +# using the given strftime format. |
| 180 | +# html_last_updated_fmt = '%b %d, %Y' |
| 181 | + |
| 182 | +# If true, SmartyPants will be used to convert quotes and dashes to |
| 183 | +# typographically correct entities. |
| 184 | +# html_use_smartypants = True |
| 185 | + |
| 186 | +# Custom sidebar templates, maps document names to template names. |
| 187 | +# html_sidebars = {} |
| 188 | + |
| 189 | +# Additional templates that should be rendered to pages, maps page names to |
| 190 | +# template names. |
| 191 | +# html_additional_pages = {} |
| 192 | + |
| 193 | +# If false, no module index is generated. |
| 194 | +# html_domain_indices = True |
| 195 | + |
| 196 | +# If false, no index is generated. |
| 197 | +# html_use_index = True |
| 198 | + |
| 199 | +# If true, the index is split into individual pages for each letter. |
| 200 | +# html_split_index = False |
| 201 | + |
| 202 | +# If true, links to the reST sources are added to the pages. |
| 203 | +# html_show_sourcelink = True |
| 204 | + |
| 205 | +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. |
| 206 | +# html_show_sphinx = True |
| 207 | + |
| 208 | +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. |
| 209 | +# html_show_copyright = True |
| 210 | + |
| 211 | +# If true, an OpenSearch description file will be output, and all pages will |
| 212 | +# contain a <link> tag referring to it. The value of this option must be the |
| 213 | +# base URL from which the finished HTML is served. |
| 214 | +# html_use_opensearch = '' |
| 215 | + |
| 216 | +# This is the file name suffix for HTML files (e.g. ".xhtml"). |
| 217 | +# html_file_suffix = None |
| 218 | + |
| 219 | +# Language to be used for generating the HTML full-text search index. |
| 220 | +# Sphinx supports the following languages: |
| 221 | +# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' |
| 222 | +# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' |
| 223 | +# html_search_language = 'en' |
| 224 | + |
| 225 | +# A dictionary with options for the search language support, empty by default. |
| 226 | +# Now only 'ja' uses this config value |
| 227 | +# html_search_options = {'type': 'default'} |
| 228 | + |
| 229 | +# The name of a javascript file (relative to the configuration directory) that |
| 230 | +# implements a search results scorer. If empty, the default will be used. |
| 231 | +# html_search_scorer = 'scorer.js' |
| 232 | + |
| 233 | +# Output file base name for HTML help builder. |
| 234 | +htmlhelp_basename = "google-cloud-bigquery-doc" |
| 235 | + |
| 236 | +# -- Options for LaTeX output --------------------------------------------- |
| 237 | + |
| 238 | +latex_elements = { |
| 239 | + # The paper size ('letterpaper' or 'a4paper'). |
| 240 | + #'papersize': 'letterpaper', |
| 241 | + # The font size ('10pt', '11pt' or '12pt'). |
| 242 | + #'pointsize': '10pt', |
| 243 | + # Additional stuff for the LaTeX preamble. |
| 244 | + #'preamble': '', |
| 245 | + # Latex figure (float) alignment |
| 246 | + #'figure_align': 'htbp', |
| 247 | +} |
| 248 | + |
| 249 | +# Grouping the document tree into LaTeX files. List of tuples |
| 250 | +# (source start file, target name, title, |
| 251 | +# author, documentclass [howto, manual, or own class]). |
| 252 | +latex_documents = [ |
| 253 | + ( |
| 254 | + master_doc, |
| 255 | + "google-cloud-bigquery.tex", |
| 256 | + u"google-cloud-bigquery Documentation", |
| 257 | + author, |
| 258 | + "manual", |
| 259 | + ) |
| 260 | +] |
| 261 | + |
| 262 | +# The name of an image file (relative to this directory) to place at the top of |
| 263 | +# the title page. |
| 264 | +# latex_logo = None |
| 265 | + |
| 266 | +# For "manual" documents, if this is true, then toplevel headings are parts, |
| 267 | +# not chapters. |
| 268 | +# latex_use_parts = False |
| 269 | + |
| 270 | +# If true, show page references after internal links. |
| 271 | +# latex_show_pagerefs = False |
| 272 | + |
| 273 | +# If true, show URL addresses after external links. |
| 274 | +# latex_show_urls = False |
| 275 | + |
| 276 | +# Documents to append as an appendix to all manuals. |
| 277 | +# latex_appendices = [] |
| 278 | + |
| 279 | +# If false, no module index is generated. |
| 280 | +# latex_domain_indices = True |
| 281 | + |
| 282 | +# -- Options for manual page output --------------------------------------- |
| 283 | + |
| 284 | +# One entry per manual page. List of tuples |
| 285 | +# (source start file, name, description, authors, manual section). |
| 286 | +man_pages = [ |
| 287 | + ( |
| 288 | + master_doc, |
| 289 | + "google-cloud-bigquery", |
| 290 | + u"google-cloud-bigquery Documentation", |
| 291 | + [author], |
| 292 | + 1, |
| 293 | + ) |
| 294 | +] |
| 295 | + |
| 296 | +# If true, show URL addresses after external links. |
| 297 | +# man_show_urls = False |
| 298 | + |
| 299 | +# -- Options for Texinfo output ------------------------------------------- |
| 300 | + |
| 301 | +# Grouping the document tree into Texinfo files. List of tuples |
| 302 | +# (source start file, target name, title, author, |
| 303 | +# dir menu entry, description, category) |
| 304 | +texinfo_documents = [ |
| 305 | + ( |
| 306 | + master_doc, |
| 307 | + "google-cloud-bigquery", |
| 308 | + u"google-cloud-bigquery Documentation", |
| 309 | + author, |
| 310 | + "google-cloud-bigquery", |
| 311 | + "APIs", |
| 312 | + ) |
| 313 | +] |
| 314 | + |
| 315 | +# Documents to append as an appendix to all manuals. |
| 316 | +# texinfo_appendices = [] |
| 317 | + |
| 318 | +# If false, no module index is generated. |
| 319 | +# texinfo_domain_indices = True |
| 320 | + |
| 321 | +# How to display URL addresses: 'footnote', 'no', or 'inline'. |
| 322 | +# texinfo_show_urls = 'footnote' |
| 323 | + |
| 324 | +# If true, do not generate a @detailmenu in the "Top" node's menu. |
| 325 | +# texinfo_no_detailmenu = False |
| 326 | + |
| 327 | +# Example configuration for intersphinx: refer to the Python standard library. |
| 328 | +intersphinx_mapping = { |
| 329 | + "python": ("http://python.readthedocs.org/en/latest/", None), |
| 330 | + "gax": ("https://gax-python.readthedocs.org/en/latest/", None), |
| 331 | + "pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None), |
| 332 | +} |
| 333 | + |
| 334 | +# Napoleon settings |
| 335 | +napoleon_google_docstring = True |
| 336 | +napoleon_numpy_docstring = True |
| 337 | +napoleon_include_private_with_doc = False |
| 338 | +napoleon_include_special_with_doc = True |
| 339 | +napoleon_use_admonition_for_examples = False |
| 340 | +napoleon_use_admonition_for_notes = False |
| 341 | +napoleon_use_admonition_for_references = False |
| 342 | +napoleon_use_ivar = False |
| 343 | +napoleon_use_param = True |
| 344 | +napoleon_use_rtype = True |
| 345 | + |
| 346 | +# Static HTML pages, e.g. to support redirects |
| 347 | +# See: https://tech.signavio.com/2017/managing-sphinx-redirects |
| 348 | +# HTML pages to be copied from source to target |
| 349 | +static_html_pages = ["usage.html", "generated/google.cloud.bigquery.magics.html"] |
| 350 | + |
| 351 | + |
| 352 | +def copy_static_html_pages(app, exception): |
| 353 | + if exception is None and app.builder.name == "html": |
| 354 | + for static_html_page in static_html_pages: |
| 355 | + target_path = app.outdir + "/" + static_html_page |
| 356 | + src_path = app.srcdir + "/" + static_html_page |
| 357 | + if os.path.isfile(src_path): |
| 358 | + logger.info("Copying static html: %s -> %s", src_path, target_path) |
| 359 | + shutil.copyfile(src_path, target_path) |
| 360 | + |
| 361 | + |
| 362 | +def setup(app): |
| 363 | + app.connect("build-finished", copy_static_html_pages) |
0 commit comments