mamba-org / mamba

The Fast Cross-Platform Package Manager
https://mamba.readthedocs.io
BSD 3-Clause "New" or "Revised" License
6.53k stars 342 forks source link

libmambapy: use `Context` explicitly #3309

Closed Klaim closed 3 weeks ago

Klaim commented 1 month ago

In libmambapy:

import time
from libmambapy import Context, ContextOptions

# if we want the default behavior (with signal handling from mamba):
mamba_context = Context()

# OR if we do not want signal handling from context:
mamba_context = Context(ContextOptions(enable_logging_and_signal_handling = False))
Klaim commented 1 month ago

Last issues:

JohanMabille commented 3 weeks ago

but_why_jacky_chan

Klaim commented 3 weeks ago

but_why_jacky_chan

Yeah the ci issue is definitely not related to this PR but not sure if it's a good idea to merge.

Hind-M commented 3 weeks ago

I opened another PR to reproduce the issue again on the CI (after adding some log), but couldn't get it to fail for now. I re-ran the failed job here, let's see if it succeeds this time (if so I suggest that we move forward and merge if this is ready...)

Klaim commented 2 weeks ago

@JohanMabille

Do we have a mean to guarantee that? If so this can be done in a future PR.

Sorry I didnt see that comment before. Answer is yes it's already enforced but only at runtime: we throw an exception when a Context is created from libmambapy while there is already one instance alive, see https://github.com/mamba-org/mamba/pull/3309/files#diff-b06477fac9b8a278eaf243edbc7dc3c91c14bfde8db0b974ecd6c5e1edf44f8dR676