summaryrefslogtreecommitdiff
path: root/docs/conf.py
diff options
context:
space:
mode:
authorJordan Cook <jordan.cook@pioneer.com>2021-04-02 14:03:24 -0500
committerJordan Cook <jordan.cook@pioneer.com>2021-04-03 15:30:00 -0500
commit8854ae6982aeca12349536bcecf16eb0a8973c45 (patch)
treeffddc3493ebcf304e26b18735f9f9f281752872f /docs/conf.py
parent494daa1cb0a276c148b9baf05599f9d1baa01c4b (diff)
downloadrequests-cache-8854ae6982aeca12349536bcecf16eb0a8973c45.tar.gz
Improvements to Sphinx documentation:
* Use sphinx-apidoc to auto-generate sources for backend modules * Still manually adding other modules for more control over formatting * Add a couple more contributors I missed * Include contributors on readthedocs * Add 'all' Makefile target and clean auto-generated docs * Remove unused build targets in Makefile * Update interpshinx links that have moved * Fix some interpshinx links * Fix some `:ref:` links using auto-generated labels (and some manually added labels where convenient) * Fix some docstring formatting * Fix remaining build warnings
Diffstat (limited to 'docs/conf.py')
-rw-r--r--docs/conf.py22
1 files changed, 19 insertions, 3 deletions
diff --git a/docs/conf.py b/docs/conf.py
index 930c430..e8b5744 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -1,12 +1,16 @@
# requests-cache documentation build configuration file
import os
import sys
+from os.path import abspath, dirname, join
# Add project path
sys.path.insert(0, os.path.abspath('..'))
from requests_cache import __version__ # noqa: E402
+PROJECT_DIR = abspath(dirname(dirname(__file__)))
+PACKAGE_DIR = join(PROJECT_DIR, 'requests_cache')
+
# General information about the project.
project = 'requests-cache'
copyright = '2021, Roman Haritonov'
@@ -27,15 +31,18 @@ extensions = [
'sphinx.ext.viewcode',
'sphinx_autodoc_typehints',
'sphinx_copybutton',
- # 'sphinxcontrib.apidoc',
+ 'sphinxcontrib.apidoc',
'm2r2',
]
+# Exclude auto-generated page for top-level __init__.py
+exclude_patterns = ['_build', 'modules/requests_cache.rst']
+
# Enable automatic links to other projects' Sphinx docs
intersphinx_mapping = {
'python': ('https://docs.python.org/3', None),
- 'requests': ('https://requests.readthedocs.io/en/master/', None),
- 'urllib3': ('http://urllib3.readthedocs.org/en/latest', None),
+ 'requests': ('https://docs.python-requests.org/en/master/', None),
+ 'urllib3': ('https://urllib3.readthedocs.io/en/latest/', None),
}
# Enable Google-style docstrings
@@ -47,6 +54,15 @@ napoleon_include_special_with_doc = False
copybutton_prompt_text = r'>>> |\.\.\. |\$ '
copybutton_prompt_is_regexp = True
+# Use apidoc to auto-generate rst sources
+apidoc_module_dir = PACKAGE_DIR
+apidoc_output_dir = 'modules'
+apidoc_excluded_paths = []
+apidoc_module_first = True
+# apidoc_separate_modules = True
+apidoc_toc_file = False
+autosectionlabel_prefix_document = True
+
# HTML theme settings
pygments_style = 'sphinx'
html_theme = 'sphinx_rtd_theme'