Crate pep508_rs

source ·
Expand description

A library for python dependency specifiers better known as PEP 508

§Usage

use std::str::FromStr;
use pep508_rs::{Requirement, ExtraName};

let marker = r#"requests [security,tests] >= 2.8.1, == 2.8.* ; python_version > "3.8""#;
let dependency_specification = Requirement::from_str(marker).unwrap();
assert_eq!(dependency_specification.name.as_ref(), "requests");
assert_eq!(dependency_specification.extras, vec![ExtraName::from_str("security").unwrap(), ExtraName::from_str("tests").unwrap()]);

Structs§

Enums§

  • How to compare key and value, such as by ==, > or not in
  • Represents one of the nested marker expressions with and/or/parentheses
  • One of the predefined environment values
  • Those environment markers with an arbitrary string as value such as sys_platform
  • Those environment markers with a PEP 440 version as value such as python_version
  • Ways in which marker evaluation can fail
  • Either we have an error string from our parser or an upstream error from url
  • The actual version specifier or url to install

Functions§