From a9e4fbb7d49ed8a93af57ed1a9184bfbdbaff6f3 Mon Sep 17 00:00:00 2001 From: Martin Walters <104021577+waltersma@users.noreply.github.com> Date: Mon, 9 Dec 2024 09:30:17 +0000 Subject: [PATCH] Doc/show mini gallery (#947) Co-authored-by: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> --- .gitignore | 4 ++-- doc/changelog.d/947.documentation.md | 1 + doc/make.bat | 4 ++-- doc/source/_templates/autosummary/class.rst | 5 +++++ doc/source/_templates/autosummary/function.rst | 10 ++++++++++ doc/source/_templates/autosummary/method.rst | 10 ++++++++++ doc/source/_templates/autosummary/module.rst | 5 +++++ doc/source/conf.py | 6 ++++-- doc/source/user_guide/launch_prime.rst | 2 +- 9 files changed, 40 insertions(+), 7 deletions(-) create mode 100644 doc/changelog.d/947.documentation.md create mode 100644 doc/source/_templates/autosummary/function.rst create mode 100644 doc/source/_templates/autosummary/method.rst diff --git a/.gitignore b/.gitignore index ba67cdbfca..f7d7ebe318 100644 --- a/.gitignore +++ b/.gitignore @@ -33,7 +33,7 @@ dist/ # autogenerated docs _autosummary _build/ - +_gallery_backreferences # Testing .coverage @@ -49,4 +49,4 @@ test-output.xml .vscode # logger -.log \ No newline at end of file +.log diff --git a/doc/changelog.d/947.documentation.md b/doc/changelog.d/947.documentation.md new file mode 100644 index 0000000000..6e4e0fad3a --- /dev/null +++ b/doc/changelog.d/947.documentation.md @@ -0,0 +1 @@ +Doc/show mini gallery \ No newline at end of file diff --git a/doc/make.bat b/doc/make.bat index 24f344a4e8..d8ff01f7a6 100644 --- a/doc/make.bat +++ b/doc/make.bat @@ -8,7 +8,7 @@ if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) if "%SPHINXOPTS%" == "" ( - set SPHINXOPTS=-j auto + set SPHINXOPTS=-n -j auto ) set SOURCEDIR=source @@ -36,7 +36,7 @@ goto end :clean rmdir /s /q %BUILDDIR% > /NUL 2>&1 -for /d /r %SOURCEDIR% %%d in (_autosummary) do @if exist "%%d" rmdir /s /q "%%d" +for /d /r %SOURCEDIR% %%d in (_autosummary,_gallery_backreferences) do @if exist "%%d" rmdir /s /q "%%d" rmdir /s /q %SOURCEDIR%\examples\gallery_examples rmdir /s /q %SOURCEDIR%\images\auto-generated goto end diff --git a/doc/source/_templates/autosummary/class.rst b/doc/source/_templates/autosummary/class.rst index 1f658437c3..6fb54a6584 100644 --- a/doc/source/_templates/autosummary/class.rst +++ b/doc/source/_templates/autosummary/class.rst @@ -30,4 +30,9 @@ {% endif %} {% endblock %} +.. minigallery:: + :add-heading: Examples using {{ objname }} + + {{ fullname }} + .. vale on diff --git a/doc/source/_templates/autosummary/function.rst b/doc/source/_templates/autosummary/function.rst new file mode 100644 index 0000000000..65bb9b4f7d --- /dev/null +++ b/doc/source/_templates/autosummary/function.rst @@ -0,0 +1,10 @@ +{{ name | escape | underline}} + +.. currentmodule:: {{ module }} + +.. autofunction:: {{ fullname }} + +.. minigallery:: + :add-heading: Examples using {{ objname }} + + {{ fullname }} diff --git a/doc/source/_templates/autosummary/method.rst b/doc/source/_templates/autosummary/method.rst new file mode 100644 index 0000000000..ddc14fdff9 --- /dev/null +++ b/doc/source/_templates/autosummary/method.rst @@ -0,0 +1,10 @@ +{{ name | escape | underline}} + +.. currentmodule:: {{ module }} + +.. automethod:: {{ fullname }} + +.. minigallery:: + :add-heading: Examples using {{ objname }} + + {{ fullname }} diff --git a/doc/source/_templates/autosummary/module.rst b/doc/source/_templates/autosummary/module.rst index ea1abea5d7..2aa4d47cdf 100644 --- a/doc/source/_templates/autosummary/module.rst +++ b/doc/source/_templates/autosummary/module.rst @@ -64,4 +64,9 @@ {% endif %} {% endblock %} +.. minigallery:: + :add-heading: Examples using {{ objname }} + + {{ module }}.{{ objname }} + .. vale on diff --git a/doc/source/conf.py b/doc/source/conf.py index c0f876e9c9..ba5436dae6 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -71,6 +71,7 @@ 'sphinx.ext.autosummary', "numpydoc", "sphinx.ext.intersphinx", + "sphinx.ext.napoleon", "sphinx_copybutton", "sphinx_gallery.gen_gallery", "jupyter_sphinx", @@ -168,9 +169,10 @@ # Sort gallery example by file name instead of number of lines (default) "within_subsection_order": FileNameSortKey, # directory where function granular galleries are stored - "backreferences_dir": None, + "backreferences_dir": "api/_gallery_backreferences", # Modules for which function level galleries are created. In - "doc_module": "ansys-meshing-prime", + "doc_module": ("ansys.meshing.prime"), + "exclude_implicit_doc": {"ansys\\.meshing\\.prime\\._.*"}, # ignore private submodules "image_scrapers": (DynamicScraper(), "matplotlib"), "ignore_pattern": "flycheck*", "thumbnail_size": (350, 350), diff --git a/doc/source/user_guide/launch_prime.rst b/doc/source/user_guide/launch_prime.rst index 3f423d05a3..a1d785855a 100644 --- a/doc/source/user_guide/launch_prime.rst +++ b/doc/source/user_guide/launch_prime.rst @@ -67,7 +67,7 @@ The :func:`Client.exit() ` method ends the conn If the :class:`Client ` class launched the server, then this terminates the server process. .. note:: -If you use Intel(R) MPI Library, Version 2021.8, you may encounter the following error while exiting the client: + If you use Intel(R) MPI Library, Version 2021.8, you may encounter the following error while exiting the client: .. figure:: ../images/client_exit_error.png :width: 200pt