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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
From: Michael Fladischer <FladischerMichael@fladi.at>
Date: Mon, 3 Jul 2023 07:18:42 +0000
Subject: Use local objects.inv in intersphinx mapping.
Forwarded: not-needed
---
docs/conf.py | 63 +++++++++++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 52 insertions(+), 11 deletions(-)
diff --git a/docs/conf.py b/docs/conf.py
index e9ed3f8..40e46ae 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -12,6 +12,11 @@ import sys
import inspect
import shutil
+import pandas
+import scipy
+
+from packaging.version import parse as version_parse
+
# -- Path setup --------------------------------------------------------------
__location__ = os.path.join(
@@ -290,14 +295,50 @@ latex_documents = [
# latex_domain_indices = True
# -- External mapping --------------------------------------------------------
-python_version = ".".join(map(str, sys.version_info[0:2]))
-intersphinx_mapping = {
- "sphinx": ("http://www.sphinx-doc.org/en/stable", None),
- "python": ("https://docs.python.org/" + python_version, None),
- "matplotlib": ("https://matplotlib.org", None),
- "numpy": ("https://docs.scipy.org/doc/numpy", None),
- "sklearn": ("https://scikit-learn.org/stable", None),
- "pandas": ("https://pandas.pydata.org/pandas-docs/stable", None),
- "scipy": ("https://docs.scipy.org/doc/scipy/reference", None),
- "pyscaffold": ("https://pyscaffold.org/en/stable", None),
-}
\ No newline at end of file
+#python_version = ".".join(map(str, sys.version_info[0:2]))
+#intersphinx_mapping = {
+# "matplotlib": ("https://matplotlib.org", None),
+# "numpy": ("https://docs.scipy.org/doc/numpy", None),
+# "pyscaffold": ("https://pyscaffold.org/en/stable", None),
+#}
+def check_object_path(key, url, path):
+ if os.path.isfile(path):
+ return {key: (url, path)}
+ return {}
+
+intersphinx_mapping = {}
+intersphinx_mapping.update(
+ check_object_path(
+ 'python',
+ 'https://docs.python.org/',
+ '/usr/share/doc/python' + '.'.join((str(x) for x in sys.version_info[:2])) + '/html/objects.inv'
+ )
+)
+intersphinx_mapping.update(
+ check_object_path(
+ 'sphinx',
+ 'https://www.sphinx-doc.org/en/master/',
+ '/usr/share/doc/sphinx-doc/html/objects.inv'
+ )
+)
+intersphinx_mapping.update(
+ check_object_path(
+ 'sklearn',
+ 'https://scikit-learn.org/stable',
+ '/usr/share/doc/python-sklearn-doc/html/objects.inv'
+ )
+)
+intersphinx_mapping.update(
+ check_object_path(
+ 'pandas',
+ 'https://pandas.pydata.org/pandas-docs/version/{v.major}.{v.minor}'.format(v=version_parse(pandas.__version__)),
+ '/usr/share/doc/python-pandas-doc/html/objects.inv'
+ )
+)
+intersphinx_mapping.update(
+ check_object_path(
+ 'scipy',
+ 'https://docs.scipy.org/doc/scipy-{v}'.format(v=scipy.__version__),
+ '/usr/share/doc/python-scipy-doc/html/objects.inv'
+ )
+)
|