This is a small Python module for parsing Pip requirement files.
pip install requirements-parser
Requirements parser can parse a file-like object or a text string.
>>> import requirements >>> reqfile = """ ... Django>=1.5,<1.6 ... DocParser[PDF]==1.0.0 ... """ >>> for req in requirements.parse(reqfile): ... print(req.name, req.specs, req.extras) ... ('Django', [('>=', '1.5'), ('<', '1.6')], []) ('DocParser', [('==', '1.0.0')], ['pdf'])