Skip to main content

Package version comparison made easy.

Project description

Package version comparison made easy.

PyPI Version Supported Python versions Build Status Documentation Status llms.txt - documentation for LLMs MIT Coverage

versus is a standalone, portable, dependency-free library for comparing package versions from within the code. It supports variety of lookups, such as lte, lt, gte, gt and eq.

Prerequisites

Python 3.9+

Installation

pip

pip install versus

Download and copy

versus.py is the sole, self-contained module of the package. It includes tests too. If it’s more convenient to you, you could simply download the versus.py module and include it in your repository.

Since tests are included, it won’t have a negative impact on your test coverage (you might need to apply tweaks to your coverage configuration).

Documentation

Usage

Comparing Django versions.

from versus import get_version

django_version = get_version("django")
print(django_version)  # 5.2.1

django_version.gte("4.2")  # True
django_version.gte("5.2")  # True
django_version.gte("5.2.1")  # True
django_version.gte("5.2.2")  # True

Comparing sphinx-autobuild versions:

sphinx_autobuild_version = get_version("sphinx-autobuild")
print(sphinx_autobuild_version)  # 2024.10.3

sphinx_autobuild_version.gte("1.0")  # True
sphinx_autobuild_version.gte("2024.09")  # True
sphinx_autobuild_version.gte("2024.11")  # False
sphinx_autobuild_version.lte("2024.11")  # True

Non-existent/non-installed package lookup would return None:

nonexistent_package = get_version("nonexistent-package")
print(nonexistent_package)  # None

Tests

Run the tests with unittest:

python -m unittest versus

Or pytest:

pytest

Writing documentation

Keep the following hierarchy.

=====
title
=====

header
======

sub-header
----------

sub-sub-header
~~~~~~~~~~~~~~

sub-sub-sub-header
^^^^^^^^^^^^^^^^^^

sub-sub-sub-sub-header
++++++++++++++++++++++

sub-sub-sub-sub-sub-header
**************************

License

MIT

Support

For security issues contact me at the e-mail given in the Author section.

For overall issues, go to GitHub.

Author

Artur Barseghyan <artur.barseghyan@gmail.com>

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

versus-0.1.1.tar.gz (22.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

versus-0.1.1-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file versus-0.1.1.tar.gz.

File metadata

  • Download URL: versus-0.1.1.tar.gz
  • Upload date:
  • Size: 22.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for versus-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f7f22c325f7d268dbb4518df04a827aa0d46299efbbc857ed522edf4600687a1
MD5 5e10f93c8dc21278f42b81ad1c5dacd3
BLAKE2b-256 b0838a938d881f92e9f6600c18660566c05f03148220eb0c54fbeee9ad39410d

See more details on using hashes here.

File details

Details for the file versus-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: versus-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for versus-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dc7b6b489c95fc7f996f6f58210fdf01d62d97dd9a6e03ea9843b31f4485b8cc
MD5 0a890bc1e50942f95d0811ab62abfbf9
BLAKE2b-256 546e2daef90f587c06579fc1afda7c4cad3d3cd8c5d8f0cfcca2394ca8683644

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page