How to make Jupyter notebook python help function output colorful?

Viewed 318

I am new to Jupyter notebook and trying to see the some help about the functions. For example, when I print the help of statsmodels.OLS I got the following plain black and white help.

Are there any python modules that colorize/beautify the help outputs?

For example:

  • hightlight parameters names
  • highlight the code example in python syntax hightlight
  • and so on.

If there are not some modules, what would be the starting point, to colorize the parameters and the python codes?

The example output of help is given below:

enter image description here

1 Answers

You can try to beautify the help using rich library (in jupyter, you can install it, using the command !pip install rich). In particular, you could study the inspect method.

For example, with the following code:

from rich import inspect
inspect(sm.OLS, help=True)

I get this output: rich inspect output

Related