univers
Project description
Univers: Ecosystem specific version comparision and conversion
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.
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file univers-21.4.8.tar.gz
.
File metadata
- Download URL: univers-21.4.8.tar.gz
- Upload date:
- Size: 46.2 kB
- Tags: Source
- 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.59.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 163f3bf43e2db41720214f2bff36420a05f3862abbc314ffcc95cd74d5505f34 |
|
MD5 | 25ae79a54bc4a9af484a9022dbc31af1 |
|
BLAKE2b-256 | 443d86b852636ac71d900378fe3621ce09b1a74530660462843238db28e98c86 |
Provenance
File details
Details for the file univers-21.4.8-py3-none-any.whl
.
File metadata
- Download URL: univers-21.4.8-py3-none-any.whl
- Upload date:
- Size: 31.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.59.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e20372627944ee866e60a7ad9aabcb06b88cdea069afc36571738fd448162304 |
|
MD5 | 91d005da32d7a960670490d905ee7882 |
|
BLAKE2b-256 | 08fc75a19dd9e5d316bbb787eb9feec4446e0aa87068c7f51dba72c4b90aca3e |