Skip to content
Closed
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
16 changes: 15 additions & 1 deletion sphinx_automodapi/autodoc_enhancements.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
import dataclasses

from sphinx.ext.autodoc import AttributeDocumenter
from .utils import SPHINX_LT_8_3

__all__ = []

Expand Down Expand Up @@ -80,6 +80,20 @@ def setup(app):
if 'app.add_directive' not in app.config.suppress_warnings:
app.config.suppress_warnings.append('app.add_directive')
try:
if SPHINX_LT_8_3:
from sphinx.ext.autodoc import AttributeDocumenter

else:
from sphinx.ext.autodoc._directive_options import annotation_option, bool_option
from sphinx.ext.autodoc._documenters import Documenter

class AttributeDocumenter(Documenter):
"""Specialized Documenter subclass for attributes."""
objtype = 'attribute'
option_spec = dict(Documenter.option_spec)
option_spec['annotation'] = annotation_option
option_spec['no-value'] = bool_option

app.add_autodocumenter(AttributeDocumenter)
finally:
app.config.suppress_warnings = suppress_warnings_orig
Expand Down
Loading