solve

The classic solver implementation.

Classes

Solver

A high-level API to conda's solving logic. Three public methods are provided to access a

SolverStateContainer

Functions

_get_solver_class([key])

Load the correct solver backend.

get_pinned_specs(prefix)

Find pinned specs from file and return a tuple of MatchSpec.

diff_for_unlink_link_precs(prefix, final_precs[, ...])

_get_solver_class(key=None)

Load the correct solver backend.

See context.solver for more details.

class Solver(prefix, channels, subdirs=(), specs_to_add=(), specs_to_remove=(), repodata_fn=REPODATA_FN, command=NULL)

A high-level API to conda's solving logic. Three public methods are provided to access a solution in various forms.

solve_for_transaction(update_modifier=NULL, deps_modifier=NULL, prune=NULL, ignore_pinned=NULL, force_remove=NULL, force_reinstall=NULL, should_retry_solve=False)

Gives an UnlinkLinkTransaction instance that can be used to execute the solution on an environment.

Parameters
Returns

Return type

UnlinkLinkTransaction

solve_for_diff(update_modifier=NULL, deps_modifier=NULL, prune=NULL, ignore_pinned=NULL, force_remove=NULL, force_reinstall=NULL, should_retry_solve=False)

Gives the package references to remove from an environment, followed by the package references to add to an environment.

Parameters
Returns

A two-tuple of PackageRef sequences. The first is the group of packages to remove from the environment, in sorted dependency order from leaves to roots. The second is the group of packages to add to the environment, in sorted dependency order from roots to leaves.

Return type

tuple[PackageRef], tuple[PackageRef]

solve_final_state(update_modifier=NULL, deps_modifier=NULL, prune=NULL, ignore_pinned=NULL, force_remove=NULL, should_retry_solve=False)

Gives the final, solved state of the environment.

Parameters
  • update_modifier (UpdateModifier) -- An optional flag directing how updates are handled regarding packages already existing in the environment.

  • deps_modifier (DepsModifier) -- An optional flag indicating special solver handling for dependencies. The default solver behavior is to be as conservative as possible with dependency updates (in the case the dependency already exists in the environment), while still ensuring all dependencies are satisfied. Options include * NO_DEPS * ONLY_DEPS * UPDATE_DEPS * UPDATE_DEPS_ONLY_DEPS * FREEZE_INSTALLED

  • prune (bool) -- If True, the solution will not contain packages that were previously brought into the environment as dependencies but are no longer required as dependencies and are not user-requested.

  • ignore_pinned (bool) -- If True, the solution will ignore pinned package configuration for the prefix.

  • force_remove (bool) -- Forces removal of a package without removing packages that depend on it.

  • should_retry_solve (bool) -- Indicates whether this solve will be retried. This allows us to control whether to call find_conflicts (slow) in ssc.r.solve

Returns

In sorted dependency order from roots to leaves, the package references for the solved state of the environment.

Return type

tuple[PackageRef]

determine_constricting_specs(spec, solution_precs)
get_request_package_in_solution(solution_precs, specs_map)
get_constrained_packages(pre_packages, post_packages, index_keys)
_collect_all_metadata(ssc)
_remove_specs(ssc)
_find_inconsistent_packages(ssc)
_package_has_updates(ssc, spec, installed_pool)
_should_freeze(ssc, target_prec, conflict_specs, explicit_pool, installed_pool)
_add_specs(ssc)
_run_sat(ssc)
_post_sat_handling(ssc)
_notify_conda_outdated(link_precs)
_prepare(prepared_specs)
class SolverStateContainer(prefix, update_modifier, deps_modifier, prune, ignore_pinned, force_remove, should_retry_solve)
prefix_data()
specs_from_history_map()
track_features_specs()
pinned_specs()
set_repository_metadata(index, r)
working_state_reset()
get_pinned_specs(prefix)

Find pinned specs from file and return a tuple of MatchSpec.