Chilipp / autodocsumm

Extending your autodoc API docs with a summary
Apache License 2.0
48 stars 14 forks source link

TypeError: "cannot unpack non-iterable ObjectMember object" with Sphinx 8 #103

Open andy-maier opened 4 hours ago

andy-maier commented 4 hours ago

We get the following failure with Sphinx >=8:

$ sphinx-build -b html -v -n -d ../build_doc/doctrees -c ../docs -D latex_elements.papersize=a4 . ../build_doc/html
Running Sphinx v8.1.2
loading translations [en]... locale_dir /home/runner/work/pywbem/pywbem/docs/locales/en/LC_MESSAGES does not exist
locale_dir /home/runner/work/pywbem/pywbem/docs/locales/en/LC_MESSAGES does not exist
done
Converting `source_suffix = '.rst'` to `source_suffix = {'.rst': 'restructuredtext'}`.
locale_dir /home/runner/work/pywbem/pywbem/docs/locales/en/LC_MESSAGES does not exist
[autosummary] generating autosummary for: appendix.rst, changes.rst, client.rst, client/conversion.rst, client/exceptions.rst, client/logging.rst, client/objects.rst, client/operations.rst, client/proxy.rst, client/security.rst, ..., development.rst, genindex.rst, index.rst, indication.rst, intro.rst, mockwbemserver.rst, server.rst, subscription.rst, tutorial.rst, utilities.rst
loading intersphinx inventory 'py' from https://docs.python.org/3/objects.inv ...
loading intersphinx inventory 'py2' from https://docs.python.org/2/objects.inv ...
loading intersphinx inventory 'py3' from https://docs.python.org/3/objects.inv ...
locale_dir /home/runner/work/pywbem/pywbem/docs/locales/en/LC_MESSAGES does not exist
building [mo]: targets for 0 po files that are out of date
writing output... 
building [html]: targets for 28 source files that are out of date
updating environment: locale_dir /home/runner/work/pywbem/pywbem/docs/locales/en/LC_MESSAGES does not exist
[new config] 28 added, 0 changed, 0 removed
reading sources... [  4%] appendix

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/sphinx/cmd/build.py", line 514, in build_main
    app.build(args.force_all, args.filenames)
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/sphinx/application.py", line 381, in build
    self.builder.build_update()
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/sphinx/builders/__init__.py", line 358, in build_update
    self.build(
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/sphinx/builders/__init__.py", line 385, in build
    updated_docnames = set(self.read())
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/sphinx/builders/__init__.py", line 502, in read
    self._read_serial(docnames)
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/sphinx/builders/__init__.py", line 567, in _read_serial
    self.read_doc(docname)
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/sphinx/builders/__init__.py", line 630, in read_doc
    publisher.publish()
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/docutils/core.py", line 234, in publish
    self.document = self.reader.read(self.source, self.parser,
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/sphinx/io.py", line 106, in read
    self.parse()
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/docutils/readers/__init__.py", line 76, in parse
    self.parser.parse(self.input, document)
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/sphinx/parsers.py", line 85, in parse
    self.statemachine.run(inputlines, document, inliner=self.inliner)
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/docutils/parsers/rst/states.py", line 169, in run
    results = StateMachineWS.run(self, input_lines, input_offset,
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/docutils/statemachine.py", line 233, in run
    context, next_state, result = self.check_line(
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/docutils/statemachine.py", line 445, in check_line
    return method(match, context, next_state)
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/docutils/parsers/rst/states.py", line 2790, in underline
    self.section(title, source, style, lineno - 1, messages)
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/docutils/parsers/rst/states.py", line 325, in section
    self.new_subsection(title, lineno, messages)
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/docutils/parsers/rst/states.py", line 391, in new_subsection
    newabsoffset = self.nested_parse(
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/docutils/parsers/rst/states.py", line 279, in nested_parse
    state_machine.run(block, input_offset, memo=self.memo,
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/docutils/parsers/rst/states.py", line 195, in run
    results = StateMachineWS.run(self, input_lines, input_offset)
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/docutils/statemachine.py", line 233, in run
    context, next_state, result = self.check_line(
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/docutils/statemachine.py", line 445, in check_line
    return method(match, context, next_state)
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/docutils/parsers/rst/states.py", line 2790, in underline
    self.section(title, source, style, lineno - 1, messages)
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/docutils/parsers/rst/states.py", line 325, in section
    self.new_subsection(title, lineno, messages)
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/docutils/parsers/rst/states.py", line 391, in new_subsection
    newabsoffset = self.nested_parse(
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/docutils/parsers/rst/states.py", line 279, in nested_parse
    state_machine.run(block, input_offset, memo=self.memo,
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/docutils/parsers/rst/states.py", line 195, in run
    results = StateMachineWS.run(self, input_lines, input_offset)
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/docutils/statemachine.py", line 233, in run
    context, next_state, result = self.check_line(
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/docutils/statemachine.py", line 445, in check_line
    return method(match, context, next_state)
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/docutils/parsers/rst/states.py", line 2357, in explicit_markup
    nodelist, blank_finish = self.explicit_construct(match)
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/docutils/parsers/rst/states.py", line 2369, in explicit_construct
    return method(self, expmatch)
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/docutils/parsers/rst/states.py", line 2106, in directive
    return self.run_directive(
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/docutils/parsers/rst/states.py", line 2156, in run_directive
    result = directive_instance.run()
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/sphinx/ext/autodoc/directive.py", line 139, in run
    documenter.generate(more_content=self.content)
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/sphinx/ext/autodoc/__init__.py", line 1898, in generate
    return super().generate(more_content=more_content,
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/sphinx/ext/autodoc/__init__.py", line 965, in generate
    self.add_content(more_content)
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/autodocsumm/__init__.py", line 417, in add_content
    self.add_autosummary(relative_ref_paths=True)
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/autodocsumm/__init__.py", line 297, in add_autosummary
    grouped_documenters = self.get_grouped_documenters()
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/autodocsumm/__init__.py", line 223, in get_grouped_documenters
    members = [(membername, member) for (membername, member) in members
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/autodocsumm/__init__.py", line 223, in <listcomp>
    members = [(membername, member) for (membername, member) in members
TypeError: cannot unpack non-iterable ObjectMember object

Exception occurred:
  File "/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/autodocsumm/__init__.py", line 223, in <listcomp>
    members = [(membername, member) for (membername, member) in members
TypeError: cannot unpack non-iterable ObjectMember object
The full traceback has been saved in /tmp/sphinx-err-q5d9hfmk.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!

There are deprecation warnings for Sphinx 8 that are likely related to this issue:

/Users/maiera/virtualenvs/pywbem312/lib/python3.12/site-packages/autodocsumm/__init__.py:223: RemovedInSphinx80Warning: The tuple interface of ObjectMember is deprecated. Use (obj.__name__, obj.object) instead.
  members = [(membername, member) for (membername, member) in members
/Users/maiera/virtualenvs/pywbem312/lib/python3.12/site-packages/autodocsumm/__init__.py:230: RemovedInSphinx80Warning: Returning tuples of (name, object) as the second return value from get_object_members() is deprecated. Return ObjectMember(name, object) instances instead.
  for (mname, member, isattr) in self.filter_members(members, want_all):

Log: https://github.com/pywbem/pywbem/actions/runs/11309119691/job/31452662969

Versions:

theOehrly commented 40 minutes ago

This seems to be a duplicate of #89. I assume you are using the :exclude-members: directive. The relevant PR is #99, but not merged yet.