pep440
lib.pep440.parseVersion
Type: parseVersion :: string -> AttrSet
Parse a version according to PEP-440.
version
: Function argument
::: {.example #function-library-example-lib.pep440.parseVersion}
lib.pep440.parseVersion
usage example
# parseVersion "3.0.0rc1"
{
dev = null;
epoch = 0;
local = null;
post = null;
pre = {
type = "rc";
value = 1;
};
release = [ 3 0 0 ];
}
:::
lib.pep440.parseVersionCond
Type: parseVersionCond :: string -> AttrSet
Parse a version conditional.
cond
: Function argument
::: {.example #function-library-example-lib.pep440.parseVersionCond}
lib.pep440.parseVersionCond
usage example
# parseVersionCond ">=3.0.0rc1"
{
op = ">=";
version = {
dev = null;
epoch = 0;
local = null;
post = null;
pre = {
type = "rc";
value = 1;
};
release = [ 3 0 0 ];
};
}
:::
lib.pep440.parseVersionConds
Type: parseVersionConds :: string -> [AttrSet]
Parse a list of version conditionals separated by commas.
conds
: Function argument
::: {.example #function-library-example-lib.pep440.parseVersionConds}
lib.pep440.parseVersionConds
usage example
# parseVersionConds ">=3.0.0rc1,<=4.0"
[
{
op = ">=";
version = {
dev = null;
epoch = 0;
local = null;
post = null;
pre = {
type = "rc";
value = 1;
};
release = [ 3 0 0 ];
};
}
{
op = "<=";
version = {
dev = null;
epoch = 0;
local = null;
post = null;
pre = null;
release = [ 4 0 ];
};
}
]
:::
lib.pep440.compareVersions
Type: compareVersions :: AttrSet -> AttrSet -> int
Compare two versions as parsed by parseVersion
according to PEP-440.
Returns:
- -1 for less than
- 0 for equality
- 1 for greater than
a
: Function argument
b
: Function argument
::: {.example #function-library-example-lib.pep440.compareVersions}
lib.pep440.compareVersions
usage example
# compareVersions (parseVersion "3.0.0") (parseVersion "3.0.0")
0
:::
lib.pep440.comparators
Type: operators.${operator} :: AttrSet -> AttrSet -> bool
Map comparison operators as strings to a comparator function.
Attributes:
- Compatible release clause:
~=
- Version matching clause:
==
- Version exclusion clause:
!=
- Inclusive ordered comparison clause:
<=
,>=
- Exclusive ordered comparison clause:
<
,>
- Arbitrary equality clause:
===
::: {.example #function-library-example-lib.pep440.comparators}
lib.pep440.comparators
usage example
# comparators."==" (parseVersion "3.0.0") (parseVersion "3.0.0")
true
:::