Chilipp / autodocsumm

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

Remove attributes for enums #77

Open mirkolenz opened 2 years ago

mirkolenz commented 2 years ago

Hi! I just discovered this library and like it very much! There is just one thing that does not work as expected: In my code, there are some enums that contain many members (often more than ten). As all those entries are treated as class members (which they are, since a Python enum is a subclass of enum.Enum), autodocsumm creates redundant code: There is a table containing all enum values followed by all enum values.

I worked around that by inserting this code snippet into the docstring of all my enums:

.. autoclasssumm:: ClassName
    :autosummary-sections: Methods

Since these enumerations do not have any methods, no summary table is generated (which is my desired behavior). However, it is somewhat tedious to insert this snippet into the docstring of all enums.

Thus my request: Would it be possible to add an option allowing to disable the generation of a summary in such cases. I could think of two ways to achieve this:

  1. Provide an option like autodocsumm_disabled_classes which you can pass a list of classes that should not have a summary. It has the downside that one still needs to manually insert the names of all enum classes.
  2. Provide an option like autodocsumm_disable_enums that disables the generation of tables for all subclasses of enum.Enum.

I could also imagine that having both settings would be a valuable addition to this library.