Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements for Python API documentation #9523

Open
1 of 6 tasks
jbms opened this issue Aug 2, 2021 · 9 comments
Open
1 of 6 tasks

Improvements for Python API documentation #9523

jbms opened this issue Aug 2, 2021 · 9 comments

Comments

@jbms
Copy link
Contributor

jbms commented Aug 2, 2021

I have recently implemented an extensive set of additional functionality/customizations to Sphinx for building the documentation for tensorstore:

https://google.github.io/tensorstore/python/api/index.html

I think that many of the changes that I made would also be useful to many other users, and would perhaps be good fits to incorporate into Sphinx itself, but I wanted to find out if there was interest in that.

Because a large amount of monkey patching was required, it would be easier to either add the functionality directly to Sphinx, or at least add necessary hooks such that monkey patching would not be required.

The theme itself is derived from mkdocs-material (see bashtage/sphinx-material#96 for details on that), but some other improvements were inspired by pdoc3.

The specific changes include:

@jbms jbms added the type:enhancement enhance or introduce a new feature label Aug 2, 2021
@mhostetter
Copy link

I WOULD PAY FOR THIS FEATURE!

Sorry for the scream-text. This is exactly what I've been trying to make Sphinx / autodoc / autosummary do for years. Every attempt has been manual, hacky, and incomplete. I was about to abandon hope, switch to mkdocs, and attempt to write an extension that does exactly this (only because it seems the entry barrier for devs is easier in mkdocs). But I stumbled upon @jbms's PR in sphinx-material and saw his work there.

I genuinely hope this can be generalized and upstreamed into Sphinx, even if some functionality stays in the theme (sphinx-material or a fork of it). 🙏

@jbms
Copy link
Contributor Author

jbms commented Sep 16, 2021

Great to hear of your interest, @mhostetter. Would you be interested in helping work on this to make that happen? I would also love to see the functionality get generalized and integrated into Sphinx, and for the new autosummary/autodoc and the rest of the theme to be more generalized so that it can be used for other projects, but I unfortunately don't have a ton of time I can devote to that. If it is going to happen, I would need some help.

@mhostetter
Copy link

mhostetter commented Sep 16, 2021

@jbms I know little of the Sphinx internals, however I'm happy to help wherever I can. Could you spell out in a paragraph some tasks that would need completed / you need help with. Maybe from that paragraph I can determine if I can technically help you. But yes, I'd love to see this happen and help however I can.

@jbms
Copy link
Contributor Author

jbms commented Sep 16, 2021

Thanks. I will work on writing up a description of the tasks that are needed --- there are quite a few. I also knew nothing of Sphinx internals (in fact I had never used Sphinx at all) before I started using it for the tensorstore documentation.

@tk0miya
Copy link
Member

tk0miya commented Sep 16, 2021

Cool! It would be nice if we can merge the features to Sphinx core. I don't still understand all your works. But it must be worthy. I'll take time to check each feature in detail.

@jbms
Copy link
Contributor Author

jbms commented Sep 16, 2021

One relatively simple thing:
https://github.com/google/tensorstore/blob/master/docs/tensorstore_sphinx_material/sphinx_material/inlinesyntaxhighlight.py

As noted in the comments there, that is heavily based on this existing pull request:
#6916

That would be great to resolve in Sphinx, but there also needs to be support for latex.

Since the pygments pull request (pygments/pygments#1343) by @tk0miya has stalled perhaps we can just work around it in Sphinx by stripping the \begin{..} \end{..} from the pygments output.

@jbms
Copy link
Contributor Author

jbms commented Sep 16, 2021

@mhostetter I will try to file some separate issues linked to this one for individual action items. See #9641 for example.

@PaulSt
Copy link

PaulSt commented Mar 3, 2022

Concerning the

* Support for pybind11 overloaded functions.  

I am currently seeing my overloaded function displayed nicely, however the docstring formatting is rather off, the parameters are not listed as bullet points anymore. This was also mentioned here. Am I doing something wrong? Is that a bug?

@AA-Turner
Copy link
Member

#11072 makes the display of Union, Optional nicer in the Python domain and autodoc.

A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants