Skip to main content

Univers: Ecosystem specific version comparision and conversion

Build Status License Python 3.6+

Why ecosystem specific ?

Univers was born out of the need for version comparision at VulnerableCode. Existing tools follow a particular algorithm to evaluate and compare versions. This is not accurate across different ecosystems, since they follow different versioning rules. For example there’s no concept of ‘epoch’ in semver based ecosystem like npm or ruby gems, but epochs do exist in debian ecosystem. The tools solely based on semver or dpkg version spec therefore give different and wrong results in both cases.

Univers is different, it considers the ecosystem of version.

How Univers works ?

Univers, can be considered as a wrapper around many version comparision libraries, each of which solving the problem for the respective ecosystem. It delegates the actual comparision to these libraries depending upon the ecosystem.

The supported ecosystems and underlying libraries are:

  • npm, golang, php-composer, ruby-gems and others which follow the semver spec. These use semantic_version library.

  • debian, this is handled by debian-inspector library.

  • pypi, this is handled by Python’s packaging.version module.

  • maven, this is handled by rpm_vercmp library.

  • ebuild/gentoo, this is handled by gentoo_vercmp module.

Installation

$ pip install univers

Examples

Comparing discrete versions

from univers.version import PYPIVersion
v1 = PYPIVersion("1.2.3")
v2 = PYPIVersion("1.2.4")
assert v1 < v2 == True

Evaluating version ranges

from univers.version import PYPIVersion
from univers.version_specifier import VersionSpecifier

vs = VersionSpecifier.from_scheme_version_spec_string("pypi", ">=1.2.4")
v1 = PYPIVersion("1.2.4")
v2 = PYPIVersion("1.2.3")

assert (v1 in vs ) == True
assert (v2 in vs ) == False

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

univers-21.4.16.6-py3-none-any.whl (37.4 kB view details)

Uploaded Python 3

File details

Details for the file univers-21.4.16.6-py3-none-any.whl.

File metadata

  • Download URL: univers-21.4.16.6-py3-none-any.whl
  • Upload date:
  • Size: 37.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5

File hashes

Hashes for univers-21.4.16.6-py3-none-any.whl
Algorithm Hash digest
SHA256 70a0be336885723f2c83fbf2acaa0fca50828f471703bcc8d186d20a184aaa31
MD5 eee1d56498757a5a8632df6772e2ad15
BLAKE2b-256 57e80f5f716ebc067a2d23880d8f5a9f6512068adfd0af5b3439059e49876054

See more details on using hashes here.

Release history Release notifications | RSS feed

32.0.1

2 files

31.1.0

2 files

31.0.0

2 files

30.12.1

2 files

30.12.0

2 files

30.11.0

2 files

30.10.1

2 files

30.10.0

2 files

30.9.2

2 files

30.9.1

2 files

30.9.0

2 files

30.8.0

2 files

30.7.0

2 files

30.6.0

2 files

30.5.1

2 files

30.5.0

2 files

30.4.0

2 files

30.3.1

2 files

30.3.0

2 files

30.2.0

2 files

30.1.0

2 files

30.0.0

2 files

This release

21.4.16.6 This release

1 file

21.4.16

2 files

21.4.9

2 files

21.4.8

2 files

0.0.1

1 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