Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate docs to Sphinx + MyST #285

Merged
merged 14 commits into from Apr 9, 2021
25 changes: 25 additions & 0 deletions docs/conf.py
Expand Up @@ -33,6 +33,31 @@
# Show type hints in descriptions, rather than signatures.
autodoc_typehints = "description"

# Enable 'viewcode-follow-imported' event.
viewcode_follow_imported_members = True
florimondmanca marked this conversation as resolved.
Show resolved Hide resolved

# -- 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)
1 change: 1 addition & 0 deletions httpcore/__init__.py
Expand Up @@ -57,4 +57,5 @@

for _name in __all__:
if not _name.startswith("__"):
__locals[_name].__full_module__ = __locals[_name].__module__ # Used by Shpinx.
florimondmanca marked this conversation as resolved.
Show resolved Hide resolved
setattr(__locals[_name], "__module__", "httpcore") # noqa