Skip to content

Instantly share code, notes, and snippets.

@tsonglew
Created July 30, 2018 02:21
Show Gist options
  • Save tsonglew/538b27262be10825cd9ae923d13740fa to your computer and use it in GitHub Desktop.
Save tsonglew/538b27262be10825cd9ae923d13740fa to your computer and use it in GitHub Desktop.
remove pipenv packages dependencies `pipenv uninstall `pipenv graph --json |python3 depends.py requests``
import sys
import json
package = sys.argv[1]
other_dependencies = set()
removing_dependencies = set([package])
for i in json.load(sys.stdin):
for p in i['dependencies']:
key = p['key']
if i['package']['key'] == package:
removing_dependencies.add(key)
else:
other_dependencies.add(key)
print(' '.join(removing_dependencies - other_dependencies))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment