Skip to main content

Version Comparison

You can use this tool to compare 2 versions in order to know if is greater, lesser or equal to the other.

Installation

pip install version-comparison

Usage

  • get_lesser() function return the lesser version of the provided, if none is lesser, the result is a None value.

  • get_greater() function return the greater version of the provided, if none is greater, the result is a None value.

  • compare() function return which one is greater, lesser or equal to the other.

from versions_comparison import Comparison

versions = Comparison(version_1, version_2)
versions.get_lesser()
versions.get_greater()
versions.compare() 

Valid Formats

  • dot numbers: You can use numbers like 1.5, 0.1.9, 8.6.3
  • chars: You can validate a version with chars. b > a or d < z

Exceptions

There are a coulpe of exceptions that could be used to catch possible errors throwed by the library.

  • FormatVersion: This exception is thrown when the version provided does not have a valid format.
  • StringFormat: This exception is thrown when the version provided is not a valid string type.
from versions_comparison.exceptions import FormatVersion, StringFormat

Metadata

Release files for version-comparison 0.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 version-comparison 0.2
File Size Uploaded
version_comparison-0.2.tar.gz 2.8 kB Details

Release files / version_comparison-0.2.tar.gz

Download URL version_comparison-0.2.tar.gz
Size 2.8 kB
Tags Source
SHA-256 checksum
How to use checksums
7707cc3bb8246a7b357e136e2ad5609e7cff786001b7a1012e4bbe56c56ae6a5
BLAKE2b-256 checksum
How to use checksums
23fa568782424704d6a4520c9d8619e21b029c5239ab5857fecf619ec56800fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.5

Release history Release notifications | RSS feed

This release

0.2 This release

1 release file

0.1

1 release file

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