def check_dependency(
req_string: str, ancestral_req_strings: tuple[str, ...] = (), parent_extras: Set[str] = frozenset()
) -> Iterator[tuple[str, ...]]: """
Verify that a dependency and all of its dependencies are met.
# ``Requirement`` doesn't implement ``__eq__`` so we cannot compare reqs for # equality directly but the string representation is stable. if normalised_req_string in ancestral_req_strings: # cyclical dependency, already checked. return
if req.marker:
extras = frozenset(('',)).union(parent_extras) # a requirement can have multiple extras but ``evaluate`` can # only check one at a time. if all(not req.marker.evaluate(environment={'extra': e}) for e in extras): # if the marker conditions are not met, we pretend that the # dependency is satisfied. return
try:
dist = importlib.metadata.distribution(req.name) except importlib.metadata.PackageNotFoundError: # dependency is not installed in the environment. yield (*ancestral_req_strings, normalised_req_string) else: if req.specifier andnot req.specifier.contains(dist.version, prereleases=True): # the installed version is incompatible. yield (*ancestral_req_strings, normalised_req_string) elif dist.requires: for other_req_string in dist.requires: # yields transitive dependencies that are not satisfied. yieldfrom check_dependency(other_req_string, (*ancestral_req_strings, normalised_req_string), req.extras)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.