Skip to main content

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()

Release files for pep508-parser 2019.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pep508-parser 2019.3
File Size Uploaded
pep508_parser-2019.3.tar.gz 4.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pep508-parser 2019.3
File Interpreter ABI Platform
pep508_parser-2019.3-py3-none-any.whl Python 3 none any Details

Total release size: 9.7 kB

Release files / pep508_parser-2019.3.tar.gz

Download URL pep508_parser-2019.3.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f4bec9d1b0485ba70803c8e84ae741edb1de9af9932a6454cf12853aa43dbda9
BLAKE2b-256 checksum
How to use checksums
087e4747ccd2fe817254e7fa5f255b472cd24e1dd5c4c0941209844092b458c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.6

Release files / pep508_parser-2019.3-py3-none-any.whl

Download URL pep508_parser-2019.3-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4a86bc54cc4a848ef0a45fd8e1de26d4959a19d0e0b21cf99fd3681029d1aff7
BLAKE2b-256 checksum
How to use checksums
70d756c24c2bb9bce7a9b2c1c4b78b57ad126dcd20bad73fedce3556ceb963c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.6

Release history Release notifications | RSS feed

This release

2019.3 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page