FindImports extracts Python module dependencies by parsing source files. It can report names that are imported but not used, and it can generate module import graphs in ASCII or graphviz formats.
A distinguishing feature of findimports used to be that it could parse doctest code inside docstrings.
Note that not all cases are handled correctly, especially if you use 'import foo.bar.baz'.
Home page: https://github.com/mgedmin/findimports
Licence: GPL v2 or later (https://www.gnu.org/copyleft/gpl.html)