Skip to main content

No project description provided

Project description

PEP440 in rust

A library for python version numbers and specifiers, implementing PEP 440

pip install pep440_rs
from pep440_rs import Version, VersionSpecifier

assert Version("1.1a1").any_prerelease()
assert Version("1.1.dev2").any_prerelease()
assert not Version("1.1").any_prerelease()
assert VersionSpecifier(">=1.0").contains(Version("1.1a1"))
assert not VersionSpecifier(">=1.1").contains(Version("1.1a1"))
assert Version("2.0") in VersionSpecifier("==2")

Unlike pypa/packaging, this library always matches preleases. To only match final releases, filter with .any_prelease() beforehand.

PEP 440 has a lot of unintuitive features, including:

  • An epoch that you can prefix the version which, e.g. 1!1.2.3. Lower epoch always means lower version (1.0 <=2!0.1)
  • post versions, which can be attached to both stable releases and prereleases
  • dev versions, which can be attached to sbpth table releases and prereleases. When attached to a prerelease the dev version is ordered just below the normal prerelease, however when attached to a stable version, the dev version is sorted before a prereleases
  • prerelease handling is a mess: "Pre-releases of any kind, including developmental releases, are implicitly excluded from all version specifiers, unless they are already present on the system, explicitly requested by the user, or if the only available version that satisfies the version specifier is a pre-release.". This means that we can't say whether a specifier matches without also looking at the environment
  • prelease vs. prerelease incl. dev is fuzzy
  • local versions on top of all the others, which are added with a + and have implicitly typed string and number segments
  • no semver-caret (^), but a pseudo-semver tilde (~=)
  • ordering contradicts matching: We have e.g. 1.0+local > 1.0 when sorting, but ==1.0 matches 1.0+local. While the ordering of versions itself is a total order the version matching needs to catch all sorts of special cases

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

pep440_rs-0.1.0a1.tar.gz (27.9 kB view details)

Uploaded Source

Built Distribution

pep440_rs-0.1.0a1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (573.0 kB view details)

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

File details

Details for the file pep440_rs-0.1.0a1.tar.gz.

File metadata

  • Download URL: pep440_rs-0.1.0a1.tar.gz
  • Upload date:
  • Size: 27.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/0.14.2

File hashes

Hashes for pep440_rs-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 ae9563debcc01da28eb4789da181cffa8e25468a2648297b389879d5711b4656
MD5 add4d9d30398d06943f9cd233da3b1b6
BLAKE2b-256 37de7e4e1b14f9ae5c37b7fe00ea2b80e77550e01aca2e00806e87f3b34a833b

See more details on using hashes here.

File details

Details for the file pep440_rs-0.1.0a1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pep440_rs-0.1.0a1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c76f226e7568f21a24207e6f0be3a6929028be2dcceec63e0a5606dd1986aebd
MD5 513f08a8c1297bd15fc80a11d8a4e7e7
BLAKE2b-256 4e7b78ff9bf2056e980922aef5404c349415c7aa23149cc30ea496d5db5996ff

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