Open jjerphan opened 3 months ago
The general plan seems legit broadly speaking.
Database
, we could use a base class as you suggested, or try and isolate the parts specific to libsolv
in a specific class to use inside Database
(because resolvo
's API could be very different) but at least Database
is already connected to the rest of mamba
and hopefully we won't need to change much.mamba::solver::libsolv
to mamba::solver
, we may want to leave it as it is and try in the same way to isolate what's related to libsolv
and what would be common with resolvo
.
Unsolvable
for example seems to be tightly linked with libsolv
internals so that would be a class specific to libsolv
and we should maybe wrap it into another one alongside something else for resolvo
(we may need to define its API first to know what to do, I don't know if that work has been done yet).
So maybe just a renaming would be enough to make it clear it's libsolv
specific, or actually keep the same names and just have two namespaces libsolv
and resolvo
repo_info
parameters
seem general enough, but maybe some classes/structs are specific to libsolv
(no equivalent in resolvo
, semantically speaking)Database::add_repo_from_packages
? It seems ok to meRegarding the Database, we could use a base class as you suggested, or try and isolate the parts specific to libsolv in a specific class to use inside Database (because resolvo's API could be very different) but at least Database is already connected to the rest of mamba and hopefully we won't need to change much.
I should have mentioned that resolvo's public API exposes a DependencyProvider
(similar to a Database
) and a Solver
. Based on the initial POC, I am quite confident that we could have similar abstractions for resolvo.
Most of the design points are mostly based on the assumption that introducing bases classes is the right pathway and that the current other abstractions than Database
and Solver
can be decoupled from libsolv
, but we need to validate that this is the right approach (I am pretty sure there are other designs which would avoid having a set of base classes and solver-specific sets of concrete classes).
Edit: For alternatives, I wonder whether template classes with a common template type parameter for the solver could help.
The overall plan looks good, I have some minor concerns, partially because I don't know very well this part of mamba (so some of my concerns might be irrelevant or redundant):
RepoInfo
Resolvo
exposes a DependencyProvider
, which can be implemented to have something close to a DataBase
but the RepoInfo
isn't actually totally decoupled. My intuition is that it will be decoupleable.
Context
libsolv
has been used since the creation ofmamba
.While
libsolv
is a fundamental dependency oflibmamba
, its maintenance comes with challenges for mamba but also for conda-forge generally (for instance, see https://github.com/conda-forge/libsolv-feedstock/issues/92 and https://github.com/conda-forge/openmpi-feedstock/issues/153).Proposed solution
mamba-org/resolvo
which, from a socio-technical perspective, seems to be the most relevant candidate.Based on a POC, which shows that resolvo have more or less the same performance as libsolv.
Proposed plan
Architecture redesign: inheriting classes
Motivation:
Solver
andDataBase
are exposed to Python thanks topybind11
std::variant
butpybind11
does not work properly withstd::variant
unfortunatelypybind11
correctly handles inheritanceSchematically, currently we have:
Then we would have:
In this order:
mamba::solver::libsolv
tomamba::solver
, namely:libmambapy
, this will introduce new imports paths but the current python import paths must work but be deprecatedsolver::{Solver,DataBase}
base classessolver::DataBase
solver::libsolv::{Solver,DataBase}
classes accordinglylibmamba
's internals so that they usesolver::{Solver,DataBase}
(micro)mamba
's internals (especially the install codepath first)solver::resolvo::{Solver,DataBase}
classessolver::resolvo::DataBase
class (WIP injjerphan/mamba:alt-solver
branch)mamba::solver::Solution
solver::resolvo::Solver
classlibmambapy.bindings.solver.resolvo.{Solver,DataBase}
libmambapy.bindings.solver.{Solver,DataBase}
and expose an option to select "libsolv" or "resolvo"libmamba
andlibmambapy
public APIs, especially changes in UX and deprecated import pathsAlternative solver
decide
function; several different non-exclusive options exist:jjerphan/resolvo:mvsids
)