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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
|
From 45f3f4833e2eccffadd69a93e9c559339d3980c1 Mon Sep 17 00:00:00 2001
From: "Jose E. Roman" <jroman@dsic.upv.es>
Date: Tue, 11 Nov 2025 19:49:37 +0100
Subject: [PATCH 1/2] doc: fixes for sphinx before 8.2
---
slepc4py/docs/source/conf.py | 17 ++++++++++++++---
1 files changed, 19 insertions(+), 7 deletions(-)
Index: slepc4py/docs/source/conf.py
===================================================================
--- slepc4py.orig/docs/source/conf.py 2025-11-11 21:47:04.080467079 +0100
+++ slepc4py/docs/source/conf.py 2025-11-11 21:48:48.278860735 +0100
@@ -20,7 +20,9 @@
import sphobjinv
import functools
import pylit
+from sphinx import __version__ as sphinx_version
from sphinx.ext.napoleon.docstring import NumpyDocstring
+from packaging.version import Version
# apidoc
sys.path.insert(0, os.path.abspath('.'))
@@ -32,6 +34,7 @@
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
package = 'slepc4py'
+project = 'slepc4py'
docdir = os.path.abspath(os.path.dirname(__file__))
topdir = os.path.abspath(os.path.join(docdir, *[os.path.pardir] * 2))
@@ -117,6 +120,12 @@
'autotype': {},
}
+suppress_warnings = []
+if Version(sphinx_version) >= Version(
+ '7.4'
+): # https://github.com/sphinx-doc/sphinx/issues/12589
+ suppress_warnings.append('autosummary.import_cycle')
+
# Links depends on the actual branch -> release or main
www = f'https://gitlab.com/slepc/slepc/-/tree/{get_doc_branch()}'
extlinks = {'sources': (f'{www}/src/binding/slepc4py/src/%s', '%s')}
@@ -256,14 +265,14 @@
#
- def stringify_annotation(annotation, mode='fully-qualified-except-typing'):
+ def stringify_annotation(annotation, *p, **kw):
qualname = getattr(annotation, '__qualname__', '')
module = getattr(annotation, '__module__', '')
args = getattr(annotation, '__args__', None)
if module == 'builtins' and qualname and args is not None:
- args = ', '.join(stringify_annotation(a, mode) for a in args)
+ args = ', '.join(stringify_annotation(a, *p, **kw) for a in args)
return f'{qualname}[{args}]'
- return stringify_annotation_orig(annotation, mode)
+ return stringify_annotation_orig(annotation, *p, **kw)
try:
stringify_annotation_orig = typing.stringify_annotation
@@ -277,6 +286,8 @@
typing.stringify = stringify_annotation
autodoc.stringify_typehint = stringify_annotation
+ inspect.TypeAliasForwardRef.__repr__ = lambda self: self.name
+
#
class ClassDocumenterMixin:
@@ -321,7 +332,9 @@
@functools.wraps(NumpyDocstring._parse_returns_section)
def wrapper(*args, **kwargs):
out = _parse_returns_section(*args, **kwargs)
- return [line.replace(':class:', ':any:') for line in out]
+ for role in (':py:class:', ':class:'):
+ out = [line.replace(role, ':any:') for line in out]
+ return out
NumpyDocstring._parse_returns_section = wrapper
@@ -337,7 +350,9 @@
@functools.wraps(NumpyDocstring._parse_numpydoc_see_also_section)
def wrapper(*args, **kwargs):
out = _parse_numpydoc_see_also_section(*args, **kwargs)
- return [line.replace(':obj:', ':any:') for line in out]
+ for role in (':py:obj:', ':obj:'):
+ out = [line.replace(role, ':any:') for line in out]
+ return out
NumpyDocstring._parse_numpydoc_see_also_section = wrapper
@@ -483,9 +498,12 @@
html_theme_options = {
'navigation_with_keys': True,
- "footer_end": ["theme-version", "last-updated"],
+ 'footer_end': ['theme-version', 'last-updated'],
+ 'header_links_before_dropdown': 10, # before "more"
}
-git_describe_version = subprocess.check_output(['git', 'describe', '--always']).strip().decode('utf-8') # noqa: S603, S607
+git_describe_version = (
+ subprocess.check_output(['git', 'describe', '--always']).strip().decode('utf-8') # noqa: S603, S607
+)
html_last_updated_fmt = r'%Y-%m-%dT%H:%M:%S%z (' + git_describe_version + ')'
# -- Options for HTMLHelp output ------------------------------------------
|