From c9ee7d94b92f5b18890010cb99d395819fb514c6 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Thu, 5 Oct 2023 09:51:28 +0200 Subject: [PATCH 1/4] docs: initial commit of autoapi migration --- doc/source/conf.py | 52 +++++++++++++++++++++++--------- doc/source/index.rst | 72 +++++++++++++++++++++++++++----------------- pyproject.toml | 1 + 3 files changed, 84 insertions(+), 41 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index dfa5cf51105..7fdb92b2b33 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -15,7 +15,8 @@ get_version_match, pyansys_logo_black, watermark, ansys_logo_white, - ansys_logo_white_cropped, latex) + ansys_logo_white_cropped, latex, + get_autoapi_templates_dir_relative_path) from importlib import import_module from pprint import pformat from docutils.parsers.rst import Directive @@ -126,6 +127,7 @@ def setup(app): "sphinx.ext.inheritance_diagram", "numpydoc", "ansys_sphinx_theme.extension.linkcode", + "autoapi.extension", ] # Intersphinx mapping @@ -291,18 +293,6 @@ def setup(app): "run_examples": config["run_examples"], }, } -# def prepare_jinja_env(jinja_env) -> None: -# """ -# Customize the jinja env. -# -# Notes -# ----- -# See https://jinja.palletsprojects.com/en/3.0.x/api/#jinja2.Environment -# """ -# jinja_env.globals["project_name"] = project -# -# -# autoapi_prepare_jinja_env = prepare_jinja_env # -- Options for HTML output ------------------------------------------------- html_short_title = html_title = "PyAEDT" @@ -379,4 +369,38 @@ def setup(app): author, "manual", ), -] \ No newline at end of file +] + +def prepare_jinja_env(jinja_env) -> None: + """ + Customize the jinja env. + + Notes + ----- + See https://jinja.palletsprojects.com/en/3.0.x/api/#jinja2.Environment + """ + jinja_env.globals["project_name"] = project + + +autoapi_prepare_jinja_env = prepare_jinja_env + + +autoapi_type = "python" +autoapi_dirs = ["../../pyaedt/"] +autoapi_options = [ + "members", + "undoc-members", + "show-inheritance", + "show-module-summary", + "special-members", +] +autoapi_template_dir = get_autoapi_templates_dir_relative_path(pathlib.Path(__file__)) +suppress_warnings = ["autoapi.python_import_resolution"] +exclude_patterns = [ + "autoapi", + "**/ExampleData*", + "**/LaunchWorkbench*", +] +autoapi_root = "api" +autoapi_python_use_implicit_namespaces = True +autoapi_render_in_single_page = ["class", "enum", "exception"] \ No newline at end of file diff --git a/doc/source/index.rst b/doc/source/index.rst index 9fabcdbdeb6..7038a7a4d47 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -43,45 +43,63 @@ Ansys Electronics Desktop (AEDT) to make scripting simpler. User guide + .. grid-item-card:: + :img-top: _static/assets/index_api.png + API reference + ^^^^^^^^^^^^^ -.. grid:: 2 + Understand PyAEDT EDB API endpoints, their capabilities, + and how to interact with them programmatically. - .. grid-item-card:: - :img-top: _static/assets/index_api.png + +++ + .. button-link:: api/index + :color: secondary + :expand: + :outline: + :click-parent: - AEDT API reference - ^^^^^^^^^^^^^^^^^^ + EDB API reference - Understand PyAEDT API endpoints, their capabilities, - and how to interact with them programmatically. - +++ - .. button-link:: API/index.html - :color: secondary - :expand: - :outline: - :click-parent: +.. + .. grid:: 2 - AEDT API reference + .. grid-item-card:: + :img-top: _static/assets/index_api.png - .. grid-item-card:: - :img-top: _static/assets/index_api.png + AEDT API reference + ^^^^^^^^^^^^^^^^^^ - EDB API reference - ^^^^^^^^^^^^^^^^^ + Understand PyAEDT API endpoints, their capabilities, + and how to interact with them programmatically. - Understand PyAEDT EDB API endpoints, their capabilities, - and how to interact with them programmatically. + +++ + .. button-link:: API/index.html + :color: secondary + :expand: + :outline: + :click-parent: - +++ - .. button-link:: EDBAPI/index.html - :color: secondary - :expand: - :outline: - :click-parent: + AEDT API reference + + .. grid-item-card:: + :img-top: _static/assets/index_api.png + + EDB API reference + ^^^^^^^^^^^^^^^^^ + + Understand PyAEDT EDB API endpoints, their capabilities, + and how to interact with them programmatically. + + +++ + .. button-link:: EDBAPI/index.html + :color: secondary + :expand: + :outline: + :click-parent: - EDB API reference + EDB API reference .. jinja:: main_toctree diff --git a/pyproject.toml b/pyproject.toml index 4bf68b6232c..73d407093dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -86,6 +86,7 @@ doc = [ "scikit-learn==1.3.1; python_version > '3.7'", "Sphinx==7.1.2; python_version <= '3.9'", "Sphinx==7.2.6; python_version >= '3.9'", + "sphinx-autoapi==3.0.0", "sphinx-autobuild==2021.3.14", "sphinx-autodoc-typehints==1.24.0", "sphinx-copybutton==0.5.2", From a34684e0e32af23af935a56afdbb69817d6fd6f1 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Thu, 5 Oct 2023 10:10:05 +0200 Subject: [PATCH 2/4] fix: add gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 32172648189..ddc6e7fefde 100644 --- a/.gitignore +++ b/.gitignore @@ -396,3 +396,4 @@ model.index\+ # local environment settings used by e.g. Visual Studio Code /.env /doc/source/local_config.json +doc/source/API/ From 7034881fb0419bef24162e86b604110a17e3f049 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Thu, 5 Oct 2023 11:05:07 +0200 Subject: [PATCH 3/4] fix: the pah --- doc/source/conf.py | 2 +- doc/source/index.rst | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 7fdb92b2b33..d116e403bce 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -132,7 +132,7 @@ def setup(app): # Intersphinx mapping intersphinx_mapping = { - "python": ("https://docs.python.org/3", None), + "python": ("https://docs.python.org/3.10", None), "scipy": ("https://docs.scipy.org/doc/scipy/reference", None), "numpy": ("https://numpy.org/devdocs", None), "matplotlib": ("https://matplotlib.org/stable", None), diff --git a/doc/source/index.rst b/doc/source/index.rst index 7038a7a4d47..97074ce973b 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -53,7 +53,7 @@ Ansys Electronics Desktop (AEDT) to make scripting simpler. and how to interact with them programmatically. +++ - .. button-link:: api/index + .. button-link:: API/pyaedt/index.html :color: secondary :expand: :outline: @@ -156,7 +156,7 @@ Indices and tables Getting_started/index User_guide/index - API/index + API/pyaedt/index.html EDBAPI/index {% if run_examples %} examples/index From e9b22f7d956cd1ea3beafec620e6856a4cc36456 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Thu, 5 Oct 2023 11:05:23 +0200 Subject: [PATCH 4/4] fix: the pah --- doc/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index d116e403bce..b8e89fa6ebb 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -401,6 +401,6 @@ def prepare_jinja_env(jinja_env) -> None: "**/ExampleData*", "**/LaunchWorkbench*", ] -autoapi_root = "api" +autoapi_root = "API" autoapi_python_use_implicit_namespaces = True autoapi_render_in_single_page = ["class", "enum", "exception"] \ No newline at end of file