Find python identifiers
Ever tried to refactor some python code and trying to find out where you're code is used?
find . -name \*.py | xargs grep foo.bar
is kinda nice, but it'll find imports, comments, and whatnot.
Meet pygrep, it allows you to find all references to your code,
pygrep foo.bar some/dir other/stuff.py
That will show you some output like
file.py, there's a reference to
foo.bar.full.identifier in the method
function in class
At this point, pygrep resolves
from foo import bar
from foo import bar as baz
Given this python file
from mymod.bar import stuff as a
b = a.mod.method()
all the following commands
pygrep mymod foo.py
pygrep mymod.bar foo.py
pygrep mymod.bar.mod foo.py
pygrep mymod.bar.mod.method foo.py
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.