Skip to main content

Description

A library for dealing with RPM versions (NEVRA, EVR) correctly. Sort algorithm is identical to RPM.

Usage

from rpm_version import Evr, Nevra, evr_compare, evr_sort, nevra_sort

# Compare EVR strings directly
assert evr_compare("1.2.3-4", "1.2.3-5") == -1
assert evr_compare("2:1.0-1", "1:9.9-1") == 1

# Or use the Evr object for structured comparisons
v1 = Evr.parse("1:2.3.4-5")
v2 = Evr.parse("1:2.3.4-6")
assert v1 < v2

# Full NEVRA (Name-Epoch-Version-Release-Architecture) parsing
nevra = Nevra.parse("foo-1:2.3.4-5.x86_64")
print(f"{nevra.name} {nevra.version} {nevra.arch}")  # foo 2.3.4 x86_64

# Tilde (~) denotes a pre-release: sorts before the version without it
assert Evr.parse("1.0~rc1-1") < Evr.parse("1.0-1")
# Caret (^) denotes a post-release snapshot: sorts after the base version
assert Evr.parse("1.0-1") < Evr.parse("1.0^git1-1")
assert Evr.parse("1.0^git1-1") < Evr.parse("1.1-1")

# Bulk sorting entirely in Rust (avoids per-comparison FFI overhead)
sorted_versions = evr_sort(["2.0-1", "1.0-1", "1:0.5-1", "3.0-1"])
assert sorted_versions == ["1.0-1", "2.0-1", "3.0-1", "1:0.5-1"]

sorted_packages = nevra_sort(["foo-2.0-1.x86_64", "bar-1.0-1.x86_64", "foo-1.0-1.x86_64"])
assert sorted_packages == ["bar-1.0-1.x86_64", "foo-1.0-1.x86_64", "foo-2.0-1.x86_64"]

# Evr and Nevra are hashable
seen = {nevra}

# Version requirement matching
from rpm_version import Requirement, ReqOperator
req = Requirement("foo", ReqOperator.GE, Evr.parse("2.0-1"))
assert req.satisfies("foo", Evr.parse("2.0-1"))
assert req.satisfies("foo", Evr.parse("3.0-1"))
assert not req.satisfies("foo", Evr.parse("1.0-1"))

# String operators also work
req = Requirement("foo", ">=", Evr.parse("2.0-1"))

# Sort keys: encode RPM version ordering into raw bytes.
# Useful in databases (in-database RPM version ordering)
from rpm_version import EvrSortKey
key_a = EvrSortKey.from_values("1", "2.0", "3.fc40")
key_b = EvrSortKey.parse("1:3.0-1.fc40")
assert key_a < key_b
# Evr.sortkey() returns the same thing
assert Evr.parse("1:2.0-3.fc40").sortkey() == key_a
# Use as a sort key for sorted()
sorted(["2.0-1", "1:0.1-1", "1.0-1"], key=EvrSortKey.parse)

Metadata

Release files for rpm-version 0.5.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rpm-version 0.5.2
File Size Uploaded Provenance Actions
rpm_version-0.5.2.tar.gz 36.0 kB With provenance Details for rpm_version-0.5.2.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for rpm-version 0.5.2
File Actions
rpm_version-0.5.2-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for rpm_version-0.5.2-cp310-abi3-win_amd64.whl
rpm_version-0.5.2-cp310-abi3-manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64 Details for rpm_version-0.5.2-cp310-abi3-manylinux_2_28_x86_64.whl
rpm_version-0.5.2-cp310-abi3-manylinux_2_28_aarch64.whl CPython 3.10 abi3 Linux glibc 2.28+ ARM64 Details for rpm_version-0.5.2-cp310-abi3-manylinux_2_28_aarch64.whl
rpm_version-0.5.2-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for rpm_version-0.5.2-cp310-abi3-macosx_11_0_arm64.whl

Total release size: 1.1 MB

Release files / rpm_version-0.5.2.tar.gz

Download URL rpm_version-0.5.2.tar.gz
Size 36.0 kB
Tags Source
SHA-256 checksum
How to use checksums
af9847bc112b18f6512d216486a1125f133d0da0a0700612401a426a62f05e49
BLAKE2b-256 checksum
How to use checksums
30fbbe1aeb4922ce05b5fe9a0be0b75a5e4de73f3e147283a5bef9649ea38f0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Release files / rpm_version-0.5.2-cp310-abi3-win_amd64.whl

Download URL rpm_version-0.5.2-cp310-abi3-win_amd64.whl
Size 173.3 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
c886095abb00949d9b6e77202524fab4fb5d18d2fa508eb20f56afd3841f7ffa
BLAKE2b-256 checksum
How to use checksums
d78f0b8c2445101d2abe66b3f3652f57aa77d717e19b714ef4b680d50bd3dba1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Release files / rpm_version-0.5.2-cp310-abi3-manylinux_2_28_x86_64.whl

Download URL rpm_version-0.5.2-cp310-abi3-manylinux_2_28_x86_64.whl
Size 319.3 kB
Tags CPython 3.10 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
d78b46e7691cabedb4950b2ef62d063ef4675a12d088d350f96a212ab4524a6e
BLAKE2b-256 checksum
How to use checksums
b7a5d6739e6727861bbc55bec33147632dfc5360a06daf34930b6b2113d3ae71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Release files / rpm_version-0.5.2-cp310-abi3-manylinux_2_28_aarch64.whl

Download URL rpm_version-0.5.2-cp310-abi3-manylinux_2_28_aarch64.whl
Size 313.9 kB
Tags CPython 3.10 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
8356aa9ada2e9c6fe2a979a199c27ba645f3dbc8a35bdd408059f15b7d5624d0
BLAKE2b-256 checksum
How to use checksums
aa8ef108a1ce5e948c34d1e525cfafd1345cd54820056c29869a5f18e8ca2306
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Release files / rpm_version-0.5.2-cp310-abi3-macosx_11_0_arm64.whl

Download URL rpm_version-0.5.2-cp310-abi3-macosx_11_0_arm64.whl
Size 282.5 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
9ad9798b95cca0ca2bed33ec23ff0b52c067f4e09c3738ad01b105f4867eb2e4
BLAKE2b-256 checksum
How to use checksums
592b606c44073ea535a5b4d974f161fa9be40e3c44d57749eafeefb14d379b7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Security for rpm-version 0.5.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for rpm_version-0.5.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page