Reputation: 354
I use pip freeze > requirements.txt
in my directory and it stores all the installed libraries on my machine. Is it possible to reduce this down to the libraries used in this directory or maybe just a single python file?
Upvotes: 1
Views: 738
Reputation: 271
I think you have a few options. One is brute force use grep to find all the import statements in your files.
Another option, check out Snakefood: http://furius.ca/snakefood/doc/snakefood-doc.html
Simple tool you can use to print out python dependencies. Can be as simple as
sfood-imports yourfile.py
And you can extend it using the --unified flag to print out the set of unique libraries you need for the files in a directory.
Upvotes: 2