Question
Is there a way to generate sphinx documentation of a child class without installing the library containing its parent class on GitLab CI (or any comparable CI tool)?
Edit: I have 7 such classes and ca. 10 member functions per class on average to be documented. Thus, an automated solution is strongly preferred, as it cost too much time to hard-code the docstrings into the .rst
files.
If the problem cannot be solved by changing Sphinx settings alone, then I will only accept an answer that provides clear instructions to get the desired documentation generated and published.
Context
Specifically, I made a child class of tensorflow.keras.callbacks.Callback
and want to show its docstring on the documentation page.
By default, Sphinx has to import everything generate documentation. But
it doesn't seem right to install tensorflow
(and tens of other libraries
that sums up to several GBs) on the CI image just for this. I just want my docstring
to be shown and I don't care about their parent classes. This is the reason
why I turned on autodoc_mock_imports
in conf.py
(the Sphinx
configuration file). The docs were build without error, but the documentation
of that child class was missing.
In the MWE below, the customized class is keras_callback.py
. The sphinx directives is contained in keras_callback.rst
as follows.
.. automodule:: keras_callback
:members:
:inherited-members:
Minimum Working Example
There is an MWE and Sphinx-generated docs on my GitLab repo to reproduce the problem.
Desired documentation of the child class looks like this.
At the minimum, the documentation of my custom function should be shown. Member functions from the parent class can be turned off.