Skip to content
python version of node-semver
Python Makefile
Branch: master
Clone or download
Latest commit e12f0f2 Aug 12, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples Always include prerelease versions in range matching Oct 30, 2018
semver more gentle error handling (#29) Nov 24, 2018
.gitignore bump version Aug 12, 2019
.travis.yml support 4-digit (#19) Sep 27, 2018
CHANGES.txt change log Aug 12, 2019
LICENSE license Oct 27, 2016
MANIFEST.in Include tests in source distributions Aug 12, 2019
Makefile readme May 31, 2014
README.rst Always include prerelease versions in range matching Oct 30, 2018
setup.cfg travis Sep 13, 2017
setup.py
tox.ini setup.py May 31, 2014

README.rst

semver

https://travis-ci.org/podhmo/python-semver.svg?branch=master

python version of [node-semver](https://github.com/isaacs/node-semver)

install

pip install node-semver

examples

# -*- coding:utf-8 -*-
from semver import max_satisfying

versions = ['1.2.3', '1.2.4', '1.2.5', '1.2.6', '2.0.1']
range_ = '~1.2.3'
assert max_satisfying(versions, range_, loose=False) == '1.2.6'


versions = ['1.1.0', '1.2.0', '1.2.1', '1.3.0', '2.0.0b1', '2.0.0b2', '2.0.0b3', '2.0.0', '2.1.0']
range_ = '~2.0.0'
assert max_satisfying(versions, range_, loose=True) == '2.0.0'

try:
    (max_satisfying(versions, range_, loose=False) == '2.0.0')
except ValueError as e:
    assert e.args[0] == "Invalid Version: 2.0.0b1"

versions = ['1.2.3', '1.2.4', '1.2.5', '1.2.6-pre.1', '2.0.1']
range_ = '~1.2.3'
assert max_satisfying(versions, range_, loose=False, include_prerelease=True) == '1.2.6-pre.1'
assert max_satisfying(versions, range_, loose=False, include_prerelease=False) == '1.2.5'
You can’t perform that action at this time.