SybilGambleyyu

Before you rename, move, or delete a Python module: who still imports this?

Grepping hits strings and comments. Importing the package can run side effects. whoimports walks the tree with the AST and prints every matching import / from … import line.

Install

pip install git+https://github.com/SybilGambleyyu/whoimports.git

Enter fullscreen mode Exit fullscreen mode

Usage

whoimports src/auth/session.py
whoimports auth.session -f json
whoimports pkg.util -f md

Enter fullscreen mode Exit fullscreen mode

Notes

  • Zero dependencies, Python 3.10+
  • File paths and dotted module names
  • Understands src/ layouts
  • text / markdown / JSON output

Pairs with gitchurn and redactx for safe refactor context.

Source: github.com/SybilGambleyyu/whoimports · MIT