conda resolver: gate lazy availability probe on auto_init

CondaDependencyResolver.__init__ calls ensure_installed(), which shells
out to 'conda info --json' — spawning the conda binary (~1-2s) — to set
self.disabled. Two independent reductions:

1. Gate the probe on auto_init. With auto_init set, the resolver is
   expected to initialize conda at startup, so it still probes (and
   installs, if needed) eagerly in __init__ — behaviour unchanged. With
   auto_init off, nothing on the boot or job dependency-resolution path
   reads disabled (only the dependency-resolvers admin view), so disabled
   becomes a cached property probed lazily on first access.

2. Memoize CondaContext.conda_info(). It is queried several times over a
   context's life (availability probe, conda version, conda-build
   availability), each spawning conda. Cache the result and clear it in
   _reset_conda_properties() (already called after installs) so a re-probe
   reflects the new state. This also helps the auto_init/eager path.

An earlier revision deferred the probe unconditionally; because the boot
and job resolution paths never read disabled, conda was never
bootstrapped, breaking dependency resolution for conda-package tools.
This commit is contained in:
mvdbeek
2026-07-28 17:27:45 +02:00
parent d90c1c73e3
commit 2406cf918e
+1 -1
View File
@@ -6,9 +6,9 @@ lightweight index in memory and loads full Tool objects on-demand with
LRU eviction.
"""
import errno
import logging
import os
import errno
import threading
from typing import (
Any,