From: Michael Fladischer Date: Mon, 6 Jul 2026 18:32:36 +0000 Subject: Use local objects.inv in default intersphinx configuration if files are present. --- doc/conf.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index 22b3996..f16179c 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -29,10 +29,19 @@ exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] # Use Python 3.15 for new features and Python 3.14 as a fallback for APIs that # were removed in Python 3.15. -intersphinx_mapping = { - 'py': ('https://docs.python.org/3.15', None), - 'py314': ('https://docs.python.org/3.14', 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( + 'py', + 'https://docs.python.org/' + '.'.join([str(x) for x in sys.version_info[0:2]]) + "/", + '/usr/share/doc/python' + '.'.join([str(x) for x in sys.version_info[0:2]]) + '/html/objects.inv' + ) +) add_module_names = False