Python requirements.txt
parser.
$ pip install rparse
import rparse
requirements = """
flask == 0.10.1
pip >= 6.0.0, < 6.0.7
"""
for requirement in rparse.parse(requirements):
print(requirement.name, requirement.specs)
Output will be looks like this:
("flask", [("==", "0.10.1")])
("pip", [(">=", "6.0.0"), ("<", "6.0.7")])
rparse
also have simple command line interface that can be used like this:
$ cat requirements.txt
flask==0.10.1
raven[flask]>=1.0
$ rparse.py requirements.txt
Package: flask
Version Specifier: [('==', '0.10.1')]
Extras: None
Comment: None
----------------------------------------------------------------
Package: raven
Version Specifier: [('>=', '1.0')]
Extras: ['flask']
Comment: None
----------------------------------------------------------------