-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
No member information generated for exceptions #162
Comments
According to https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#directive-autoexception , it "will by default only insert the docstring of the object itself". If you want methods includes, you have to provide extra directives. That is from Sphinx proper, I don't think this is strictly related to sphinx-automodapi ? I could have misunderstood your problem though. Can you please clarify? Thanks! |
The second example in my bug report is the rST code that sphinx-automodapi generates for a regular class, so I don't think it's relying on any special support in Sphinx for generating the method summary. It's generating rST specifying which methods for which to generate documentation. What I would like it to do is the same thing for exceptions. Currently, apparently exceptions are special-cased to not get the method summary of other classes. I suspect the problem may be that there is no template for exceptions, and therefore the code here:
falls back on the base template, which doesn't include a method summary. I would get the behavior that I want if a template like the class template were used instead, I think (although there are probably complications that I'm not yet seeing). Although I'm not 100% sure I found the correct code, since the rST generated for an exception doesn't quite match any of the templates. |
We currently do not have resources to maintain this much, so if you really want this fixed, feel free to submit a PR, or not use automodapi for that section. Thanks! |
I'll ping this one, as I also have a custom exception with documented methods that don't show up in our output docs because of this: This docstring and method: doesn't appear here in the output docs here: https://pipelines.lsst.io/v/daily/py-api/lsst.pipe.base.AnnotatedPartialOutputsError.html |
I'm working on a code base that often defines methods (both class and instance) on exceptions. The class methods are used to construct the exception from other data (often other underlying exceptions), and the instance methods are used to format the exceptions for reporting to external systems.
It looks like sphinx-automodapi doesn't generate method information for exceptions, and I didn't see any documented way to enable this. For example, an exception class with a
to_slack
instance method and afrom_exception
class method generates only:I was hoping there would be some way to enable the normal sort of class documentation, such as:
The text was updated successfully, but these errors were encountered: