|
4 | 4 | # list see the documentation: |
5 | 5 | # https://www.sphinx-doc.org/en/master/usage/configuration.html |
6 | 6 |
|
7 | | -from typing import List |
8 | 7 | from pathlib import Path |
9 | 8 | from datetime import datetime |
10 | 9 | import os |
11 | 10 |
|
12 | 11 | # -- Path setup -------------------------------------------------------------- |
13 | 12 | import sys |
14 | 13 |
|
| 14 | +from sphinx.application import Sphinx |
| 15 | + |
15 | 16 | HERE = Path(__file__).parent |
16 | 17 | sys.path.insert(0, str(HERE.parent.parent)) |
17 | 18 | sys.path.insert(0, os.path.abspath("_ext")) |
|
21 | 22 | needs_sphinx = "3.3" |
22 | 23 | # -- Project information ----------------------------------------------------- |
23 | 24 |
|
24 | | -project = "pygpcca" |
| 25 | +project = "pyGPCCA" |
25 | 26 | author = pygpcca.__author__ |
26 | 27 | copyright = f"{datetime.now():%Y}, {author}" # noqa: A001 |
27 | 28 |
|
28 | 29 | # The full version, including alpha/beta/rc tags |
29 | 30 | master_doc = "index" |
30 | | -release = "0.0.0" |
| 31 | +release = "main" |
| 32 | +version = f"main ({pygpcca.__version__})" |
31 | 33 |
|
32 | 34 |
|
33 | 35 | # -- General configuration --------------------------------------------------- |
|
44 | 46 | "sphinx.ext.mathjax", |
45 | 47 | "sphinx_autodoc_typehints", |
46 | 48 | "sphinx_last_updated_by_git", |
| 49 | + "sphinx_copybutton", |
47 | 50 | "typed_returns", |
48 | 51 | "nbsphinx", |
49 | 52 | ] |
|
59 | 62 | # List of patterns, relative to source directory, that match files and |
60 | 63 | # directories to ignore when looking for source files. |
61 | 64 | # This pattern also affects html_static_path and html_extra_path. |
62 | | -exclude_patterns: List[str] = [] |
| 65 | +exclude_patterns = ["build", "**.ipynb_checkpoints"] |
63 | 66 |
|
64 | 67 | source_suffix = ".rst" |
65 | 68 | add_function_parentheses = True |
|
84 | 87 | napoleon_use_admonition_for_references = False |
85 | 88 | todo_include_todos = False |
86 | 89 |
|
| 90 | +# binder |
| 91 | +nbsphinx_highlight_language = "python3" |
| 92 | +nbsphinx_execute_arguments = [ |
| 93 | + "--InlineBackend.figure_formats={'png', 'pdf'}", # correct figure resize |
| 94 | + "--InlineBackend.rc={'figure.dpi': 96}", |
| 95 | +] |
| 96 | +nbsphinx_prolog = r""" |
| 97 | +{% set docname = 'docs/source/' + env.doc2path(env.docname, base=None) %} |
| 98 | +.. raw:: html |
| 99 | +
|
| 100 | + <div class="note"> |
| 101 | + Interactive version |
| 102 | + <a href="https://mybinder.org/v2/gh/msmdev/pygpcca/{{ env.config.release|e }}?filepath={{ docname|e }}"><img alt="Binder badge" src="https://mybinder.org/badge_logo.svg" style="vertical-align:text-bottom"> |
| 103 | + </a> |
| 104 | + </div> |
| 105 | +""" # noqa: E501 |
| 106 | + |
| 107 | +# spelling |
| 108 | +spelling_lang = "en_US" |
| 109 | +spelling_warning = True |
| 110 | +spelling_word_list_filename = "spelling_wordlist.txt" |
| 111 | +spelling_add_pypi_package_names = True |
| 112 | +spelling_show_suggestions = True |
| 113 | +# see: https://pyenchant.github.io/pyenchant/api/enchant.tokenize.html |
| 114 | +spelling_filters = ["enchant.tokenize.URLFilter", "enchant.tokenize.EmailFilter"] |
| 115 | + |
87 | 116 | # Add any paths that contain custom static files (such as style sheets) here, |
88 | 117 | # relative to this directory. They are copied after the builtin static files, |
89 | 118 | # so a file named "default.css" will overwrite the builtin "default.css". |
|
93 | 122 | html_show_sphinx = False |
94 | 123 | html_use_smartypants = True |
95 | 124 | pygments_style = "sphinx" |
| 125 | + |
| 126 | + |
| 127 | +def setup(app: Sphinx) -> None: |
| 128 | + app.add_css_file("css/custom.css") |
0 commit comments