| 1 |
import sys |
| 2 |
|
| 3 |
from pallets_sphinx_themes import get_version |
| 4 |
from pallets_sphinx_themes import ProjectLink |
| 5 |
|
| 6 |
# Project -------------------------------------------------------------- |
| 7 |
|
| 8 |
project = "CacheLib" |
| 9 |
copyright = "2018 Pallets" |
| 10 |
author = "Pallets" |
| 11 |
release, version = get_version("cachelib") |
| 12 |
|
| 13 |
# General -------------------------------------------------------------- |
| 14 |
|
| 15 |
default_role = "code" |
| 16 |
extensions = [ |
| 17 |
"sphinx.ext.autodoc", |
| 18 |
"sphinx.ext.extlinks", |
| 19 |
"sphinx.ext.intersphinx", |
| 20 |
"sphinxcontrib.log_cabinet", |
| 21 |
"sphinx_copybutton", |
| 22 |
"sphinx_tabs.tabs", |
| 23 |
"pallets_sphinx_themes", |
| 24 |
] |
| 25 |
autodoc_member_order = "bysource" |
| 26 |
autodoc_typehints = "description" |
| 27 |
autodoc_preserve_defaults = True |
| 28 |
extlinks = { |
| 29 |
"issue": ("https://github.com/pallets-eco/cachelib/issues/%s", "#%s"), |
| 30 |
"pr": ("https://github.com/pallets-eco/cachelib/pull/%s", "#%s"), |
| 31 |
"ghsa": ( |
| 32 |
"https://github.com/pallets-eco/cachelib/security/advisories/GHSA-%s", |
| 33 |
"GHSA-%s", |
| 34 |
), |
| 35 |
} |
| 36 |
intersphinx_mapping = { |
| 37 |
"python": ("https://docs.python.org/3/", None), |
| 38 |
} |
| 39 |
|
| 40 |
# HTML ----------------------------------------------------------------- |
| 41 |
|
| 42 |
html_theme = "werkzeug" |
| 43 |
html_theme_options = {"index_sidebar_logo": False} |
| 44 |
html_context = { |
| 45 |
"project_links": [ |
| 46 |
ProjectLink("Donate", "https://palletsprojects.com/donate"), |
| 47 |
ProjectLink("PyPI Releases", "https://pypi.org/project/cachelib/"), |
| 48 |
ProjectLink("Source Code", "https://github.com/pallets-eco/cachelib/"), |
| 49 |
ProjectLink("Issue Tracker", "https://github.com/pallets-eco/cachelib/issues/"), |
| 50 |
ProjectLink("Chat", "https://discord.gg/pallets"), |
| 51 |
] |
| 52 |
} |
| 53 |
html_sidebars = { |
| 54 |
"index": ["project.html", "localtoc.html", "searchbox.html"], |
| 55 |
"**": ["localtoc.html", "relations.html", "searchbox.html"], |
| 56 |
} |
| 57 |
singlehtml_sidebars = {"index": ["project.html", "localtoc.html"]} |
| 58 |
html_title = f"{project} Documentation ({version})" |
| 59 |
html_show_sourcelink = False |
| 60 |
|
| 61 |
# -- Options for copy button --------------------------------------------------- |
| 62 |
|
| 63 |
# virtual env prefix: (venv), (cachelib-venv), (testenv) |
| 64 |
venv = r"\((?:(?:cachelib-)?venv|testvenv)\)" |
| 65 |
# macOS and Linux shell prompt: $ |
| 66 |
shell = r"\$" |
| 67 |
# win CMD prompt: C:\>, C:\...> |
| 68 |
cmd = r"C:\\>|C:\\\.\.\.>" |
| 69 |
# PowerShell prompt: PS C:\>, PS C:\...> |
| 70 |
ps = r"PS C:\\>|PS C:\\\.\.\.>" |
| 71 |
# zero or one whitespace char |
| 72 |
sp = r"\s?" |
| 73 |
|
| 74 |
# optional venv prefix |
| 75 |
venv_prefix = rf"(?:{venv})?" |
| 76 |
# one of the platforms' shell prompts |
| 77 |
shell_prompt = rf"(?:{shell}|{cmd}|{ps})" |
| 78 |
|
| 79 |
copybutton_prompt_text = "|".join( |
| 80 |
[ |
| 81 |
# Python REPL |
| 82 |
# r">>>\s?", r"\.\.\.\s?", |
| 83 |
# IPython and Jupyter |
| 84 |
# r"In \[\d*\]:\s?", r" {5,8}:\s?", r" {2,5}\.\.\.:\s?", |
| 85 |
# Shell prompt |
| 86 |
rf"{venv_prefix}{sp}{shell_prompt}{sp}", |
| 87 |
] |
| 88 |
) |
| 89 |
copybutton_prompt_is_regexp = True |
| 90 |
copybutton_remove_prompts = True |
| 91 |
copybutton_only_copy_prompt_lines = True |
| 92 |
copybutton_copy_empty_lines = False |
| 93 |
|
| 94 |
# -- Options for spelling ------------------------------------------- |
| 95 |
|
| 96 |
# Spelling check needs an additional module that is not installed by default. |
| 97 |
# Add it only if spelling check is requested so docs can be generated without it. |
| 98 |
if "spelling" in sys.argv: |
| 99 |
extensions.append("sphinxcontrib.spelling") |
| 100 |
|
| 101 |
# Spelling language. |
| 102 |
spelling_lang = "en_US" |
| 103 |
|
| 104 |
# Location of word list. |
| 105 |
spelling_word_list_filename = "spelling_wordlist" |