Skip to main content

A library for comparing version strings

Project description

Compare package versions in all their varied glory.


This module provides the compare() function which compares two version strings and returns a negative value, zero, or a positive value depending on whether the first string represents a version number lower than, equal to, or higher than the second one, and the key_compare() function which may be used as a key for e.g. sorted().

This module does not strive for completeness in the formats of version strings that it supports. Some version strings sorted by its rules are:

  • 0.1.0
  • 0.2.alpha
  • 0.2
  • 0.2.1
  • 0.2a
  • 0.2a.1
  • 0.2p3
  • 1.0.beta
  • 1.0.beta.2
  • 1.0


This module is developed in a Gitlab repository. The author is Peter Pentchev.

Version history


  • first public release

Project details

Release history Release notifications

Download files

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

Files for trivver, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size trivver-0.1.0-py2.py3-none-any.whl (3.5 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size trivver-0.1.0.tar.gz (6.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page