requirementslib.models.resolvers module

class requirementslib.models.resolvers.DependencyResolver(pinned_deps=NOTHING, dep_dict=NOTHING, candidate_dict=NOTHING, pin_history=NOTHING, allow_prereleases=False, hashes=NOTHING, hash_cache=NOTHING, finder=None, include_incompatible_hashes=True, available_candidates_cache=NOTHING)[source]

Bases: object

add_abstract_dep(dep)[source]

Add an abstract dependency by either creating a new entry or merging with an old one.

Parameters:dep (AbstractDependency) – An abstract dependency to add
Raises:ResolutionError – Raised when the given dependency is not compatible with an existing abstract dependency.
allow_all_wheels()[source]

Monkey patches pip.Wheel to allow wheels from all platforms and Python versions.

This also saves the candidate cache and set a new one, or else the results from the previous non-patched calls will interfere.

allow_prereleases = None

Whether to allow prerelease dependencies

candidate_dict = None

A dictionary of sets of version numbers that are valid for a candidate currently

classmethod create(finder=None, allow_prereleases=False, get_all_hashes=True)[source]
dep_dict = None

A dictionary of abstract dependencies by name

dependencies
finder = None

A finder for searching the index

get_hashes()[source]
get_hashes_for_one(ireq)[source]
hash_cache = None

A hash cache

hashes = None

Stores hashes for each dependency

include_incompatible_hashes = None

Whether to include hashes even from incompatible wheels

pin_deps()[source]

Pins the current abstract dependencies and adds them to the history dict.

Adds any new dependencies to the abstract dependencies already present by merging them together to form new, compatible abstract dependencies.

pin_history = None

A historical record of pins

resolution
resolve(root_nodes, max_rounds=20)[source]

Resolves dependencies using a backtracking resolver and multiple endpoints.

Note: this resolver caches aggressively. Runs for max_rounds or until any two pinning rounds yield the same outcome.

Parameters:
  • root_nodes (list[Requirement]) – A list of the root requirements.
  • max_rounds – The max number of resolution rounds, defaults to 20
  • max_rounds – int, optional
Raises:

RuntimeError – Raised when max rounds is exceeded without a resolution.

exception requirementslib.models.resolvers.ResolutionError[source]

Bases: Exception