Searching for Code in Python PackagesΒΆ
Something I find myself wanting to do quite often is to search for a particular object within a Python package.
A nice trick is to use a tool like fd
to gather all the relevant filepaths and pass them to rg
for us
$ fd -e py . "${VIRTUAL_ENV}/lib/python3.10/site-packages/<package>" -X rg <pattern>
For jupyter notebooks see Search for Code in Jupyter Notebooks