Provides a semver specifier to represent version constraints compatible with `packaging`.
Project description
slap.core.semver
A semver version constraint specifier compatible with packaging
.
Usage
from slap.core.semver.specifier import SemverSpecifier
spec = SemverSpecifier('1.x')
assert str(spec.version_selector.canonical) == "^1.0.0"
assert spec.contains("1.2.3")
assert not spec.contains("0.3.0")
The SemverSpecifier
constructor will raise packaging.specifier.InvalidSpecifier
if the
specifier string cannot be parsed.
Behaviour
The version ranges supported by SemverSpecifier
are inspired by NPM. Below is a table to
illustrate the behaviour:
Release | Example |
---|---|
Patch release | 1.0 , 1.0.x , ~1.0.4 |
Minor release | 1.0 , 1.x , ^1.0.4 |
Major release | * or x |
Other | x.0.4 |
In addition to the NPM semver version ranges, Python version epochs, pre releases, post releases,
dev releases and local versions are supported. To list some examples: 2!^1.0.4
, ~1.0.3.post1
,
^1.0.4.dev1+gdeadbeef
.
Note: The remainder fields are not supported in the
x
placeholder format.
Compatibility
Requires Python 3.6 or higher.
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 slap.core.semver-0.1.0dev1.tar.gz
.
File metadata
- Download URL: slap.core.semver-0.1.0dev1.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb9485db355e660d9f52779362b69253504ea66bf7aba725dfcdee32472317cc |
|
MD5 | 0a97d78c1d09f90f178e7489c3a22ca0 |
|
BLAKE2b-256 | 3f8faa3e8353d7a8e857ff5fe0aeca5d71bfb1d3fccdcd486aa6f201d5ccf54c |
File details
Details for the file slap.core.semver-0.1.0dev1-py3-none-any.whl
.
File metadata
- Download URL: slap.core.semver-0.1.0dev1-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | db1df637d739088746e113f9d624f903d4a5a5986ab8cef58284ae78c95a440b |
|
MD5 | 593a848e6c21df82e5cd06e027a262de |
|
BLAKE2b-256 | 15f55da2d550f9ccccbaad1804bd2a88daefa31971404af377aef9be409092c7 |