Open j-emberton opened 3 months ago
Possible solution:
Create a python file with the following contents and add to sphinx project:
`# sphinx_initvar_filter.py from sphinx.ext.autodoc import ClassDocumenter, ModuleLevelDocumenter from sphinx.util.inspect import getdoc from sphinx.util import logging
logger = logging.getLogger(name)
class InitVarFilterDocumenter(ClassDocumenter): def add_directive_header(self, sig): self.options.noindex = True super().add_directive_header(sig) self.options.noindex = False
def filter_members(self, members, want_all):
filtered_members = []
for name, obj in members:
if not name.startswith('__') and 'InitVar' not in str(obj):
filtered_members.append((name, obj))
else:
logger.info(f'Filtering out: {name} ({obj})')
return filtered_members
def setup(app): app.add_autodocumenter(InitVarFilterDocumenter)`
Then modify conf.py to include the custom operation:
`# conf.py extensions = [ 'sphinx.ext.autodoc', 'sphinx_autodoc_typehints', 'sphinx.ext.napoleon', 'sphinx_initvar_filter' # Add your custom extension here ]
autodoc_typehints = "description" autodoc_typehints_format = "short"`
Hasn't been tried and tested yet
also more in pressure submodule:
I suspect this might be linked in to the state of our nitpick_ignore
settings in the sphinx
conf.py
, which is a total dumpster fire of things that sphinx
moans about.
Nice find.
is there a simple way to build the docs locally to test the changes?
Should be able just to do cd docs; poetry run make html
. All the requirements for docs are included in the poetry
requirements. It doesn't seem to work though 😢
Describe the bug Incorrect display of function/class argument types in documentation.
Expected behavior I would expect to just see a display of arguments with a simple type e.g. my function(arg1: NDArray)
Screenshots
Desktop (please complete the following information):
Additional context Add any other context about the problem here.