I am trying to identify use cases of a specific python package on github.
Is there a way you could search all requirements.txt
files on repositories written in python for a string ?
In https://github.com/search, type :
django filename:requirements.txt language:python in:requirements.txt
like this :
https://api.github.com/search/code?q=django+in:requirements.txt+filename:requirements.txt+language:python+org:openmicroscopy
For the Github API case, you have to give a user, an organization or a repository
Check Search Code doc
Note that filename filter & string data are no exact match
It's 2022 and GitHub search has changed a bit.
You can now just use the more flexible path:
operator like this:
path:/^requirements.txt$/ django
Search results here. By default a search term now searches both the filename and the content, so to limit it to just filename/path we use path:
. Also we use a regex to specify we want files named exactly requirements.txt
and not things like dev-requirements.txt
which path:requirements.txt
would match.
I couldn't find a way to just search for requirements files in Python repos though. You can specify a language with language:python
but that applies at a per-file level, not at the repo level and those files aren't Python themselves. Fortunately requirements.txt
files seem to almost entirely be used in Python projects.
More info on GitHub's powerful new search can be found here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With