A parser for the PEP508 dependency specification.
Project description
pep508-parser
A parser for the PEP508 dependency specification.
Example
#!/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()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pep508_parser-2019.3.tar.gz
(4.1 kB
view hashes)
Built Distribution
Close
Hashes for pep508_parser-2019.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a86bc54cc4a848ef0a45fd8e1de26d4959a19d0e0b21cf99fd3681029d1aff7 |
|
MD5 | 7986d891e594b1948f79c8ae26f9c771 |
|
BLAKE2b-256 | 70d756c24c2bb9bce7a9b2c1c4b78b57ad126dcd20bad73fedce3556ceb963c2 |