Metadata-Version: 2.1
Name: pep508-parser
Version: 2019.2
Summary: A parser for the PEP508 dependency specification.
Home-page: https://github.com/NFJones/pep508-parser
Author: Neil F Jones
License: UNKNOWN
Keywords: pep508
Platform: UNKNOWN
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Build Tools
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Requires-Python: !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4
Description-Content-Type: text/markdown
Requires-Dist: Parsley (==1.3)
Requires-Dist: pkg-resources (==0.0.0)

# pep508-parser

A parser for the [PEP508](https://www.python.org/dev/peps/pep-0508/) dependency specification.

# Example
```python
#!/usr/bin/env python3

from pep508_parser import parser

tests = [
    "A",
    "A.B-C_D",
    "aa",
    "name",
    "name<=1",
    "name>=3",
    "name>=3,<2",
    "name@http://foo.com",
    "name [fred,bar] @ http://foo.com ; python_version=='2.7'",
    "name[quux, strange];python_version<'2.7' and platform_version=='2'",
    "name; os_name=='a' or os_name=='b'",
    # Should parse as (a and b) or c
    "name; os_name=='a' and os_name=='b' or os_name=='c'",
    # Overriding precedence -> a and (b or c)
    "name; os_name=='a' and (os_name=='b' or os_name=='c')",
    # should parse as a or (b and c)
    "name; os_name=='a' or os_name=='b' and os_name=='c'",
    # Overriding precedence -> (a or b) and c
    "name; (os_name=='a' or os_name=='b') and os_name=='c'",
]


def main():
    for test in tests:
        parsed = parser.parse(test)
        print("{} -> {}".format(test, parsed))


if __name__ == '__main__':
    main()
```


