python-project-template icon indicating copy to clipboard operation
python-project-template copied to clipboard

Cleaner left-hand table-of-contents for API reference

Open delucchi-cmu opened this issue 1 year ago • 4 comments

Looking at the HATS RTD, the menu options in the left-hand-side for the API reference have a lot of unnecessary duplication:

API reference
└── hats
    ├── hats.catalog
    ├── hats.inspection
    └── ...

I would really love if we could have it be simpler:

hats API reference
├── catalog
├── inspection
└── ... 

this includes the package name in the top-level, and omits the package name from the submodule names.

I don't even know if sphinx/autoapi supports this, but I can dream, right?

delucchi-cmu avatar Nov 14 '24 18:11 delucchi-cmu

Initial search shows: https://stackoverflow.com/questions/20864406/remove-package-and-module-name-from-sphinx-function but am in the meeting so can't follow up rn

olivialynn avatar Jan 24 '25 19:01 olivialynn

A quick follow up—adding add_module_names = False to conf.py then running make html is not resulting in any change to the sidebar.

Looks like we may need to be a slightly more involved approach for hats—though the second answer in the stack overflow I posted above seems to be a promising strategy. (However, I'm not sure this would abstract very well if we tried to implement it in the PPT.)

As this is now in backlog, I'm holding off on further exploration.

olivialynn avatar Jan 27 '25 19:01 olivialynn

Those warnings show up now, even without any changes you're talking about (e.g. this docs build). I think it comes from some convenience aliasing of commonly-used classes. I'm getting really good at visually ignoring them when I build docs =D

If you're able to get the nicer table-of-contents, but you see these warnings, that sounds awesome!

delucchi-cmu avatar Jan 27 '25 19:01 delucchi-cmu

@dougbrn did this very explicitly for the nested-pandas package documentation.

https://nested-pandas.readthedocs.io/en/latest/

delucchi-cmu avatar Apr 25 '25 18:04 delucchi-cmu