Excluding methods from autoclass generated with autosummary

1,536 views
Skip to first unread message

chri...@grothesque.org

unread,
May 18, 2018, 5:41:37 PM5/18/18
to sphinx-users
Hello,

We are using the autosummary directive to document the contents of a module [1].  Among the module contents is a class that contains some members (for example [2]) that should not be documented.  (Their purpose is to catch a common user error and provide a useful message.)

It seems that we could use the :exclude-members: option with autoclass, but if I am not mistaken that would require stopping to use autosummary for module [1] and adding a bunch of files explicitly that were previously generated by autosummary.  That's quite a lot of boilerplate.  Is there a better solution?

Thanks,
Christoph

[1] https://kwant-project.org/doc/1/reference/kwant.builder
[2] https://kwant-project.org/doc/1/reference/generated/kwant.builder.Builder#kwant.builder.Builder.modes

Carol Willing

unread,
Jun 2, 2018, 9:26:08 PM6/2/18
to sphinx-users
Hi Christoph,

You have a couple of options:

1. If it is only the one function in one class, I would just let it be documented.

2. You could break out the builder into its own section and have 3 sections on the page to generate the stub files and then edit out the function unneeded in the builder.rst file.

3. You could try autodoc-skip-member (though I have not used it) http://www.sphinx-doc.org/en/stable/ext/autodoc.html#event-autodoc-skip-member

If you can you may wish to update to a more recent version of sphinx too.

Carol
Reply all
Reply to author
Forward
0 new messages