Skip to content

Instantly share code, notes, and snippets.

@aconz2
Created June 14, 2015 23:54
Show Gist options
  • Save aconz2/ddf2d91f62a252166bf3 to your computer and use it in GitHub Desktop.
Save aconz2/ddf2d91f62a252166bf3 to your computer and use it in GitHub Desktop.
Retreive a list of all available packages from pip. (pip(1) doesn't output in a nice format)
#!/usr/bin/env python3
import pip
searcher = pip.commands.SearchCommand()
options, _ = searcher.parse_args([])
hits = searcher.search('*', options)
hits_transformed = pip.commands.search.transform_hits(hits)
for hit in hits_transformed:
print(hit['name'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment