Crates.io | pep-508 |
lib.rs | pep-508 |
version | 0.4.0 |
source | src |
created_at | 2023-02-18 18:10:37.367152 |
updated_at | 2023-11-20 01:55:52.204552 |
description | Python dependency parser for PEP 508 |
homepage | https://github.com/figsoda/pep-508 |
repository | https://github.com/figsoda/pep-508 |
max_upload_size | |
id | 788370 |
size | 49,297 |
Rust implementation of Python dependency parser for PEP 508
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);
See CHANGELOG.md