port of node-semver
Project description
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'
0.5.1
bug fix
0.5.0
include_prerelease option is added
0.4.2
fix bug for support 4-digit (handling prelease and build)
0.4.0
suport 4-digit version (e.g. x.y.z.a)
0.3.0
drop python2.x support
bug fix, Add sort key function #14
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
node-semver-0.5.1.tar.gz
(10.9 kB
view details)
Built Distribution
File details
Details for the file node-semver-0.5.1.tar.gz
.
File metadata
- Download URL: node-semver-0.5.1.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b87e335179d874a3dd58041198b2715ae70fd20eba81683acde3553c51b28f8e |
|
MD5 | e7f6889affaae848033c0bf7ad38b9b8 |
|
BLAKE2b-256 | d8ed6333b216c45ddfade5f6391bcab32c8a7a3ba1dc821422fe7894fd7de6af |
File details
Details for the file node_semver-0.5.1-py3-none-any.whl
.
File metadata
- Download URL: node_semver-0.5.1-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 369561b405988f688ef688ea14f5de7f26a31d535d18cde0730c798948b1b67d |
|
MD5 | 439cdb64843f9a4309a818ff2471913a |
|
BLAKE2b-256 | 50c4f3865cb54589e82e07dc87b11e224edd7ce1c8c72cfad90925f3daa087b9 |