You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem: When using NewType or the Python 3.12 type alias, docstrings don't work. Sphinx extract the description from the comment after the alias definition, but for generating parameters for widgets we would like to use __doc__. Currently we have, e.g.,
BackgroundRun=NewType('BackgroundRun', int)
"""Background run: the run with only the solvent which the sample is placed in."""
I now tried the following:
defalias(name: str, tp: type, doc: str) ->type:
ntp=NewType(name, tp)
ntp.__doc__=docreturnntpBackgroundRun=alias(
'BackgroundRun',
int,
"Background run: the run with only the solvent which the sample is placed in.",
)
Unless some Sphinx cache tricked be, this seems to work with both Sphinx autodoc and defined a usable __doc__.
The text was updated successfully, but these errors were encountered:
Problem: When using
NewType
or the Python 3.12type
alias, docstrings don't work. Sphinx extract the description from the comment after the alias definition, but for generating parameters for widgets we would like to use__doc__
. Currently we have, e.g.,I now tried the following:
Unless some Sphinx cache tricked be, this seems to work with both Sphinx autodoc and defined a usable
__doc__
.The text was updated successfully, but these errors were encountered: