rez.solver
The dependency resolving module.
This gives direct access to the solver. You should use the resolve() function in resolve.py instead, which will use cached data where possible to provide you with a faster resolve.
See SOLVER.md for an in-depth description of how this module works.
- class rez.solver.Cycle(packages)[source]
Bases:
rez.solver.FailureReasonThe solve contains a cyclic dependency.
- class rez.solver.DependencyConflict(dependency, conflicting_request)[source]
Bases:
rez.solver._CommonA common dependency shared by all variants in a scope, conflicted with another scope in the current phase.
- class rez.solver.DependencyConflicts(conflicts)[source]
Bases:
rez.solver.FailureReasonA common dependency in a scope conflicted with another scope in the current phase.
- class rez.solver.PackageVariant(variant, building)[source]
Bases:
rez.solver._CommonA variant of a package.
- property conflict_request_fams
- property handle
- property index
- property name
- property request_fams
- requires_list
Simple property caching descriptor.
Example
>>> class Foo(object): >>> @cached_property >>> def bah(self): >>> print('bah') >>> return 1 >>> >>> f = Foo() >>> f.bah bah 1 >>> f.bah 1
- property version
- class rez.solver.Reduction(name, version, variant_index, dependency, conflicting_request)[source]
Bases:
rez.solver._CommonA variant was removed because its dependencies conflicted with another scope in the current phase.
- class rez.solver.Solver(package_requests, package_paths, context=None, package_filter=None, package_orderers=None, callback=None, building=False, optimised=True, verbosity=0, buf=None, package_load_callback=None, prune_unfailed=True, suppress_passive=False, print_stats=False)[source]
Bases:
rez.solver._CommonSolver.
A package solver takes a list of package requests (the ‘request’), then runs a resolve algorithm in order to determine the ‘resolve’ - the list of non-conflicting packages that include all dependencies.
- property cyclic_fail
Return True if the solve failed due to a cycle, False otherwise.
- failure_description(failure_index=None)[source]
Get a description of the failure.
This differs from failure_reason - in some cases, such as when a callback forces a failure, there is more information in the description than there is from failure_reason.
- failure_packages(failure_index=None)[source]
Get packages involved in a failure.
- Parameters
failure_index – See failure_reason.
- Returns
A list of Requirement objects.
- failure_reason(failure_index=None)[source]
Get the reason for a failure.
- Parameters
failure_index –
Index of the fail to return the graph for (can be negative). If None, the most appropriate failure is chosen according to these rules: - If the fail is cyclic, the most recent fail (the one containing
the cycle) is used;
If a callback has caused a failure, the most recent fail is used;
Otherwise, the first fail is used.
- Returns
A FailureReason subclass instance describing the failure.
- get_fail_graph(failure_index=None)[source]
Returns a graph showing a solve failure.
- Parameters
failure_index – See failure_reason
- Returns
A pygraph.digraph object.
- get_graph()[source]
Returns the most recent solve graph.
This gives a graph showing the latest state of the solve. The specific graph returned depends on the solve status. When status is: unsolved: latest unsolved graph is returned; solved: final solved graph is returned; failed: most appropriate failure graph is returned (see failure_reason); cyclic: last failure is returned (contains cycle).
- Returns
A pygraph.digraph object.
- max_verbosity = 3
- property num_fails
Return the number of failed solve steps that have been executed. Note that num_solves is inclusive of failures.
- property num_solves
Return the number of solve steps that have been executed.
- property resolved_ephemerals
Return the list of final ephemeral package ranges.
Note that conflict ephemerals are not included.
- Returns
Final non-conflict ephemerals, or None if the resolve did not complete or was unsuccessful.
- Return type
List of Requirement
- property resolved_packages
Return a list of resolved variants.
- Returns
Resolved variants, or None if the resolve did not complete or was unsuccessful.
- Return type
list of PackageVariant
- property solve_stats
- property status
Return the current status of the solve.
- Returns
Enum representation of the state of the solver.
- Return type
- class rez.solver.SolverCallbackReturn(value, names=None, module=None, type=None)[source]
Bases:
rez.vendor.enum.EnumEnum returned by the callback callable passed to a Solver instance.
- class rez.solver.SolverState(num_solves, num_fails, phase)[source]
Bases:
objectRepresent the current state of the solver instance for use with a callback.
- class rez.solver.SolverStatus(value, names=None, module=None, type=None)[source]
Bases:
rez.vendor.enum.EnumEnum to represent the current state of a solver instance. The enum also includes a human readable description of what the state represents.
- class rez.solver.TotalReduction(reductions)[source]
Bases:
rez.solver.FailureReasonAll of a scope’s variants were reduced away.