From d14b9afa7d0b5140d786bb04aba1abb9023a1536 Mon Sep 17 00:00:00 2001 From: Min RK Date: Fri, 16 Dec 2022 14:32:14 +0100 Subject: [PATCH] define trait.__doc__ = trait.help improves inspection via tools like sphinx autodoc --- traitlets/traitlets.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/traitlets/traitlets.py b/traitlets/traitlets.py index 6f03c257..0cefe043 100644 --- a/traitlets/traitlets.py +++ b/traitlets/traitlets.py @@ -558,6 +558,9 @@ def __init__( if read_only is not None: self.read_only = read_only self.help = help if help is not None else "" + if self.help: + # define __doc__ so that inspectors like autodoc find traits + self.__doc__ = self.help if len(kwargs) > 0: stacklevel = 1