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§
- A
Cursor
over a string. - The normalized name of an extra dependency group.
- A list of
ExtraName
that can be attached to aRequirement
. - Invalid
crate::PackageName
orcrate::ExtraName
. - The marker values for a python interpreter, normally the current one
- Represents one clause such as
python_version > "3.8"
in the form - The normalized name of a package.
- Error with a span attached. Not that those aren’t
String
butVec<char>
indices. - A PEP 508 dependency specification
- Helper type with a Version and its original text
- A wrapper around
Url
that preserves the original string.
Enums§
- How to compare key and value, such as by
==
,>
ornot 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§
- Like
Url::parse
, but only splits the scheme. Derived from theurl
crate.