Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

astroid 3 breaks builds: AttributeError: 'Module' object has no attribute 'doc' #31

Closed
thewtex opened this issue Sep 26, 2023 · 2 comments · Fixed by #39
Closed

astroid 3 breaks builds: AttributeError: 'Module' object has no attribute 'doc' #31

thewtex opened this issue Sep 26, 2023 · 2 comments · Fixed by #39

Comments

@thewtex
Copy link

thewtex commented Sep 26, 2023

I am not sure if this an astroid or autodoc2 issue, but the astroid 3 release broke builds.

Example error:


Running Sphinx v7.2.6
making output directory... done
�[2K[Autodoc2] Analysing package...[  5%] itkwasm.pixel_types
Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/itkwasm/envs/latest/lib/python3.10/site-packages/sphinx/events.py", line 97, in emit
    results.append(listener.handler(self.app, *args))
  File "/home/docs/checkouts/readthedocs.org/user_builds/itkwasm/envs/latest/lib/python3.10/site-packages/autodoc2/sphinx/extension.py", line 76, in run_autodoc
    mod_path = run_autodoc_package(app, config, i)
  File "/home/docs/checkouts/readthedocs.org/user_builds/itkwasm/envs/latest/lib/python3.10/site-packages/autodoc2/sphinx/extension.py", line 164, in run_autodoc_package
    for data in analyse_module(mod_path, mod_name):
  File "/home/docs/checkouts/readthedocs.org/user_builds/itkwasm/envs/latest/lib/python3.10/site-packages/autodoc2/analysis.py", line 41, in analyse_module
    yield from walk_node(
  File "/home/docs/checkouts/readthedocs.org/user_builds/itkwasm/envs/latest/lib/python3.10/site-packages/autodoc2/analysis.py", line 105, in walk_node
    yield from func(node, state)
  File "/home/docs/checkouts/readthedocs.org/user_builds/itkwasm/envs/latest/lib/python3.10/site-packages/autodoc2/analysis.py", line 116, in yield_module
    "doc": fix_docstring_indent(node.doc),
AttributeError: 'Module' object has no attribute 'doc'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/itkwasm/envs/latest/lib/python3.10/site-packages/sphinx/cmd/build.py", line 293, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
  File "/home/docs/checkouts/readthedocs.org/user_builds/itkwasm/envs/latest/lib/python3.10/site-packages/sphinx/application.py", line 272, in __init__
    self._init_builder()
  File "/home/docs/checkouts/readthedocs.org/user_builds/itkwasm/envs/latest/lib/python3.10/site-packages/sphinx/application.py", line 343, in _init_builder
    self.events.emit('builder-inited')
  File "/home/docs/checkouts/readthedocs.org/user_builds/itkwasm/envs/latest/lib/python3.10/site-packages/sphinx/events.py", line 108, in emit
    raise ExtensionError(__("Handler %r for event %r threw an exception") %
sphinx.errors.ExtensionError: Handler <function run_autodoc at 0x7f69dd1211b0> for event 'builder-inited' threw an exception (exception: 'Module' object has no attribute 'doc')
thewtex added a commit to InsightSoftwareConsortium/ITKIOOpenJPH that referenced this issue Sep 26, 2023
thewtex added a commit to InsightSoftwareConsortium/ITKElastix that referenced this issue Oct 1, 2023
kwrobot pushed a commit to Kitware/VTK that referenced this issue Oct 4, 2023
The new version of astroid breaks the build. Constraining the version until a fix is available.
See also sphinx-extensions2/sphinx-autodoc2#31

Co-Authored-By: Jean-Christophe Fillion-Robin <jchris.fillionr@kitware.com>
@jahagirdar
Copy link

Not sure what astroid is, I got the same error for my test class!
─╯
Running Sphinx v7.2.6
loading pickled environment... done
[Autodoc2] Analysing package...[ 33%] testbench.init
Extension error (autodoc2.sphinx.extension):
Handler <function run_autodoc at 0x7fea39dde200> for event 'builder-inited' threw an exception (exception: 'Module' object has no attribute 'doc')
make: *** [Makefile:20: html] Error 2

@bruno-digitbio
Copy link

We hit this issue with our internal docs build at work. Simple enough solution for now is to just pin astroid==2.15.8 (i.e. less than 3.0.0).

It's probably the case that the official release of sphinx-autodoc2 should probably be updated or at least pin astroid for now.

@chrisjsewell chrisjsewell linked a pull request Nov 26, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants