ansys / ansys-sphinx-theme

PyData-based Sphinx theme from the PyAnsys community
https://sphinxdocs.ansys.com
MIT License
21 stars 5 forks source link

Ugly and Unhelpful Class Parameters in API docs #361

Closed da1910 closed 3 months ago

da1910 commented 3 months ago

image

The class parameters here serve limited purpose ( at least to me ) as they are untyped, are not a link to the relevant place in the docs, and are almost always truncated anyway. Additionally the square bracket syntax for optional arguments is not, I think, an official python thing?

Can we suppress these and just leave the class name here with a link to the docs page?

RobPasMue commented 3 months ago

That depends on how you configure autoapi to do it for you. If you use the latest templates @Revathyvenugopal162 and @jorgepiloto provided you won't get this issue. See https://geometry.docs.pyansys.com/version/dev/api/ansys/geometry/core/designer/body/index.html

RobPasMue commented 3 months ago

Bottom line: the only thing you need to do is configure it properly.

da1910 commented 3 months ago

Im sure that would be straightforward, but nowhere in the docs for this package do we provide any guidance on doing so, nor any explanation for which of the myriad options pyGeo uses are actually required to make it work.

RobPasMue commented 3 months ago

Minimum working example:

from pathlib import Path

from ansys_sphinx_theme import get_autoapi_templates_dir_relative_path

...

# Configuration for Sphinx autoapi
autoapi_type = "python"
autoapi_dirs = ["../../src/ansys"]
autoapi_root = "api"
autoapi_options = [
    "members",
    "undoc-members",
    "show-inheritance",
    "show-module-summary",
    "special-members",
]
autoapi_template_dir = get_autoapi_templates_dir_relative_path(Path(__file__))
autoapi_python_use_implicit_namespaces = True
autoapi_keep_files = True
autoapi_own_page_level = "class"

I believe the section is pretty clear in PyAnsys Geometry (even though we might have a "myriad" of options 😉 )

Nonetheless, I do agree we should documented it in our Sphinx theme... Probably here https://sphinxdocs.ansys.com/version/stable/user_guide/index.html

jorgepiloto commented 3 months ago

@da1910, may you please point us to the project where you are experiencing this? I want to check if there is a conflict with autodoc.

If not, the configuration provided by @RobPasMue should work like a charm.

RobPasMue commented 3 months ago

Throwing out final link with the documentation https://sphinxdocs.ansys.com/version/dev/user_guide/autoapi.html