In my code I have
X_DEFAULT = ['a', 'long', 'list', 'of', 'values', 'that', 'is', 'really', 'ugly', 'to', 'see', 'over', 'and', 'over', 'again', 'every', 'time', 'it', 'is', 'referred', 'to', 'in', 'the', 'documentation']
and later
def some_function(..., x=X_DEFAULT, ...):
so that in my Sphinx documentation, using (e.g., using .. autofunction::
, etc.) I get the entire long and unwieldy value of X_DEFAULT
expanded in the signature for some_function
:
some_function(..., x=['a', 'long', 'list', 'of', 'values', 'that', 'is', 'really', 'ugly', 'to', 'see', 'over', 'and', 'over', 'again', 'every', 'time', 'it', 'is', 'referred', 'to', 'in', 'the', 'documentation'], ...)
Is there a way to suppress this substitution in the generated documentation, ideally with a link back to the definition of X_DEFAULT
:
some_function(..., x=X_DEFAULT, ...)
I'm aware that I can manually override the signature for each function and method that I explicitly list as arguments to Sphinx documentation directives, but that's not my goal here. I'm also aware that I could use autodoc_docstring_signature
and the first line of the docstring, but that would produce bad docstrings, really intended for cases where introspection fails (like C). I suspect that there's something I could do in autodoc-process-signature
that might be adequate (but not perfect), though I'm unsure how to proceed.