Skip to main content

jk_version

Introduction

This python module provides a version class. Instances of this class may be used in representing and version numbers and compare them.

Information about this module can be found here:

Why this module?

To manage data and software packages in a reasonable way versioning is important. For this you need to represent versions in computer memory. This is what this module does: Provide version objects so that you can work with version information programmatically. That's what this module has been written for.

Functionality

This module provides:

  • Version - An object to represent version numbers in memory. (Parsing of version numbers is provided by this object as well.)
  • Constraint classes that can be used to check versions:
    • BaseVersionConstraint - the abstract base class for all constraints
    • A set of concrete constraint classes: VersionConstraint[GE|GT|LE|LT|NE|EQ|AND|OR]

How to use this module

Import this module

Please include this module into your application using the following code:

import jk_version

Parse a version number

Version numbers can either be specified as lists of integers or as a string. Examples:

  • Version([ 1, 7, 51 ])
  • Version(( 1, 7, 51 ))
  • Version("1.7.51")

Additionally you can use the following static method:

  • Version.parseFromStr("1.7.51")
  • Version.parseFromStr("1.7.51", bStrict=True)

Version numbering schema

For compatibility reasons the version number parser is designed to accept the following schema:

[ epoch ":" ] version_data [ "-" extra ]

Where epoch is optional and - if present - must be an integer, and version_data is a regular version string consisting of decimal numbers separated by points.

Examples for valid version numbers:

  • 0
  • 0.1
  • 0.1.2
  • 1
  • 1.7
  • 2020.12.24
  • 0.2022.8.6
  • 0.2022.8.6.1

Parsing epoch information is supported:

  • 2:0.1.2

And an extra identifier is supported as well:

  • 1.7-alpha
  • 0.1.2-dev
  • 1.2.3-stable
  • 2.3.4-SNAPSHOT
  • 3.4.5-beta2
  • 0.2022.8.6.2-rc1

In non-strict mode (= default) parsing will handle strings such as this as well:

  • 3.4.5.beta2

Generating version numbers

The Version class supports the generation of date based version numbers. Example:

v = Version.now()
print(v)

This would build a version number such as this:

  • 0.2022.8.6

Comparing version numbers

Version numbers can be compared. Example:

v1 = Version("0.1.2")
v2 = Version("0.2.0")
print(v2 > v1)

This will result in: True

NOTE: Please note that extra identifiers are stored in version objects but are ignored otherwise. If you require to compare two versions and this comparison must take this extra identifier into account you need to implement your own comparison function for this purpose. This is because of the fact that there is no general convention how this extra information can be processed.

Compatible Modules

Version number parsers:

Contact Information

This work is Open Source. This enables you to use this work for free.

Please have in mind this also enables you to contribute. We, the subspecies of software developers, can create great things. But the more collaborate, the more fantastic these things can become. Therefore Feel free to contact the author(s) listed below, either for giving feedback, providing comments, hints, indicate possible collaborations, ideas, improvements. Or maybe for "only" reporting some bugs:

License

This software is provided under the following license:

  • Apache Software License 2.0

Metadata

Release files for jk_version 0.2026.3.27.1

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

Source distribution (sdist)

Source distribution for jk_version 0.2026.3.27.1
File Size Uploaded
jk_version-0.2026.3.27.1.tar.gz 11.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jk_version 0.2026.3.27.1
File Interpreter ABI Platform
jk_version-0.2026.3.27.1-py3-none-any.whl Python 3 none any Details

Total release size: 26.8 kB

Release files / jk_version-0.2026.3.27.1.tar.gz

Download URL jk_version-0.2026.3.27.1.tar.gz
Size 11.9 kB
Tags Source
SHA-256 checksum
How to use checksums
7274aafb5ad0908e2f97e518652bde1505f22196bc23d51e1e5fd47e875d267b
BLAKE2b-256 checksum
How to use checksums
fe7f5607529431ce82f3c2e4213ad59d6bef2590c034e83c3bac0e4e756d8ce7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.3

Release files / jk_version-0.2026.3.27.1-py3-none-any.whl

Download URL jk_version-0.2026.3.27.1-py3-none-any.whl
Size 14.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9a8119d5f8f3b019be4ed0b370890edbab632ca116b813a1df415cac9ca1be26
BLAKE2b-256 checksum
How to use checksums
c10ac733f710ed4d1df1a5317df0c9700c04fae324f9436073ce75ae59df10ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.3
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