rez.resolver

class rez.resolver.SolverDict

Bases: TypedDict

status: ResolverStatus
graph: Any
solve_time: float | None
load_time: float | None
failure_description: str | None
variant_handles: list[dict[str, Any]]
ephemerals: list[str]
__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
clear()

Remove all items from the dict.

copy()

Return a shallow copy of the dict.

classmethod fromkeys(iterable, value=None, /)

Create a new dictionary with keys from iterable and values set to value.

get(key, default=None, /)

Return the value for key if key is in the dictionary, else default.

items()

Return a set-like object providing a view on the dict’s items.

keys()

Return a set-like object providing a view on the dict’s keys.

pop(k[, d]) v, remove specified key and return the corresponding value.

If the key is not found, return the default if given; otherwise, raise a KeyError.

popitem()

Remove and return a (key, value) pair as a 2-tuple.

Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.

setdefault(key, default=None, /)

Insert key with a value of default if key is not in the dictionary.

Return the value for key if key is in the dictionary, else default.

update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E is present and has a .keys() method, then does: for k in E.keys(): D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values()

Return an object providing a view on the dict’s values.

class rez.resolver.ResolverStatus

Bases: Enum

Enum to represent the current state of a resolver instance. The enum also includes a human readable description of what the state represents.

pending = ('The resolve has not yet started.',)
solved = ('The resolve has completed successfully.',)
failed = ('The resolve is not possible.',)
aborted = ('The resolve was stopped by the user (via callback).',)
__init__(description) None
class rez.resolver.Resolver

Bases: object

The package resolver.

The Resolver uses a combination of Solver(s) and cache(s) to resolve a package request as quickly as possible.

__init__(context: ResolvedContext, package_requests: list[Requirement], package_paths: list[str], package_filter: PackageFilterList | None = None, package_orderers: PackageOrderList | None = None, timestamp: int | None = 0, callback: Callable[[SolverState], tuple[SolverCallbackReturn, str]] | None = None, building: bool = False, testing: bool = False, verbosity: int = 0, buf: SupportsWrite | None = None, package_load_callback: Callable[[Package], Any] | None = None, caching: bool = True, suppress_passive: bool = False, print_stats: bool = False) None

Create a Resolver.

Parameters:
  • package_requests – List of Requirement objects representing the request.

  • package_paths – List of paths to search for pkgs.

  • package_filter (PackageFilterList) – Package filter.

  • package_orderers (list of PackageOrder) – Custom package ordering.

  • callback – See Solver.

  • package_load_callback – If not None, this callable will be called prior to each package being loaded. It is passed a single Package object.

  • building – True if we’re resolving for a build.

  • testing – True if we’re resolving for a rez (rez-test).

  • caching – If True, cache(s) may be used to speed the resolve. If False, caches will not be used.

  • print_stats (bool) – If true, print advanced solver stats at the end.

package_filter: PackageFilterList | None
resolved_packages_: list[Variant] | None
resolved_ephemerals_: list[Requirement] | None
failure_description: str | None
graph_: digraph | None
solve_time: float | None
load_time: float | None
solve() None

Perform the solve.

property status: ResolverStatus

Return the current status of the resolve.

Returns:

ResolverStatus.

property resolved_packages: list[Variant] | None

Get the list of resolved packages.

Returns:

List of Variant objects, or None if the resolve has not completed.

property resolved_ephemerals: list[Requirement] | None

Get the list of resolved ephemerals.

Returns:

List of Requirement objects, or None if the resolve has not completed.

property graph: digraph | None

Return the resolve graph.

The resolve graph shows unsuccessful as well as successful resolves.

Returns:

A pygraph.digraph object, or None if the solve has not completed.