Skip to main content

Convert between semver range and maven version range

Project description

unified-range

Based on the VersionRange model and spec of maven.

Library to convert semver ranges to unified-range and the over way around. Currently only supported for comparator semver ranges.

Install

  1. Use pipenv

pipenv install unified-range

or

  1. Use pip directly

pip install unified-range

How to use

  1. Import the api module:

from unified_range import api

  1. Convert from semver to the unified range (return VersionRange object):

ver_rng = api.from_semver(semver_str)

  1. To get the string representation of a VersionRange object:

version_range_str = str(ver_rng)

  1. Convert from unified spec to semver_str (return str):

semver = api.to_semver(unified_spec_str)

  1. Convert from spec string to VersionRange objects:

ver_rng = api.unified_range(unified_spec_str)

  1. Filter versions list by list of ranges:

filtered_lst = api.filter_versions(ascending_version_list, ranges) The versions in ascending_version_list should be sorted in ascending order, from oldest to newest, and contain all the versions for the package.

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

unified_range-0.0.7.tar.gz (8.8 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page