hdmf-dev / hdmf-docutils

Collection of CLIs, scripts and modules useful to generate HDMF/NWB schema documentation
Other
0 stars 3 forks source link

Error generating docs for LinkSpec without name #86

Closed rly closed 7 months ago

rly commented 7 months ago

A group spec in an extension has:

        links=[
            NWBLinkSpec(
                doc="The Subject object in the NWB file, if this Skeleton corresponds to the Subject.",
                target_type="Subject",
                quantity="?",
            ),
        ],

Running sphinx-build -b html -v -d build/doctrees source build/html results in:

Traceback (most recent call last):
  File "/Users/rly/mambaforge/envs/test/lib/python3.11/site-packages/sphinx/events.py", line 97, in emit
    results.append(listener.handler(self.app, *args))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rly/Documents/NWB/ndx-pose/docs/source/conf.py", line 73, in run_doc_autogen
    generate_docs()
  File "/Users/rly/mambaforge/envs/test/lib/python3.11/site-packages/hdmf_docutils/generate_format_docs.py", line 535, in main
    render_data_type_section(section=sec,
  File "/Users/rly/mambaforge/envs/test/lib/python3.11/site-packages/hdmf_docutils/generate_format_docs.py", line 334, in render_data_type_section
    rt_spec_data_table = SpecToRST.render_spec_table(
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rly/mambaforge/envs/test/lib/python3.11/site-packages/hdmf_docutils/doctools/renderrst.py", line 697, in render_spec_table
    SpecToRST.render_spec_table(spec=link,
  File "/Users/rly/mambaforge/envs/test/lib/python3.11/site-packages/hdmf_docutils/doctools/renderrst.py", line 644, in render_spec_table
    elif spec.data_type_def is not None:
         ^^^^^^^^^^^^^^^^^^
AttributeError: 'LinkSpec' object has no attribute 'data_type_def'

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

Traceback (most recent call last):
  File "/Users/rly/mambaforge/envs/test/lib/python3.11/site-packages/sphinx/cmd/build.py", line 293, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rly/mambaforge/envs/test/lib/python3.11/site-packages/sphinx/application.py", line 272, in __init__
    self._init_builder()
  File "/Users/rly/mambaforge/envs/test/lib/python3.11/site-packages/sphinx/application.py", line 343, in _init_builder
    self.events.emit('builder-inited')
  File "/Users/rly/mambaforge/envs/test/lib/python3.11/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_doc_autogen at 0x1032058a0> for event 'builder-inited' threw an exception (exception: 'LinkSpec' object has no attribute 'data_type_def')