-
Notifications
You must be signed in to change notification settings - Fork 92
/
conf.py
63 lines (42 loc) · 1.31 KB
/
conf.py
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
# See: https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --
import os
import sys
# Allow sphinx-autodoc to access `httpcore` contents.
sys.path.insert(0, os.path.abspath("."))
# -- Project information --
project = "HTTPCore"
copyright = "2021, Encode"
author = "Encode"
# -- General configuration --
extensions = [
"myst_parser",
"sphinx.ext.autodoc",
"sphinx.ext.viewcode",
"sphinx.ext.napoleon",
]
myst_enable_extensions = [
"colon_fence",
]
# Preserve :members: order.
autodoc_member_order = "bysource"
# Show type hints in descriptions, rather than signatures.
autodoc_typehints = "description"
# Enable 'viewcode-follow-imported' event.
viewcode_follow_imported_members = True
# -- HTML configuration --
html_theme = "furo"
# -- App setup --
def _viewcode_follow_imported(app, modname, attribute):
# We set `__module__ = "httpcore"` on all public attributes for prettier
# repr(), so viewcode needs a little help to find the original source modules.
if modname != "httpcore":
return None
import httpcore
try:
# Set in httpcore/__init__.py
return getattr(httpcore, attribute).__full_module__
except AttributeError:
return None
def setup(app):
app.connect("viewcode-follow-imported", _viewcode_follow_imported)