Skip to main content

CheckVersions is a powerful and intuitive version comparison tool for software development.

Project description

CheckVersions

Run Tests PyPI Version Python Versions License: MIT Downloads Last Commit GitHub Issues GitHub Stars GitHub Forks

Maintainer Sponsor on GitHub License: MIT Stability

CheckVersions is a powerful and intuitive version comparison tool designed to simplify the process of discerning the latest and older versions in software development.

Features

  • Semantic Version Analysis: 🧐 Leverage our sophisticated semantic versioning analysis engine to compare versions like "0.0.0-beta" effortlessly.

  • Automated Version Ranking: 🚀 CheckVersions automatically ranks versions based on their priority, allowing you to quickly identify the latest version.

  • Efficient Version Delta Assessment: 📊 CheckVersions provides a simple and efficient way to assess the difference between two versions.

  • User-Friendly Interface: 🎨 Our intuitive user interface ensures that developers can effortlessly compare versions.

  • Secure Version Analysis: 🔒 Security is paramount. CheckVersions ensures version comparison is performed securely, protecting your intellectual property and facilitating risk-free decision-making in your development process.

  • Custom Hierarchy 📝 Customize the hierarchy of version words to suit your needs. For instance, you can assign a higher priority to "beta" than "alpha" if you wish.

  • Older Version Retrieval: ⏳ Optionally retrieve the older version when comparing two versions by setting the older_version parameter to True.

Getting Started

Installation

pip install checkversions

Usage

from checkversions import *

# Example 1: Basic Version Comparison
current_version = "v1.0.0"
latest_version = "v1.0.0-beta"
result = compare_versions(current_version, latest_version)
print(result)
# Output: v1.0.0

In this example, we demonstrate a basic version comparison. The compare_versions function is used to compare the current_version (v1.0.0) with the latest_version (v1.0.0-beta). The result is printed, and it shows that the latest version is v1.0.0.

from checkversions import *

# Example 2: Comparing Versions with Hyphens and Words
version1 = "2.0.0-beta"
version2 = "2.0.1-alpha"
result = compare_versions(version1, version2)
print(result)
# Output: 2.0.1-alpha

In this example, we showcase version comparison with hyphens and additional words. The compare_versions function compares version1 (2.0.0-beta) with version2 (2.0.1-alpha). The result is printed, indicating that the latest version is 2.0.1-alpha.

Default Hierarchy

{
  "beta": 0,
  "prerelease": 1,
  "alpha": 2,
  "unstable": 3,
  "stable": 4,
  "release": 5
}

The default hierarchy is a JSON representation that assigns priority values to version words. For instance, "beta" has a priority of 0, "prerelease" has a priority of 1, and so on.

Custom Hierarchy

from checkversions import *

# Example 3: Custom Hierarchy
# Define a custom hierarchy
custom_hierarchy = {"beta": 0, "alpha": 1, "rc": 2, "gamma": 3, "stable": 4}

version1 = "v1.0.0-beta"
version2 = "v1.0.1-alpha"
result = compare_versions(version1, version2, custom_hierarchy)
print(result)
# Output: v1.0.1-alpha

In this example, we introduce a custom hierarchy for version comparison. The custom_hierarchy dictionary is defined with version words and their corresponding priority. The compare_versions function uses this custom hierarchy to compare version1 (v1.0.0-beta) with version2 (v1.0.1-alpha). The result is printed, indicating that the latest version is v1.0.1-alpha.

Older Version

from checkversions import *
current_version = "v1.0.0"
latest_version = "v1.0.0-beta"
# Example with older_version=True
result_older = compare_versions(current_version, latest_version, older_version=True)
print(f"Older version: {result_older}")
# Output: Older version: v1.0.0-beta

In this example, by setting older_version=True, the function returns and prints the older version (v1.0.0-beta) based on the provided versions (v1.0.0 and v1.0.0-beta). If older_version is omitted or set to False, it would return and print the latest version.

Contributing

Contributions are welcome! Before contributing, please read our Contributing Guidelines to ensure a smooth and collaborative development process.

Code of Conduct

Please review our Code of Conduct to understand the standards of behavior we expect from contributors and users of this project.

License

This project is licensed under the MIT License. See LICENSE for more details.

Support the Project


💰 You can help me improve more by offering a little support on any platform❤️

BuyMeACoffee Patreon Ko-Fi Sponsor muhammad-fiaz Open Collective Backer

Happy Coding ❤️

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

checkversions-0.0.5.tar.gz (8.1 kB view hashes)

Uploaded Source

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