Last active
August 29, 2015 14:13
-
-
Save rouge8/9f3e7b05ad95875c0841 to your computer and use it in GitHub Desktop.
Check that a requirements.txt file is fully satisfied (including its dependencies) by the current environment. Useful for verifying installs done with `pip install --no-deps`
This file contains 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 | |
from argparse import ArgumentParser | |
import pkg_resources | |
def main(): | |
parser = ArgumentParser('Check that a requirements.txt file is satisifed ' | |
'by the current environment.') | |
parser.add_argument('filename') | |
args = parser.parse_args() | |
with open(args.filename) as f: | |
reqs = [line.strip() for line in f if not line.strip().startswith(('#', '--'))] | |
pkg_resources.require(reqs) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment