Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 27 additions & 9 deletions nipype/sphinxext/apidoc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Settings for sphinxext.interfaces and connection to sphinx-apidoc."""
import re
from packaging.version import Version

import sphinx
from sphinx.ext.napoleon import (
Config as NapoleonConfig,
_patch_python_domain,
Expand Down Expand Up @@ -39,13 +42,24 @@

"""

_config_values = {
"nipype_skip_classes": (
["Tester", "InputSpec", "OutputSpec", "Numpy", "NipypeTester"],
"env",
),
**NapoleonConfig._config_values,
}
if Version(sphinx.__version__) >= Version("8.2.1"):
_config_values = (
(
"nipype_skip_classes",
["Tester", "InputSpec", "OutputSpec", "Numpy", "NipypeTester"],
"env",
frozenset({list[str]}),
),
*NapoleonConfig._config_values,
)
else:
_config_values = {
"nipype_skip_classes": (
["Tester", "InputSpec", "OutputSpec", "Numpy", "NipypeTester"],
"env",
),
**NapoleonConfig._config_values,
}


def setup(app):
Expand Down Expand Up @@ -82,8 +96,12 @@
app.connect("autodoc-process-docstring", _process_docstring)
app.connect("autodoc-skip-member", _skip_member)

for name, (default, rebuild) in Config._config_values.items():
app.add_config_value(name, default, rebuild)
if Version(sphinx.__version__) >= Version("8.2.1"):
for name, default, rebuild, types in Config._config_values:
app.add_config_value(name, default, rebuild, types=types)

Check warning on line 101 in nipype/sphinxext/apidoc/__init__.py

View check run for this annotation

Codecov / codecov/patch

nipype/sphinxext/apidoc/__init__.py#L99-L101

Added lines #L99 - L101 were not covered by tests
else:
for name, (default, rebuild) in Config._config_values.items():
app.add_config_value(name, default, rebuild)

Check warning on line 104 in nipype/sphinxext/apidoc/__init__.py

View check run for this annotation

Codecov / codecov/patch

nipype/sphinxext/apidoc/__init__.py#L103-L104

Added lines #L103 - L104 were not covered by tests
return {"version": __version__, "parallel_read_safe": True}


Expand Down