aea.configurations.pypi
This module contains a checker for PyPI version consistency.
and_
Do the and between two specifier sets.
is_
satisfiable
Check if the specifier set is satisfiable.
Satisfiable means that there exists a version number that satisfies all the constraints. It is worth noticing that it doesn't mean that that version number with that package actually exists.
from packaging.specifiers import SpecifierSet
The specifier set ">0.9, ==1.0" is satisfiable: the version number "1.0" satisfies the constraints
s1 = SpecifierSet(">0.9,==1.0") "1.0" in s1 True is_satisfiable(s1) True
The specifier set "==1.0, >1.1" is not satisfiable:
s1 = SpecifierSet("==1.0,>1.1") is_satisfiable(s1) False
For other details, please refer to PEP440:
https://www.python.org/dev/peps/pep-0440
Arguments:
specifier_set
: the specifier set.
Returns:
False if the constraints are surely non-satisfiable, True if we don't know.
is_
simple_
dep
Check if it is a simple dependency.
Namely, if it has no field specified, or only the 'version' field set.
Arguments:
dep
: the dependency
Returns:
whether it is a simple dependency or not
to_
set_
specifier
Get the set specifier. It assumes to be a simple dependency (see above).
merge_
dependencies
Merge two groups of dependencies.
If some of them are not "simple" (see above), and there is no risk of conflict because there is no other package with the same name, we leave them; otherwise we raise an error.
Arguments:
dep1
: the first operanddep2
: the second operand.
Returns:
the merged dependencies.
merge_
dependencies_
list
Merge a list of dependencies.
Arguments:
deps
: the list of dependencies
Returns:
the merged dependencies.