Jammy2211 / PyAutoGalaxy

PyAutoGalaxy: Open-Source Multiwavelength Galaxy Structure & Morphology
https://pyautogalaxy.readthedocs.io/
MIT License
28 stars 14 forks source link

API doc: Top level classes have no descriptions #62

Closed pllim closed 1 year ago

pllim commented 2 years ago

At the time of posting this issue, the right column in https://pyautogalaxy.readthedocs.io/en/latest/api/api.html is empty. I think this is because your class docstring is buried under __init__. Consider moving it to the class-level docstring for it to render properly.

https://github.com/astropy/astropy.github.com/pull/491#issuecomment-1215349065

Jammy2211 commented 1 year ago

I am working on improving the API docs a lot.

I am currently experimenting with the Gaussian class, which on here you can see how has a description:

https://pyautogalaxy.readthedocs.io/en/latest/api/api.html

I achieved this by having an additional class-level docstring above the __init__ method.

https://pyautogalaxy.readthedocs.io/en/latest/api/generated/autogalaxy.profiles.light.standard.Gaussian.html#autogalaxy.profiles.light.standard.Gaussian

My question is do you know why the methods (e.g. angle_to_profile_grid_from) are not being given URL links? I guess the Sphinx build is not doing to this level of detail, but I cannot find a way to fix this.

I want it to be that by clicking each method you are taken to another URL / webpage with the docstring fully built (including descriptions of the parameters).

At the very least, it shoudl take one to the source code.

Any ideas why I've vfailed to achieve this?

pllim commented 1 year ago

I think that is because that method is inherited from here:

https://github.com/Jammy2211/PyAutoGalaxy/blob/a25ad462775d635583c73b216df9cc281501d5b1/autogalaxy/profiles/light/abstract.py#L11

And the parent class does not have its API doc rendered. To have proper links, you have to render the parent. Otherwise, you can also tell Sphinx to not inherit docstring. Hope this helps!

Jammy2211 commented 1 year ago

Fixed, by changing some sphinx setup parameters and using a class template:

https://pyautogalaxy.readthedocs.io/en/latest/api/light.html

I will be working on the API docs in general over the next week or so, but this specific issue is fixed.