solve
#
The classic solver implementation.
Classes#
A high-level API to conda's solving logic. Three public methods are provided to access a |
|
Functions#
|
Find pinned specs from file and return a tuple of MatchSpec. |
|
- class Solver(prefix: str, channels: Iterable[conda.models.channel.Channel], subdirs: Iterable[str] = (), specs_to_add: Iterable[conda.models.match_spec.MatchSpec] = (), specs_to_remove: Iterable[conda.models.match_spec.MatchSpec] = (), repodata_fn: str = 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.
- Parameters:
prefix (str) -- The conda prefix / environment location for which the
Solver
is being instantiated.channels (Sequence[
Channel
]) -- A prioritized list of channels to use for the solution.subdirs (Sequence[str]) -- A prioritized list of subdirs to use for the solution.
specs_to_add (set[
MatchSpec
]) -- The set of package specs to add to the prefix.specs_to_remove (set[
MatchSpec
]) -- The set of package specs to remove from the prefix.
- 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:
deps_modifier (DepsModifier) -- See
solve_final_state()
.prune (bool) -- See
solve_final_state()
.ignore_pinned (bool) -- See
solve_final_state()
.force_remove (bool) -- See
solve_final_state()
.force_reinstall (bool) -- See
solve_for_diff()
.should_retry_solve (bool) -- See
solve_final_state()
.
- Return type:
- solve_for_diff(update_modifier=NULL, deps_modifier=NULL, prune=NULL, ignore_pinned=NULL, force_remove=NULL, force_reinstall=NULL, should_retry_solve=False) tuple[tuple[conda.models.records.PackageRecord, Ellipsis], tuple[conda.models.records.PackageRecord, Ellipsis]] #
Gives the package references to remove from an environment, followed by the package references to add to an environment.
- Parameters:
deps_modifier (DepsModifier) -- See
solve_final_state()
.prune (bool) -- See
solve_final_state()
.ignore_pinned (bool) -- See
solve_final_state()
.force_remove (bool) -- See
solve_final_state()
.force_reinstall (bool) --
- For requested specs_to_add that are already satisfied in the environment,
instructs the solver to remove the package and spec from the environment, and then add it back--possibly with the exact package instance modified, depending on the spec exactness.
should_retry_solve (bool) -- See
solve_final_state()
.
- 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:
- 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)#
- _init_solution_precs()#
- working_state_reset()#
- get_pinned_specs(prefix)#
Find pinned specs from file and return a tuple of MatchSpec.
- diff_for_unlink_link_precs(prefix, final_precs, specs_to_add=(), force_reinstall=NULL) tuple[tuple[conda.models.records.PackageRecord, Ellipsis], tuple[conda.models.records.PackageRecord, Ellipsis]] #