Skip to main content

A library for python dependency specifiers, better known as PEP 508

Project description

Dependency specifiers (PEP 508) in Rust

Crates.io PyPI

A library for python dependency specifiers, better known as PEP 508.

Usage

In Rust

use std::str::FromStr;
use pep508_rs::Requirement;

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, "requests");
assert_eq!(dependency_specification.extras, Some(vec!["security".to_string(), "tests".to_string()]));

In Python

from pep508_rs import Requirement

requests = Requirement(
    'requests [security,tests] >= 2.8.1, == 2.8.* ; python_version > "3.8"'
)
assert requests.name == "requests"
assert requests.extras == ["security", "tests"]
assert [str(i) for i in requests.version_or_url] == [">= 2.8.1", "== 2.8.*"]

Python bindings are built with maturin, but you can also use the normal pip install .

Version and VersionSpecifier from pep440_rs are reexported to avoid type mismatches.

Markers

Markers allow you to install dependencies only in specific environments (python version, operating system, architecture, etc.) or when a specific feature is activated. E.g. you can say importlib-metadata ; python_version < "3.8" or itsdangerous (>=1.1.0) ; extra == 'security'. Unfortunately, the marker grammar has some oversights (e.g. https://github.com/pypa/packaging.python.org/pull/1181) and the design of comparisons (PEP 440 comparisons with lexicographic fallback) leads to confusing outcomes. This implementation tries to carefully validate everything and emit warnings whenever bogus comparisons with unintended semantics are made.

In python, warnings are by default sent to the normal python logging infrastructure:

from pep508_rs import Requirement, MarkerEnvironment

env = MarkerEnvironment.current()
assert not Requirement("numpy; extra == 'science'").evaluate_markers(env, [])
assert Requirement("numpy; extra == 'science'").evaluate_markers(env, ["science"])
assert not Requirement(
    "numpy; extra == 'science' and extra == 'arrays'"
).evaluate_markers(env, ["science"])
assert Requirement(
    "numpy; extra == 'science' or extra == 'arrays'"
).evaluate_markers(env, ["science"])
from pep508_rs import Requirement, MarkerEnvironment

env = MarkerEnvironment.current()
Requirement("numpy; python_version >= '3.9.'").evaluate_markers(env, [])
# This will log: 
# "Expected PEP 440 version to compare with python_version, found '3.9.', "
# "evaluating to false: Version `3.9.` doesn't match PEP 440 rules"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pep508_rs-0.3.0.tar.gz (40.3 kB view details)

Uploaded Source

Built Distributions

pep508_rs-0.3.0-cp38-abi3-win_amd64.whl (1.0 MB view details)

Uploaded CPython 3.8+ Windows x86-64

pep508_rs-0.3.0-cp38-abi3-win32.whl (939.3 kB view details)

Uploaded CPython 3.8+ Windows x86

pep508_rs-0.3.0-cp38-abi3-musllinux_1_2_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.8+ musllinux: musl 1.2+ x86-64

pep508_rs-0.3.0-cp38-abi3-musllinux_1_2_i686.whl (1.3 MB view details)

Uploaded CPython 3.8+ musllinux: musl 1.2+ i686

pep508_rs-0.3.0-cp38-abi3-musllinux_1_2_armv7l.whl (1.5 MB view details)

Uploaded CPython 3.8+ musllinux: musl 1.2+ ARMv7l

pep508_rs-0.3.0-cp38-abi3-musllinux_1_2_aarch64.whl (1.5 MB view details)

Uploaded CPython 3.8+ musllinux: musl 1.2+ ARM64

pep508_rs-0.3.0-cp38-abi3-manylinux_2_34_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.34+ x86-64

pep508_rs-0.3.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ x86-64

pep508_rs-0.3.0-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (1.5 MB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ s390x

pep508_rs-0.3.0-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (1.4 MB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ ppc64le

pep508_rs-0.3.0-cp38-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl (1.4 MB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ ppc64

pep508_rs-0.3.0-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.3 MB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ ARMv7l

pep508_rs-0.3.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.3 MB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ ARM64

pep508_rs-0.3.0-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl (1.3 MB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.5+ i686

pep508_rs-0.3.0-cp37-abi3-win_amd64.whl (1.0 MB view details)

Uploaded CPython 3.7+ Windows x86-64

pep508_rs-0.3.0-cp37-abi3-musllinux_1_2_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ x86-64

pep508_rs-0.3.0-cp37-abi3-musllinux_1_2_i686.whl (1.3 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ i686

pep508_rs-0.3.0-cp37-abi3-musllinux_1_2_armv7l.whl (1.3 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ ARMv7l

pep508_rs-0.3.0-cp37-abi3-musllinux_1_2_aarch64.whl (1.2 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ ARM64

pep508_rs-0.3.0-cp37-abi3-manylinux_2_34_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.34+ x86-64

pep508_rs-0.3.0-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (1.3 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ s390x

pep508_rs-0.3.0-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (1.2 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ppc64le

pep508_rs-0.3.0-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl (1.3 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ppc64

pep508_rs-0.3.0-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.0 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ARMv7l

pep508_rs-0.3.0-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ARM64

File details

Details for the file pep508_rs-0.3.0.tar.gz.

File metadata

  • Download URL: pep508_rs-0.3.0.tar.gz
  • Upload date:
  • Size: 40.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.7.0

File hashes

Hashes for pep508_rs-0.3.0.tar.gz
Algorithm Hash digest
SHA256 4816515448d68183e749580d36d24574c200418fcb3497a04a270670f4a950f3
MD5 a4c783b2fa80fee958cfee267aef50f1
BLAKE2b-256 10f1b91ed0c519180f0ed7635072a4c78910cdc624aaec9620981f904a8f02fe

See more details on using hashes here.

File details

Details for the file pep508_rs-0.3.0-cp38-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for pep508_rs-0.3.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 73b286378d65b236b2a03e8635577461d187a6149c6c8a366cf62a78471172be
MD5 0630857dbb351bb8ef362eb925bf541a
BLAKE2b-256 e4263788aaacf58b2c16ce05e091e7900f334f42c91724b8d175172a259fa06d

See more details on using hashes here.

File details

Details for the file pep508_rs-0.3.0-cp38-abi3-win32.whl.

File metadata

  • Download URL: pep508_rs-0.3.0-cp38-abi3-win32.whl
  • Upload date:
  • Size: 939.3 kB
  • Tags: CPython 3.8+, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.7.0

File hashes

Hashes for pep508_rs-0.3.0-cp38-abi3-win32.whl
Algorithm Hash digest
SHA256 143daad0b1345d6329bf3deed81a4940670d165d1c8326cda10bc526aa680335
MD5 706422713869dbcc285ad36ad6a9f0b3
BLAKE2b-256 04ea357a46dc609cddf06b48183efa30d78cdc74aaf6809f865489cdcf4e6a4e

See more details on using hashes here.

File details

Details for the file pep508_rs-0.3.0-cp38-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pep508_rs-0.3.0-cp38-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 42f39da97b5c0e5d943a92f854353857913d5f74d678ff48f5747ce7bd19ebc2
MD5 9ebb9d4dfa7fe181aa737bd2c62304ee
BLAKE2b-256 b6503a00884af636a6ddaf45b4d7e72f68b8eb36a1db2ada3aa0c6db56a28b86

See more details on using hashes here.

File details

Details for the file pep508_rs-0.3.0-cp38-abi3-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for pep508_rs-0.3.0-cp38-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 587f71318692b8327da2c1e53aee81355343de3a8befc00d7b752c08b467671b
MD5 72431a869a1bc4c1721a9e7ac7899b35
BLAKE2b-256 d09c52adec8fcd7846b0588e053ad513c6e04a898d9375844687f0a4a2628514

See more details on using hashes here.

File details

Details for the file pep508_rs-0.3.0-cp38-abi3-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for pep508_rs-0.3.0-cp38-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 02da2ec07ddf836dab0a30570a04d084f0a149ef6fb9b2f23c042dbb15e141ed
MD5 9fd6cd3880e37275a37a938db4388852
BLAKE2b-256 b38fe3c52ce427e72ff69bed511e0a560b41df387ff813c3ee2e07082484edd3

See more details on using hashes here.

File details

Details for the file pep508_rs-0.3.0-cp38-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pep508_rs-0.3.0-cp38-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 17336ff79e58b9383826877fe7a62154efa170fbee413d02c3f1f23668a71ebe
MD5 b10e5c1431c9c43b448354d34e28da36
BLAKE2b-256 dddf2e26c2c6124255e501d81fbcb301ac1717f9e07ea40c62bb2627f691ef01

See more details on using hashes here.

File details

Details for the file pep508_rs-0.3.0-cp38-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for pep508_rs-0.3.0-cp38-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 8474725f3804a6f05dc43adeabf46097e72b21d0b2233f9bc1104fea68490850
MD5 6e6092a602c1c6d7e16c0539205511c2
BLAKE2b-256 0faf2fb64cf02afb073fc90e616605d8683bbaa55d5a5507a77a5b8c7e087ada

See more details on using hashes here.

File details

Details for the file pep508_rs-0.3.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pep508_rs-0.3.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ed79b685010d3b772331a42f7ceba54a68e614de3a8b7e3de1e84d23f1eb12ca
MD5 df961e90546099c5ba938e3c8e77e70f
BLAKE2b-256 fe7a8375c1e90dd7236f8c972abdbea9e805bf36ebcdc4e8b5aef1d94d5486c9

See more details on using hashes here.

File details

Details for the file pep508_rs-0.3.0-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for pep508_rs-0.3.0-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 299cf0ffc8340c3f25bfa890f62771b6b7cababd332b06beaaf90d4306bda0b0
MD5 d39f6dd1220fc438a277f22f956137ec
BLAKE2b-256 de6d64560b9a118ccaac20a870b2cb227b1dc411593ba3f72464fe5383d0bb46

See more details on using hashes here.

File details

Details for the file pep508_rs-0.3.0-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for pep508_rs-0.3.0-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 75bc3a83eee8eab45fa7ef5f6e22c186c4866364a1aee6146b873235e134b38c
MD5 73aca582fa0a5354bc019d4169ac9978
BLAKE2b-256 9cd9290534c06f8464fb9d5143f4188beb41f19c89dd67aeeab46d50f083106e

See more details on using hashes here.

File details

Details for the file pep508_rs-0.3.0-cp38-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl.

File metadata

File hashes

Hashes for pep508_rs-0.3.0-cp38-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 4b6cdcf4a291bac5fb503032032ed3912a0a60a7fa08a1d8324ab31184f7e790
MD5 d904be4fe1e400bebf03568304d983a9
BLAKE2b-256 6bcc6099d2b2a07d227ae0e2cac84064076ebf23d48b402c0108f778fec45421

See more details on using hashes here.

File details

Details for the file pep508_rs-0.3.0-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for pep508_rs-0.3.0-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 dc5f58a6407c80831710a0850da236d66100232bd8c13a17135e3679181f0005
MD5 3171506cb2260b7832f837c3a8c4f377
BLAKE2b-256 dfb404f9c762b992df56caf7fbcd61a28f6ead267140179edd3f553e72404670

See more details on using hashes here.

File details

Details for the file pep508_rs-0.3.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pep508_rs-0.3.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0f64ee6fc8d763ba48c4df0714622260358698061004c46ad9f25bce14058e71
MD5 a3d8d3261331216a769e66a89291a9ed
BLAKE2b-256 c0894cc3516c8918fb867b9dc12875944ccf280c999bc4296d6460a76583b447

See more details on using hashes here.

File details

Details for the file pep508_rs-0.3.0-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl.

File metadata

File hashes

Hashes for pep508_rs-0.3.0-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 f4dff106d5eadcbf55806602698ceeed13e638600866619113374ee2962fb364
MD5 355962d5882d8821f7ff79171ae779ae
BLAKE2b-256 d71bdef37a57cea0020738cb920db7138fb9cfce88e8a40ed9ff4f0215b9ec3a

See more details on using hashes here.

File details

Details for the file pep508_rs-0.3.0-cp37-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for pep508_rs-0.3.0-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 2e95eb52b3d41584f9422095d024e46f88b19a6a1336278ece87663119069e14
MD5 9a518b9c421232442aaf8927e05c548b
BLAKE2b-256 b9c7a64b48082744036ecdbf7784f2fedf56002ad8af32e84a91c6c45ae47fab

See more details on using hashes here.

File details

Details for the file pep508_rs-0.3.0-cp37-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pep508_rs-0.3.0-cp37-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 9cf9e5867f6f502c01da9c0d87e032d8d89c4cfab9c6c4e993c6323ff51fc5d1
MD5 09cf57d30b0c8136ebc95b2f54726a3d
BLAKE2b-256 bb35e60aa470f83d971176138305efe35eeffb0ad5bd73e02ffa4cb3a45e1b0d

See more details on using hashes here.

File details

Details for the file pep508_rs-0.3.0-cp37-abi3-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for pep508_rs-0.3.0-cp37-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 27bd47944f32edfee54751d9a66762cc425fd431df028e0587cca7ef6cd08e62
MD5 aea750f3d4f45f4c5659df6d02fb96d7
BLAKE2b-256 0652ed2c3ff42b630ed14065847dddb1dab519facedf79a66878ead8318152f0

See more details on using hashes here.

File details

Details for the file pep508_rs-0.3.0-cp37-abi3-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for pep508_rs-0.3.0-cp37-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 eb6219ce657cdf26efe42383e5e725318bbcda8dd0f0f2c319ee2444e2c21f20
MD5 96ed37f409a21b1a65e478dd5cb2a9ce
BLAKE2b-256 6b22f8ad08d9cdd38cef896ac04939c048ef6bc008f2d1e8cb1156d703f91701

See more details on using hashes here.

File details

Details for the file pep508_rs-0.3.0-cp37-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pep508_rs-0.3.0-cp37-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 fdf248d0df62e080571bd472d930d813a137efdd88ee39c8f1625ad0089a77cb
MD5 fa5c05fc1bc15c5137499610ebd535ac
BLAKE2b-256 6235880008e188e4c94181faa37a6dd0688bdd2a8172d2926421590393950ce4

See more details on using hashes here.

File details

Details for the file pep508_rs-0.3.0-cp37-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for pep508_rs-0.3.0-cp37-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 773ed80fc92f9d2daccd78c8e7cf0025c136662ee0d5e9354614382ce3f67d79
MD5 db681cdcefd6e8d89d216f031705cca0
BLAKE2b-256 a9049a5e3607ba7267114dc4328b1eda8a9068017ad0922578ec3cb4dfc52c62

See more details on using hashes here.

File details

Details for the file pep508_rs-0.3.0-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for pep508_rs-0.3.0-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 5a7e5842f3a4ca88f3fe7f5efff6e0f6213e063b8a746736731d3c3e58e8144e
MD5 485b0d6b2f90990513ce3cf346a58f5b
BLAKE2b-256 63eeaceffb3fb15ff806c77acf2efd3fb7b12386d06a10cd23e7e63af5fc9fb6

See more details on using hashes here.

File details

Details for the file pep508_rs-0.3.0-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for pep508_rs-0.3.0-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 7ffbbcb09b3187be19790183065abc9a3968992ed1a41549703173ee1dceaae2
MD5 62ea2757c3a7452218af120932163ab1
BLAKE2b-256 51b680f4e661494961e1dd5df418101a6aeb3c1fa371cecbde990cff159e3d7f

See more details on using hashes here.

File details

Details for the file pep508_rs-0.3.0-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl.

File metadata

File hashes

Hashes for pep508_rs-0.3.0-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 85a8871f2279619190d04df4a753c4885e335aa63afb866e079ab09799474630
MD5 5980108b3bafdf194fef6ab801be27ba
BLAKE2b-256 950a3a05b6f174bfaf8e2afa6e6d0f7b5892b0e3344b12bbe5955b005b578af4

See more details on using hashes here.

File details

Details for the file pep508_rs-0.3.0-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for pep508_rs-0.3.0-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 8183241f1705a04519140f33ae3b8bfb1cd94313cc0f32a2551e8b10b4881462
MD5 40c25d26fc9272aaa2a0ffd7d44aa6e4
BLAKE2b-256 68330db5975a5b32c127a3d178941f9164467ff6f643aa3069f75fa3ce737d55

See more details on using hashes here.

File details

Details for the file pep508_rs-0.3.0-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pep508_rs-0.3.0-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ed3b1fbae4784e16a45232e148a41e644dfa812f6b262c59f4193c76acf56801
MD5 842b85a77d9ca7b02bd2cb498eb0a55b
BLAKE2b-256 14ca884a0c7519891bdb7c8d49ba84344d904155da16d853590185fe607f0c13

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page