From 74928f6f7e020c7fdc1839cc5c4e361f21510229 Mon Sep 17 00:00:00 2001 From: Min RK Date: Fri, 16 Dec 2022 16:39:41 +0100 Subject: [PATCH] define trait.__doc__ = trait.help (#816) 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