readthedocs / sphinx-autoapi

A new approach to API documentation in Sphinx.
https://sphinx-autoapi.readthedocs.io/
MIT License
440 stars 132 forks source link

Remove Attributes + classes show no description #443

Open Gabriel-p opened 6 months ago

Gabriel-p commented 6 months ago

My documentation can be found here https://asteca.readthedocs.io/en/latest/autoapi/asteca/index.html

I have two issues:

  1. I'd like to remove the 'Attributes' section entirely as it is just duplicated info from 'Submodules'
  2. Classes descriptions randomly do not show (some builds it will, some it won't)

Can this be done? Thank you!

Captura de pantalla de 2024-05-07 17 22 27

AWhetter commented 6 months ago

For (1), this page outlines how you can customise what gets documented: https://sphinx-autoapi.readthedocs.io/en/latest/how_to.html#how-to-customise-what-gets-documented So you could either set an __all__ or filter out __version__ using a function connected to the autoapi-skip-member event.

For (2), it'll require some more investigation. It looks to be something going wrong in the autosummary directive because the class itself has the docstring. Maybe the fact that it's a dataclass is what's triggering the bug. Thanks for providing a way to reproduce the issue.

Gabriel-p commented 6 months ago

Thank you @AWhetter. I explained myself poorly, what I want is for the listing of classes at the bottom of that page to not be there.

Not only because it is repeated information, but also because it seems to introduce warnings such as:

/home/gabriel/Github/ASteCA/ASteCA/asteca/docs/autoapi/asteca/index.rst:199: WARNING: duplicate object description of asteca.cluster, other instance in autoapi/asteca/cluster/index, use :no-index: for one of them
/home/gabriel/Github/ASteCA/ASteCA/asteca/docs/autoapi/asteca/isochrones/index.rst:6: WARNING: duplicate object description of asteca.isochrones, other instance in autoapi/asteca/index, use :no-index: for one of them
/home/gabriel/Github/ASteCA/ASteCA/asteca/docs/autoapi/asteca/likelihood/index.rst:6: WARNING: duplicate object description of asteca.likelihood, other instance in autoapi/asteca/index, use :no-index: for one of them
/home/gabriel/Github/ASteCA/ASteCA/asteca/docs/autoapi/asteca/synthetic/index.rst:6: WARNING: duplicate object description of asteca.synthetic, other instance in autoapi/asteca/index, use :no-index: for one of them

that I don't know how to get rid of.

Also, it confuses the links. For example, if you go to https://asteca.readthedocs.io/en/latest/autoapi/asteca/synthetic/index.html# and click on asteca.cluster as shown below, it will take you here https://asteca.readthedocs.io/en/latest/autoapi/asteca/index.html#asteca.cluster instead of https://asteca.readthedocs.io/en/latest/autoapi/asteca/cluster/index.html

Captura de pantalla de 2024-05-08 09 08 21

Gabriel-p commented 6 months ago

I see now that I can create my own API page and put whatever contents I want there, for example:

:py:mod:`asteca`
================

Package Contents
----------------

.. toctree::
   :titlesonly:
   :maxdepth: 2

   /../autoapi/asteca/cluster/index.rst
   /../autoapi/asteca/isochrones/index.rst
   /../autoapi/asteca/synthetic/index.rst
   /../autoapi/asteca/likelihood/index.rst

This solves the issue of Attributes being displayed but I still can not get rid of the autoapi/asteca/index.rst file which is causing the issues with the warnings and bad links that I described above.