Debian Codegraph @

docs/conf.py

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 # Configuration file for the Sphinx documentation builder.
2 #
3 # For the full list of built-in configuration values, see the documentation:
4 # https://www.sphinx-doc.org/en/master/usage/configuration.html
5
6 import os
7 import sys
8 import datetime
9
10 sys.path.append(os.path.abspath("./_pygments"))
11
12 # -- Project information -----------------------------------------------------
13 # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
14
15 project = "autoray"
16 copyright = f"2019-{datetime.date.today().year}, Johnnie Gray"
17 author = "Johnnie Gray"
18
19 try:
20 from autoray import __version__
21
22 release = __version__
23 except ImportError:
24 try:
25 from importlib.metadata import version as _version
26
27 release = _version("autoray")
28 except ImportError:
29 release = "0.0.0+unknown"
30
31 # -- General configuration ---------------------------------------------------
32 # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
33
34 extensions = [
35 "myst_nb",
36 "sphinx.ext.intersphinx",
37 "sphinx.ext.extlinks",
38 "sphinx.ext.napoleon",
39 "sphinx.ext.linkcode",
40 "sphinx_copybutton",
41 "autoapi.extension",
42 ]
43
44 nb_execution_mode = "off"
45 myst_heading_anchors = 4
46 myst_enable_extensions = [
47 "amsmath",
48 "colon_fence",
49 "deflist",
50 "dollarmath",
51 "html_image",
52 ]
53
54 # sphinx-autoapi
55 autoapi_dirs = ["../autoray"]
56
57 templates_path = ["_templates"]
58 exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "**.ipynb_checkpoints"]
59
60 # -- Options for HTML output -------------------------------------------------
61 # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
62
63 html_theme = "furo"
64
65 html_theme_options = {
66 "sidebar_hide_name": True,
67 "light_css_variables": {
68 # "color-brand-primary": "hsl(72, 75%, 40%)",
69 # "color-brand-content": "hsl(238, 50%, 60%)",
70 "font-stack": "Atkinson Hyperlegible, sans-serif",
71 "font-stack--monospace": "Spline Sans Mono, monospace",
72 "font-stack--headings": "Spline Sans Mono, monospace",
73 },
74 # "dark_css_variables": {
75 # "color-brand-primary": "hsl(72, 75%, 60%)",
76 # "color-brand-content": "hsl(238, 75%, 70%)",
77 # },
78 "light_logo": "autoray-header.png",
79 "dark_logo": "autoray-header.png",
80 }
81
82 html_css_files = ["my-styles.css"]
83 html_static_path = ["_static"]
84 html_favicon = "_static/autoray.ico"
85
86 pygments_style = "_pygments_light.MarianaLight"
87 pygments_dark_style = "_pygments_dark.MarianaDark"
88
89
90 def linkcode_resolve(domain, info):
91 """
92 Determine the URL corresponding to Python object
93 """
94 import autoray
95 import inspect
96
97 if domain != "py":
98 return None
99
100 modname = info["module"]
101 fullname = info["fullname"]
102
103 submod = sys.modules.get(modname)
104 if submod is None:
105 return None
106
107 obj = submod
108 for part in fullname.split("."):
109 try:
110 obj = getattr(obj, part)
111 except AttributeError:
112 return None
113
114 try:
115 fn = inspect.getsourcefile(inspect.unwrap(obj))
116 except TypeError:
117 fn = None
118 if not fn:
119 return None
120
121 try:
122 source, lineno = inspect.getsourcelines(obj)
123 except OSError:
124 lineno = None
125
126 if lineno:
127 linespec = f"#L{lineno}-L{lineno + len(source) - 1}"
128 else:
129 linespec = ""
130
131 fn = os.path.relpath(fn, start=os.path.dirname(autoray.__file__))
132
133 if "+" in autoray.__version__:
134 return (
135 f"https://github.com/jcmgray/autoray/blob/"
136 f"HEAD/autoray/{fn}{linespec}"
137 )
138 else:
139 return (
140 f"https://github.com/jcmgray/autoray/blob/"
141 f"v{autoray.__version__}/autoray/{fn}{linespec}"
142 )