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

Autogenerate API documentation #2505

Open
ReimarBauer opened this issue Sep 3, 2024 · 5 comments
Open

Autogenerate API documentation #2505

ReimarBauer opened this issue Sep 3, 2024 · 5 comments
Labels
enhancement New feature or request
Milestone

Comments

@ReimarBauer
Copy link
Member

ReimarBauer commented Sep 3, 2024

We should add into the CI workflow an API documentation workflow and additional publish the released and develop API

with calling pdoc3 mslib --html I found the problems

There is also maybe another one, which I have not tracked down, on the call a

ImportWarning: Working outside of application context. shows up

pdoc3 --skip-errors mslib --html can be used to look on the content

@ReimarBauer ReimarBauer added the enhancement New feature or request label Sep 3, 2024
@ReimarBauer ReimarBauer added this to the 10.0.0 milestone Sep 3, 2024
@matrss
Copy link
Collaborator

matrss commented Sep 3, 2024

Some questions:

Who is the target audience for this API documentation?

What even is the API of mslib? How is it used in other projects?

Do we have a clearly defined API, or is it a "everything goes" situation as of now? (i.e. is everything not marked as private deliberately public, or not?)

Why pull in pdoc3, when sphinx should already be capable of doing this?

@ReimarBauer
Copy link
Member Author

ReimarBauer commented Sep 3, 2024

  1. next gsoc students and those who want to contribute.
  2. und 3. current situation. dependent on the tool we use, we can highlight some parts.

viertens. I do not insist on pydoc3, but I want a similiar functionality that on each build we see if some of the modules are broken, where we don't have tests

@matrss
Copy link
Collaborator

matrss commented Sep 3, 2024

I do not insist on pydoc3

OK, now you have to clarify. pdoc3 and pydoc3 are two different things. pydoc3 is part of python, pdoc3 is a third-party project.

@ReimarBauer
Copy link
Member Author

ReimarBauer commented Sep 3, 2024

I do not insist on which we use. Sometimes typos happen...

@matrss
Copy link
Collaborator

matrss commented Sep 4, 2024

This is starting point using sphinx' builtin tools to generate such an API reference:

diff --git a/docs/api.rst b/docs/api.rst
new file mode 100644
index 00000000..c425816e
--- /dev/null
+++ b/docs/api.rst
@@ -0,0 +1,8 @@
+API
+===
+
+.. autosummary::
+   :toctree: generated
+   :recursive:
+
+   mslib
diff --git a/docs/conf.py b/docs/conf.py
index 80e5e185..9cc9aae9 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -117,7 +117,14 @@ on_rtd = os.environ.get('READTHEDOCS') == 'True'
 # Add any Sphinx extension module names here, as strings. They can be
 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
 # ones.
-extensions = ['sphinx_rtd_theme', 'sphinxcontrib.video']
+extensions = [
+    'sphinx.ext.autodoc',
+    'sphinx.ext.autosummary',
+    'sphinx_rtd_theme',
+    'sphinxcontrib.video',
+]
+
+autosummary_generate = True

 # raise a warning when a secondary source is missing.
 video_enforce_extra_source = True
diff --git a/docs/index.rst b/docs/index.rst
index 02af2912..ddd49e98 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -40,6 +40,7 @@ Topics
    authors
    tutorial
    gallery/index
+   api


 Indices and tables

For some reason it doesn't generate pages for classes and class members though, as reported here: sphinx-doc/sphinx#7912. Some template changes would be required to achieve that.

@matrss matrss changed the title autogenerate API documentation by pdoc3 Autogenerate API documentation Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants