Last active
September 14, 2016 21:27
-
-
Save papaben/4cf9d7a37259ab2a2a9dab1194a62788 to your computer and use it in GitHub Desktop.
Figure out which of your pip requirements depend on another
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# Be sure to execute this with your virtualenv activated | |
from pip._vendor import pkg_resources | |
import sys | |
# The name of the pip package | |
# TODO error checking (when this is no longer a gist) | |
dependency = sys.argv[1] | |
for p in pkg_resources.working_set.by_key.values(): | |
for pr in p.requires(): | |
if str(pr).startswith(dependency): | |
print("Dependency for {} in {}".format(dependency, p)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment