readthedocs / sphinx-autoapi

A new approach to API documentation in Sphinx.
https://sphinx-autoapi.readthedocs.io/
MIT License
415 stars 126 forks source link

Replace usage of deprecated `doc` attribute on astroid nodes #392

Closed AWhetter closed 12 months ago

AWhetter commented 1 year ago

Running the tests outputs the following warnings:

tests/test_integration.py: 3 warnings
tests/python/test_pyintegration.py: 127 warnings
  /home/ashley/workspace/sphinx-autoapi/.tox/py311/lib/python3.11/site-packages/autoapi/mappers/python/parser.py:240: DeprecationWarning: The 'Module.doc' attribute is deprecated, use 'Module.doc_node' instead.
    "doc": _prepare_docstring(node.doc or ""),

tests/test_integration.py: 3 warnings
tests/python/test_parser.py: 3 warnings
tests/python/test_pyintegration.py: 633 warnings
  /home/ashley/workspace/sphinx-autoapi/.tox/py311/lib/python3.11/site-packages/autoapi/mappers/python/astroid_utils.py:603: DeprecationWarning: The 'FunctionDef.doc' attribute is deprecated, use 'FunctionDef.doc_node' instead.
    doc = node.doc

tests/python/test_pyintegration.py: 199 warnings
  /home/ashley/workspace/sphinx-autoapi/.tox/py311/lib/python3.11/site-packages/autoapi/mappers/python/astroid_utils.py:630: DeprecationWarning: The 'ClassDef.doc' attribute is deprecated, use 'ClassDef.doc_node' instead.
    doc = node.doc

tests/python/test_pyintegration.py: 24 warnings
  /home/ashley/workspace/sphinx-autoapi/.tox/py311/lib/python3.11/site-packages/autoapi/mappers/python/astroid_utils.py:640: DeprecationWarning: The 'ClassDef.doc' attribute is deprecated, use 'ClassDef.doc_node' instead.
    if base.doc is not None:

tests/python/test_pyintegration.py: 18 warnings
  /home/ashley/workspace/sphinx-autoapi/.tox/py311/lib/python3.11/site-packages/autoapi/mappers/python/astroid_utils.py:641: DeprecationWarning: The 'ClassDef.doc' attribute is deprecated, use 'ClassDef.doc_node' instead.
    return base.doc

tests/python/test_pyintegration.py: 15 warnings
  /home/ashley/workspace/sphinx-autoapi/.tox/py311/lib/python3.11/site-packages/autoapi/mappers/python/astroid_utils.py:617: DeprecationWarning: The 'FunctionDef.doc' attribute is deprecated, use 'FunctionDef.doc_node' instead.
    and child.doc is not None

tests/python/test_pyintegration.py: 15 warnings
  /home/ashley/workspace/sphinx-autoapi/.tox/py311/lib/python3.11/site-packages/autoapi/mappers/python/astroid_utils.py:619: DeprecationWarning: The 'FunctionDef.doc' attribute is deprecated, use 'FunctionDef.doc_node' instead.
    return child.doc

We need to address these warnings before a release of astroid removes them.

adamnovak commented 9 months ago

It looks like astroid made the 3.0 release today, removing the deprecated fields, but the release with the fix for this issue has not yet been made. Because current releases allow astroid 3 as a dependency, they seem to be broken.