-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add Repo.set_channel() #2352
add Repo.set_channel() #2352
Conversation
This seems to fix the issue I was seeing in conda/conda-libmamba-solver#65! |
Looks good to me! |
Hey, sorry for the late review. Would you consider binding the constructor used by SubdirData instead of adding a setter for the channel? I think it makes more sense to fully initialize an object within its constructor rather than partially initiliaze it in the constructor and later call a setter to finish the job. Also, there is a chance that we change the API of the constructor accepting strings only (or even that we remove it), since it does not fully initialize the repo object. |
Makes sense! I can give it a try; thanks for the review @JohanMabille. That said, that means we also need to expose MRepo::MRepo(MPool& pool, const std::string& name, const std::string& index, const std::string& url)
: m_url(url)
{
m_repo = repo_create(pool, name.c_str());
m_repo->appdata = this;
read_file(index);
// not true C++, just me making it up
const Channel channel = Channel(url);
p_channel = &channel;
} |
@jaimergp I'm working on changes that will make possible to use a |
Hi! Yes, that's exactly the use case we are after. We are directly instantiating Repo and Solver, but in that API the channel info is missing. Hence this PR. |
What is you timeline? We're about to to a Mamba release so we could try to get this one in. Otherwise the larger refactoring will be in another release where we will also break libmamba API (maybe a couple months). |
Ideally we can get this one in now 🙏 |
maybe we can make a quikc follow up release? cc @JohanMabille @AntoinePrv |
Closing this one in favor of #2398 which is definitely simpler and safer. |
I am trying to use
libmambapy
with already downloaded repodatas fromconda
side. I just wantlibmamba
to load a given JSON for a given channel.I've tried setting
context.offline = True
and other tricks soSubdirData
finds the downloaded JSON just fine, but there's some disagreement in how caching works right now, and actually at that point we already know that there's no download needed, and I have the direct path anyway.As a result, I am trying to load it use
libmamba.Repo
directly, but the Python-exposed constructors differ from the onesSubdirData
is using.SubdirData
uses the constructor that relies on theRepoMetadata
helper. But this is not exposed in the Python bindings.p_channel
. (Check what happens afterread_file(index)
.I am assuming this is the reason why I can't use
api.Repo
directly with channel containingMatchSpec
likeconda-forge::python
:libsolv
will say "unsupported request" for these!So if I can set a channel separately, then things should work. This PR adds a couple bindings in
libmambapy
, hoping that's it :D