macro128 / pdm-conda

A PDM plugin to resolve/install/uninstall project dependencies with Conda
33 stars 1 forks source link

[Feature] - Add support for the --sovler option. #6

Closed swainn closed 1 year ago

swainn commented 1 year ago

I'd like to use pdm-conda with the libmamba solver (https://www.anaconda.com/blog/a-faster-conda-for-a-growing-community).

This is normally done by installing libmamba and then adding the --solver libmamba option to the install command like so:

conda install -n base conda-libmamba-solver
conda config install --solver libmamba <some-package>

I think the ideal would be if the solver option could be specified in the pyproject.toml:

[tool.pdm.conda]
runner = "micromamba"
solver = "libmamba"
macro128 commented 1 year ago

Hi! Right now pdm-conda uses pdm solver and Conda to fetch candidates and install/remove packages, using Conda and libmamba as solvers would imply calling conda install each time pdm's solver breaks a dependency from the last conda solved env and could be really slow. In my tests pdm solver + Conda for fetching candidates ends up with the same solved packages as conda solver almost all the time, that said, I think adding conda/libmamba solver to pdm-conda shoudn't be so difficult so I'll try to do it :).

swainn commented 1 year ago

@marco128 that makes sense. For some reason I was thinking that pdm-conda was using the conda solver (which can be agonizingly slow). Thank you for the clarification. The pdm solver is probably preferable, especially if it gives similar results. If you do end up implementing support, definitely include support for libmamba, which is much more efficient than the classic conda solver.

macro128 commented 1 year ago

@swainn v0.9.0 adds support to conda solver (now pdm-conda always uses it to solve conda managed requirements). By default it uses classic solver but you can change it to libmamba with conf solver (as your example).

swainn commented 1 year ago

Great! Thank you.