Solvers

The conda solvers can be extended with additional backends with the conda_solvers plugin hook. Registered solvers will be available for configuration with the solver configuration and --solver command line option.

class CondaSolver(name: str, backend: type[Solver])

A conda solver.

Parameters
  • name -- Solver name (e.g., custom-solver).

  • backend -- Type that will be instantiated as the solver backend.

backend: type[conda.core.solve.Solver]

Alias for field number 1

name: str

Alias for field number 0

conda_solvers(self) collections.abc.Iterable[conda.plugins.types.CondaSolver]

Register solvers in conda.

Returns

An iterable of solvers entries.

Example:

import logging

from conda import plugins
from conda.core import solve


log = logging.getLogger(__name__)


class VerboseSolver(solve.Solver):
    def solve_final_state(self, *args, **kwargs):
        log.info("My verbose solver!")
        return super().solve_final_state(*args, **kwargs)


@plugins.hookimpl
def conda_solvers():
    yield plugins.CondaSolver(
        name="verbose-classic",
        backend=VerboseSolver,
    )