pyinspect
find functions when you can't remember their name
pyinspect: for when you can't remember the function name
pyinspect is a Python package for lazy programmers. It searches for functions you forgot, prints their source, builds helpful tracebacks, and can even look up Stack Overflow answers for you.
Search instead of remembering
The README sells pyinspect with a running gag about the lazy programmer. Forgot a function name? Search for it. The search walks the sub modules of whatever module you give it, so looking for plot across matplotlib covers the whole library, and find works for class methods too, including inherited ones unless you switch them off. Pass no search term at all and it prints every function and method it can find.
Printing source without opening files
Once you find the function, pyinspect can print its source code straight to the terminal, saving the trip through the file. The README frames it as the lazy route to reading how a thing works, and the same trick applies to variables, which print with their content, their definition location, and some of their attributes and methods.
Tracebacks that show you the right variables
Errors get a custom traceback. Install it at the top of a script and a failing run produces a summary of what is going on, with the variables involved in the error line highlighted, so the bug is visible instead of buried. Flags control the detail: show only the error line's variables, show every local including imports, hide locals entirely, or decide how many frames a nested traceback keeps.
Automating the google
For the truly stuck, pyinspect automates the googling. A prompt after a traceback asks whether to look for solutions online, or the why command handles the last recorded error. Either way you get a description of the error, links to the top Google results, and a rendered Stack Overflow question and answer. A separate ask feature answers basic questions from inside Python, and extras like panels and Report print tidy messages to the terminal. The README closes by crediting the rich library, which pyinspect mostly wraps, and inviting pull requests.
Community notes