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(Class.function):lineno foo.bar.full.identifier
In file.py, there's a reference to foo.bar.full.identifier in the method
function in class Class.
Supported
At this point, pygrep resolves
from foo import bar
and
from foo import bar as baz
Example
Given this python file foo.py
from mymod.bar import stuff as a
class A:
def m(self):
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
will return
foo.py(A.m):4 mymod.bar.mod.method
Release files for pygrep 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pygrep-0.3.2.tar.gz | 9.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pygrep-0.3.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.4 kB
Release files / pygrep-0.3.2.tar.gz
| Download URL | pygrep-0.3.2.tar.gz |
|---|---|
| Size | 9.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d276d4b83e5c8e8e066203e1d3d8880e64296c67b5a4e10e61a5d5f3a9e5ec5f
|
|
BLAKE2b-256 checksum How to use checksums |
3ac5357826824aa8417dcb65bb970a13f85d9409b8ab7e92d284b396750439dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2025.
Transparency logRelease files / pygrep-0.3.2-py3-none-any.whl
| Download URL | pygrep-0.3.2-py3-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e59f7d1b05bec590c66f58175ad408782a2b320aaa7147bbd89598b86c163504
|
|
BLAKE2b-256 checksum How to use checksums |
f09b0ac63103ae75c33200846132546739df7715d8cc9c96f2117035051fc79e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2025.
Transparency log