3 releases (breaking)

0.3.0 Mar 11, 2023
0.2.0 Mar 4, 2023
0.1.0 Feb 18, 2023

#744 in Parser implementations

Download history 46/week @ 2023-02-14 123/week @ 2023-02-21 162/week @ 2023-02-28 90/week @ 2023-03-07 51/week @ 2023-03-14 74/week @ 2023-03-21 41/week @ 2023-03-28 26/week @ 2023-04-04 36/week @ 2023-04-11 31/week @ 2023-04-18 40/week @ 2023-04-25 37/week @ 2023-05-02 28/week @ 2023-05-09 381/week @ 2023-05-16 60/week @ 2023-05-23

511 downloads per month
Used in 2 crates

MPL-2.0 license

20KB
410 lines

pep-508

Rust implementation of Python dependency parser for PEP 508

version deps license ci

Documentation

Usage

let dep = "requests[security, socks] <= 2.28.1, == 2.28.*; python_version > '3.7' and extra == 'http'";
let parsed = parse(dep).unwrap();
let expected = Dependency {
    name: "requests",
    extras: vec!["security", "socks"],
    spec: Some(Spec::Version(vec![
        VersionSpec {
            comparator: Comparator::Le,
            version: "2.28.1",
        },
        VersionSpec {
            comparator: Comparator::Eq,
            version: "2.28.*",
        },
    ])),
    marker: Some(Marker::And(
        Box::new(Marker::Operator(
            Variable::PythonVersion,
            Operator::Comparator(Comparator::Gt),
            Variable::String("3.7"),
        )),
        Box::new(Marker::Operator(
            Variable::Extra,
            Operator::Comparator(Comparator::Eq),
            Variable::String("http"),
        )),
    )),
};
assert_eq!(parsed, expected);

Changelog

See CHANGELOG.md

Dependencies

~1MB
~19K SLoC