DOCS: Introduce sphinx-autoapi for API documentation
#1632
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces the use of
sphix-autoapito build the API documentation.This allows for automatic generation of API references leveraging the docstring content from the
.pyfiles and removal of many.rstfiles that had to be manually generated insidedoc/source/grpc_apianddoc/source/dotnet_apiwith the sole purpose of exposing thesphinx-autosummarydocumentation for each module and which (for the vast majority of them) did not contain any custom / informational content. On top of that, some modules and subpackages were missed in the GRPC and dotnet documentations to date, probably due to the fact that corresponding.rstfiles were not manually added when expanding the APIs: This is a concern thatsphinx-autoapieliminates by automatically going through the entire packages and modules when producing the API documentation.The following decisions were made to keep the changes as little disruptive as possible compared to the current structure of the API documentation:
sphinx-autoapiruns on the entiresrc/pyedbfolder and generates files indoc/source/autoapi. However, only the parts related to the GRPC and the dotnet API are then exposed inside the documentation (through links indoc/source/grpc_api/index.rstanddoc/source/dotnet_api/index.rstrespectively) to reflect the fact that only those parts of the project were documented in such detail up to now. The documentation of these two sections of the API remains separated as was the case previously (the entire content generated bysphinx-autoapiindoc/source/autoapiis not exposed in the documentation, contrary to what is done for instance inpyansys-geometry). It is suggested that the benefits of a reorganisation of the API documentation with a view to making better use of the content generated bysphinx-autoapiis left for a future issue / PR.While the vast majority of the
.rstfiles fromdoc/source/grpc_apianddoc/source/dotnet_apiwere removed, a few are preserved as they provide valuable content in the form of text, images or code examples. This is the case for the two files serving as introductions to the documentation of the GRPC and dotnet APIs (respectivelydoc/source/grpc_api/index.rstanddoc/source/dotnet_api/index.rst) and fordoc/source/dotnet_api/dotnet/SiWave.rst, which is in fact redirecting to the documentation of thepyedb.siwave.Siwaveclass from within the dotnet API documentation. These 3.rstfiles were found to be the only ones both accessible in the documentation and providing original content that would have been lost with a mere redirection to outputs ofsphinx-autoapi. It is suggested to leave the discussion whether including such information inside the API documentation is relevant or not for another PR, where this content could for instance be transferred to the user guide or even inside some docstrings.On top of this, the version of the
ansys-sphinx-themeused for the documentation was updated in this PR.A few typos in
.rstfiles are corrected too, even if these are not necessarily related to the topic of this PR.Finally, a follow-up PR should aim at improving the home page of the documentation
doc/source/index.rstto create tiles for the main sections (see pyansys-geometry documentation) and remove the many links to the Home page introduced by the use oftoctreeconstructs in the latest versions of theansys-sphinx-theme.Close #1606.