Skip to main content

Find python identifiers

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygrep-0.3.2.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pygrep-0.3.2-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file pygrep-0.3.2.tar.gz.

File metadata

  • Download URL: pygrep-0.3.2.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pygrep-0.3.2.tar.gz
Algorithm Hash digest
SHA256 d276d4b83e5c8e8e066203e1d3d8880e64296c67b5a4e10e61a5d5f3a9e5ec5f
MD5 6414438e7afbda57bd1c160e70f4b884
BLAKE2b-256 3ac5357826824aa8417dcb65bb970a13f85d9409b8ab7e92d284b396750439dd

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygrep-0.3.2.tar.gz:

Publisher: release.yml on Pike/pygrep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygrep-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: pygrep-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pygrep-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e59f7d1b05bec590c66f58175ad408782a2b320aaa7147bbd89598b86c163504
MD5 69a0c166d803c39ca6b9f2e464090a7f
BLAKE2b-256 f09b0ac63103ae75c33200846132546739df7715d8cc9c96f2117035051fc79e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygrep-0.3.2-py3-none-any.whl:

Publisher: release.yml on Pike/pygrep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page