whoimports: who still imports this module?
The scary part of a rename is not the rename — it is the importers you forgot. Grepping for the module name hits strings, comments, and false friends. Importing the package to inspect it can have side effects.
whoimports
walks the tree with the AST and prints every
import / from … import that refers to your target.
Install
pip install git+https://github.com/SybilGambleyyu/whoimports.git
Usage
whoimports src/auth/session.py
whoimports auth.session -f json
whoimports pkg.util -f md
File paths and dotted module names both work. src/ layouts
are understood. Output formats: text, markdown, JSON.
With the rest of the toolkit
whoimports src/legacy/foo.py
gitchurn --prefix src/legacy -n 10
whoimports pkg.session -f md | redactx
Source: github.com/SybilGambleyyu/whoimports. MIT.