Version parsing and comparing
Version parsing and comparing
(arbitrary-eq a b)
Return true if string representation of version a equal to b See more: https://www.python.org/dev/peps/pep-0440/#arbitrary-equality
Return true if string representation of version a equal to b See more: https://www.python.org/dev/peps/pep-0440/#arbitrary-equality
(compare-letter-version a b)
Compare vectors of [name version] shape with possible fallbacks to +/- Inf NB! Comparator will break if assumed shape of vectors is violated
Compare vectors of [name version] shape with possible fallbacks to +/- Inf NB! Comparator will break if assumed shape of vectors is violated
(compare-version a b)
Compare version maps
Compare version maps
(compatible a b)
Return true if version a is compatible with b Compatible releases have an equivalent combination of >= and ==. That is that ~=2.2 is equivalent to >=2.2,==2.*. See more: https://www.python.org/dev/peps/pep-0440/#compatible-release
Return true if version a is compatible with b Compatible releases have an equivalent combination of >= and ==. That is that ~=2.2 is equivalent to >=2.2,==2.*. See more: https://www.python.org/dev/peps/pep-0440/#compatible-release
(eq a b)
Return true if versions a and b are equal
Return true if versions a and b are equal
(filter-versions specifiers versions & {:keys [pre] :or {pre true}})
Return lazy seq of parsed versions that satisfy specifiers
Return lazy seq of parsed versions that satisfy specifiers
(ge a b)
Return true if version a greater than or equal to b
Return true if version a greater than or equal to b
(get-comparable-version version-map)
Get parsed version map formatted to be comparable See more details in pypa/packaging: https://github.com/pypa/packaging/blob/20.8/packaging/version.py#L505
Get parsed version map formatted to be comparable See more details in pypa/packaging: https://github.com/pypa/packaging/blob/20.8/packaging/version.py#L505
(get-comparison-op op)
Get comparison function for operator string
Get comparison function for operator string
Get Python distribution version based on the format
The following formats are supported
Source distibution (sdist) https://packaging.python.org/en/latest/specifications/source-distribution-format/ sdist version parsing relies on packages to comply with PEP-625 https://peps.python.org/pep-0625/
Binary distribution (wheel) https://packaging.python.org/en/latest/specifications/binary-distribution-format/ wheel version parsing relies on packages to comply with PEP-427 https://peps.python.org/pep-0427/
Not supported formats:
Get Python distribution version based on the format The following formats are supported - Source distibution (sdist) https://packaging.python.org/en/latest/specifications/source-distribution-format/ sdist version parsing relies on packages to comply with PEP-625 https://peps.python.org/pep-0625/ - Binary distribution (wheel) https://packaging.python.org/en/latest/specifications/binary-distribution-format/ wheel version parsing relies on packages to comply with PEP-427 https://peps.python.org/pep-0427/ Not supported formats: - Built distribution (bdist) - legacy https://docs.python.org/3/distutils/builtdist.html
(get-version specifiers versions & {:keys [pre] :or {pre true}})
Get the most recent version from given versions that satisfies specifiers
Get the most recent version from given versions that satisfies specifiers
(gt a b)
Return true if version a greater than b
Return true if version a greater than b
(le a b)
Return true if version a less than or equal to b
Return true if version a less than or equal to b
(lt a b)
Return true if version a less than b
Return true if version a less than b
(neq a b)
Return true if versions a and b are not equal
Return true if versions a and b are not equal
(normalize-project project)
Normalize project name
Normalize project name
(pad-vector vec-val len pad-val)
Append padding values to a given vector to make it of the specified len Used to compare vectors of numbers
Append padding values to a given vector to make it of the specified len Used to compare vectors of numbers
(parse-letter-version letter number)
Parse letter part of version
Parse letter part of version
(parse-local-version local)
Parse strings into vec with string parsed into ints if possible
Parse strings into vec with string parsed into ints if possible
(parse-number number)
Parse number string into integer or return 0
Parse number string into integer or return 0
(parse-specifier specifier-str)
Parse single specifier string into a vec of operator function and version map. E.g. '>=1.2.3 parsed into [parsed-op parsed-version]
Parse single specifier string into a vec of operator function and version map. E.g. '>=1.2.3 parsed into [parsed-op parsed-version]
(parse-specifiers specifiers-str)
Parse a string of specifiers into a vec of parsed specifier vecs/ E.g. '>=1.2.3,<2' parsed into [[>=' 1.2.3'] [<' 2']]
Parse a string of specifiers into a vec of parsed specifier vecs/ E.g. '>=1.2.3,<2' parsed into [[>=' 1.2.3'] [<' 2']]
(parse-version version-str)
Return a hash-map of regex groups
Return a hash-map of regex groups
(same-release-with-post-or-local? a b)
Check if version to be excluded from >V comparison as per https://www.python.org/dev/peps/pep-0440/#exclusive-ordered-comparison
Check if version to be excluded from >V comparison as per https://www.python.org/dev/peps/pep-0440/#exclusive-ordered-comparison
(same-release-with-pre-or-local? a b)
Check if version to be excluded from <V comparison as per https://www.python.org/dev/peps/pep-0440/#exclusive-ordered-comparison
Check if version to be excluded from <V comparison as per https://www.python.org/dev/peps/pep-0440/#exclusive-ordered-comparison
(sort-versions versions & {:keys [order] :or {order :asc}})
Sort a vector of parsed versions. Ascending sort order is used by default.
Sort a vector of parsed versions. Ascending sort order is used by default.
(trim-filename-version filename project)
Remove project name and file extension from distribution filename
Expected output format depends on the distribution type:
{version}(-{build tag})?-{python tag}-{abi tag}-{platform tag}
Remove project name and file extension from distribution filename Expected output format depends on the distribution type: - sdist: `{version} - wheel: `{version}(-{build tag})?-{python tag}-{abi tag}-{platform tag}`
(truncate-release release)
Return release vector with trailing zero parts dropped
Return release vector with trailing zero parts dropped
(version-ok? specifiers version)
Return true if a parsed version satisfies each specifier Specifiers is a collection of vec [specifier-op specifier-version]
Return true if a parsed version satisfies each specifier Specifiers is a collection of vec [specifier-op specifier-version]
(version-stable? version)
Return true if version is neither pre-release or development version
Return true if version is neither pre-release or development version
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close