pik-copan / pycopancore

reference implementation of the copan:CORE World-Earth modelling framework
http://www.pik-potsdam.de/copan
Other
44 stars 10 forks source link

sphinx api documentation #159

Open AlbinaMuzafarova opened 2 years ago

AlbinaMuzafarova commented 2 years ago

Description

make the sphinx-generated api documentation look better, have a nice table of contents, show the package tree in a sensitive way, show the model component docstrings in the right place, etc.

Todo

AlbinaMuzafarova commented 2 years ago

@leander-j @mensch72 since I am experiencing troubles generating the documentation from master, is this what you see when you generate the documentation currently?

image

The Index is empty and Module Index for API reference not found

leander-j commented 2 years ago

index.html looks similar: sphinx_master_doc

The Index and Module Index are not empty though.

I noticed that on other branches (e.g. imitation_component/issue_152) at least the TOC structure is different: sphinx_doc

mensch72 commented 2 years ago

in my case both index and module index are populated. otherwise it looks the same. i'll send you a zip of the html folder.

Am 15. Dezember 2021 15:10:15 MEZ schrieb AlbinaMuzafarova @.>: @. @mensch72 since I am experiencing troubles generating the

documentation from master, is this what you see when you generate the documentation currently?

image

The Index is empty and Module Index for API reference not found

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/pik-copan/pycopancore/issues/159#issuecomment-994826662

-- Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.

AlbinaMuzafarova commented 2 years ago

thank you! I'll compare the received html with mine for deviations and would be also curious to check the config file for the branch mentioned by @leander-j

leander-j commented 2 years ago

The screenshots were from the issue_152 branch, the html generated there is html.zip

AlbinaMuzafarova commented 2 years ago

@leander-j i've changed the depth of the table for issue_152 branch. It should be 1 now, same as for master (see #167).

@mensch72 @leander-j I think i'm generating the index and module index properly now, although there are still many errors in the terminal. Could you let me know if this is what you see (I've changed the theme, so please don't consider the difference in colors):

image

image

leander-j commented 2 years ago

Yes, it does look like that, just with way more modules/items. In fact so many that the Index page hides them sphinx_index

AlbinaMuzafarova commented 2 years ago

I've pushed first changes to doc/api branch. If someone could try generating the documentation locally on that branch, that'd be great.

Expected output: ToC with API reference which is populated according to the description

I've adapted the theme to Book theme because it handles presentation and navigation between pages/headings smoother than alabaster. To install, use pip install sphinx-book-theme

I suspect that due to me running Windows, sphinx is not working as smoothly as for the rest of the team. To double-check my assumptions, i'd hearing whether these parts of the API reference>Models page are filled:

image

mensch72 commented 2 years ago

Hi Albina,

overall this looks much nicer than before! Thank you!!

I do have a number of fast observations:

AlbinaMuzafarova commented 2 years ago

thank you Jobst for your first feedback! I'll gradually walk my way commenting on issues I have some clues on first:

For model components, it is still not clear to me, where the natural place for introductory text that will then shows up at the top of the page would be.

Currently, sphinx looks at _init_.py file and present the docstring on the top of the model component/any other page. So I would suggest we keep using that location for general descriptions.

AlbinaMuzafarova commented 2 years ago

It is somewhat unclear to me, where the section titles / headlines used in the APIdoc are coming from

The headings were generated by sphinx first as paths and seemed unreadable to me, e.g. pycopancore/pycopancore.data_model.dimensions_and_units. So I've modified them manually for better user experience. I can adjust the subtitles to reflect the exact naming of the package/class in the next commit.

AlbinaMuzafarova commented 2 years ago

We should find a way to distinguish "public" methods meant to be used by model users (like "run" in "Runner") from "private" methods only used internally in the framework

I think sphinx has a flag to hide private methods. Would that be a desired solution here or were you thinking of finding just a visual distinction?

mensch72 commented 2 years ago

that would be perfect

Am 31. Januar 2022 17:58:45 MEZ schrieb AlbinaMuzafarova @.***>:

We should find a way to distinguish "public" methods meant to be used by model users (like "run" in "Runner") from "private" methods only used internally in the framework

I think sphinx has a flag to hide private methods. Would that be a desired solution here or were you thinking of finding just a visual distinction?

-- Reply to this email directly or view it on GitHub: https://github.com/pik-copan/pycopancore/issues/159#issuecomment-1025996120 You are receiving this because you were mentioned.

Message ID: @.***>

-- Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.