tauopt.engine.strategies.registry#

Strategy registry: name -> lazily-imported singleton.

Registry-dicts only – deliberately no plugin framework. Lazy import is load-bearing: the registry module itself must import under the featherweight install (pin P3); math deps load only when a strategy is used.

Module Contents#

Functions#

register

Register a custom strategy instance under strategy.name (overrides allowed – that is the research seam: swap a builtin for an experimental variant locally).

get

Return the strategy singleton for name, importing a built-in’s module on first use (registered instances take precedence over built-ins). Raises KeyError for unknown names.

known

All strategy names (built-ins plus registered instances), installed or not.

accepted_params

The params keys name reads: a registered instance’s own accepted_params when it declares one, the local mirror for a built-in (no math imports, pin P3), and None when nothing is declared – an unknown name, or a custom strategy whose keys are its own – so the ask boundary checks nothing for it.

reader

The read_params the ask boundary runs for name’s VALUES, or None when nothing checks (an unknown name, or a strategy without read_params): a registered instance’s own method; for a built-in, the method of an UNCACHED instance – no _instances write, so is_available stays truthful and the ladder still skips a rung whose extra is missing. The built-in GP modules import no math at import time (their torch/botorch imports are lazy, pin P3), so the boundary’s check runs on every install, the featherweight one included (the round-1 fold F2 of the params-values lane: the install carve-out skipped a check the reader could run).

extra_installed

True when every probe module for the install extra (“local”, “botorch”) is importable; False for unknown extras. Checks via find_spec, so nothing actually imports (pin P3).

is_available

True when name can serve suggestions here: registered instances always; built-ins when every required extra is installed (resolved from a local mirror of each class’s requires so no math deps import, pin P3); unknown names never.

available

The subset of known() usable in this environment.

API#

tauopt.engine.strategies.registry.register(strategy: tauopt.engine.strategies.base.Strategy) → None#

Register a custom strategy instance under strategy.name (overrides allowed – that is the research seam: swap a builtin for an experimental variant locally).

tauopt.engine.strategies.registry.get(name: str) → tauopt.engine.strategies.base.Strategy#

Return the strategy singleton for name, importing a built-in’s module on first use (registered instances take precedence over built-ins). Raises KeyError for unknown names.

tauopt.engine.strategies.registry.known() → set[str]#

All strategy names (built-ins plus registered instances), installed or not.

tauopt.engine.strategies.registry.accepted_params(name: str) → frozenset[str] | None#

The params keys name reads: a registered instance’s own accepted_params when it declares one, the local mirror for a built-in (no math imports, pin P3), and None when nothing is declared – an unknown name, or a custom strategy whose keys are its own – so the ask boundary checks nothing for it.

tauopt.engine.strategies.registry.reader(name: str)#

The read_params the ask boundary runs for name’s VALUES, or None when nothing checks (an unknown name, or a strategy without read_params): a registered instance’s own method; for a built-in, the method of an UNCACHED instance – no _instances write, so is_available stays truthful and the ladder still skips a rung whose extra is missing. The built-in GP modules import no math at import time (their torch/botorch imports are lazy, pin P3), so the boundary’s check runs on every install, the featherweight one included (the round-1 fold F2 of the params-values lane: the install carve-out skipped a check the reader could run).

tauopt.engine.strategies.registry.extra_installed(extra: str) → bool#

True when every probe module for the install extra (“local”, “botorch”) is importable; False for unknown extras. Checks via find_spec, so nothing actually imports (pin P3).

tauopt.engine.strategies.registry.is_available(name: str) → bool#

True when name can serve suggestions here: registered instances always; built-ins when every required extra is installed (resolved from a local mirror of each class’s requires so no math deps import, pin P3); unknown names never.

tauopt.engine.strategies.registry.available() → set[str]#

The subset of known() usable in this environment.