Skip to content

Conversation

@changlichun
Copy link

The code might be redundant. The summary table is not completed.
Any comments and suggestions are very welcome!

* Add autosummary feature in mat_autosummary.py file

*.Add an test example in tests folder
@@ -0,0 +1,8 @@
.. autosummary::
:toctree: generated/
:template: matmodule.rst
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there documentation somewhere on when matmodule.rst, matclass.rst, or matbase.rst should be used?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

matmodule.rst, matclass.rst, matbase.rst are used as default template file for modules classes and others. It could be omitted. And users could create their own template files.

I add a simple explaination in the file.

@DutchGFX
Copy link

DutchGFX commented Aug 8, 2023

Would suggest adding this feature into the overall docs as part of the PR so that this feature is documented on the default docs page, rather than just in the test folder

@joeced
Copy link
Collaborator

joeced commented Aug 12, 2023

Hi

Thanks for the contribution. Can you by any chance make an automated test, akin to https://github.com/sphinx-contrib/matlabdomain/blob/master/tests/test_autodoc.py ?

@DutchGFX
Copy link

I can potentially help with this, but don't want to step on any toes...

@rebeccamccabe
Copy link

I tried using this fork with Sphinx 8.2.3 and got an error about the split_full_qualified_name function not existing. I downgraded to sphinx 7.1.2 and it fixed it. But then I get the following error when trying to use the auto summary feature:

$ sphinx-build -v -E -b html docs docs/_build
Running Sphinx v7.1.2
locale_dir /home/becca/Documents/git/MDOcean/docs/locales/en/LC_MESSAGES does not exists

Traceback (most recent call last):
  File "/home/becca/miniconda3/envs/sphinxenv/lib/python3.13/site-packages/sphinx/events.py", line 96, in emit
    results.append(listener.handler(self.app, *args))
                   ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/home/becca/miniconda3/envs/sphinxenv/lib/python3.13/site-packages/sphinxcontrib/matlab.py", line 844, in analyze
    mat_types.analyze(app)
    ~~~~~~~~~~~~~~~~~^^^^^
  File "/home/becca/miniconda3/envs/sphinxenv/lib/python3.13/site-packages/sphinxcontrib/mat_types.py", line 197, in analyze
    root.safe_getmembers()
    ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'safe_getmembers'

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

Traceback (most recent call last):
  File "/home/becca/miniconda3/envs/sphinxenv/lib/python3.13/site-packages/sphinx/cmd/build.py", line 285, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
                 args.doctreedir, args.builder, args.confoverrides, args.status,
                 args.warning, args.freshenv, args.warningiserror,
                 args.tags, args.verbosity, args.jobs, args.keep_going,
                 args.pdb)
  File "/home/becca/miniconda3/envs/sphinxenv/lib/python3.13/site-packages/sphinx/application.py", line 268, in __init__
    self._init_builder()
    ~~~~~~~~~~~~~~~~~~^^
  File "/home/becca/miniconda3/envs/sphinxenv/lib/python3.13/site-packages/sphinx/application.py", line 339, in _init_builder
    self.events.emit('builder-inited')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/home/becca/miniconda3/envs/sphinxenv/lib/python3.13/site-packages/sphinx/events.py", line 107, in emit
    raise ExtensionError(__("Handler %r for event %r threw an exception") %
                         (listener.handler, name), exc, modname=modname) from exc
sphinx.errors.ExtensionError: Handler <function analyze at 0x7f2b158c6d40> for event 'builder-inited' threw an exception (exception: 'NoneType' object has no attribute 'safe_getmembers')

so I am not planning to use the matlab auto summary feature anymore.

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 this pull request may close these issues.

4 participants