Registry¶
The registry maps short keys to BLADE’s built-in components, so they can be looked up by name (for example from a configuration file) without importing every optional dependency up front.
from iohblade.registry import BuiltinMethod, LLMProvider, registry
LLaMEA = registry.resolve("method", BuiltinMethod.LLAMEA)
Gemini = registry.resolve("llm", LLMProvider.GEMINI)
registry.keys("problem") # all problem keys
Unknown keys raise ComponentNotFoundError with close
matches; components whose optional dependencies are missing raise
ComponentUnavailableError with the install command.
Register your own components with the decorators:
from iohblade.problem import Problem
from iohblade.registry import register_problem
@register_problem("my_problem")
class MyProblem(Problem):
...
Registry of the components BLADE ships with (and ones users add).
The registry maps a short, stable key (for example "bbob_sbox" or
"llamea") to the import path of a class or factory function. Targets are
imported lazily, so looking up a key never pulls in heavy or optional
dependencies of other components, and a missing optional dependency is
reported with the exact install command instead of silently yielding
None.
Example
>>> from iohblade.registry import BuiltinMethod, registry
>>> LLaMEA = registry.resolve("method", BuiltinMethod.LLAMEA)
Third-party code can register its own components:
from iohblade.registry import register_problem
@register_problem("my_problem", description="My custom benchmark.")
class MyProblem(Problem):
...
The existing import paths (from iohblade.benchmarks import BBOB_SBOX etc.)
are unaffected; the registry is an additional way to look components up.
- class iohblade.registry.BuiltinMethod(value)¶
Bases:
StrEnumKeys of the LLM-driven search methods that ship with BLADE.
- EOH = 'eoh'¶
- FUNSEARCH = 'funsearch'¶
- LHNS = 'lhns'¶
- LLAMEA = 'llamea'¶
- MCTS_AHD = 'mcts_ahd'¶
- MOEH = 'moeh'¶
- RANDOM_SEARCH = 'random_search'¶
- REEVO = 'reevo'¶
- SHINKA_EVOLVE = 'shinka_evolve'¶
- class iohblade.registry.BuiltinProblem(value)¶
Bases:
StrEnumKeys of the problem classes that ship with BLADE.
- AUTOML = 'automl'¶
- AUTO_CORRELATION_INEQ1 = 'auto_correlation_ineq1'¶
- AUTO_CORRELATION_INEQ2 = 'auto_correlation_ineq2'¶
- AUTO_CORRELATION_INEQ3 = 'auto_correlation_ineq3'¶
- BBOB_SBOX = 'bbob_sbox'¶
- CIRCLE_PACKING = 'circle_packing'¶
- ERDOS_MIN_OVERLAP = 'erdos_min_overlap'¶
- EUCLIDIAN_STEINER_TREE = 'euclidian_steiner_tree'¶
- GRAPH_COLORING = 'graph_coloring'¶
- HEILBRONN_CONVEX_REGION = 'heilbronn_convex_region'¶
- HEILBRONN_TRIANGLE = 'heilbronn_triangle'¶
- HEXAGON_PACKING = 'hexagon_packing'¶
- KERNELTUNER = 'kerneltuner'¶
- KISSING_NUMBER_11D = 'kissing_number_11d'¶
- MATRIX_MULTIPLICATION = 'matrix_multiplication'¶
- MA_BBOB = 'ma_bbob'¶
- MIN_MAX_DISTANCE_RATIO = 'min_max_distance_ratio'¶
- PHOTONICS = 'photonics'¶
- RECTANGLE_PACKING = 'rectangle_packing'¶
- SPHERICAL_CODE = 'spherical_code'¶
- SUM_VS_DIFFERENCE = 'sum_vs_difference'¶
- TOY_MULTIOBJECTIVE = 'toy_multiobjective'¶
- TSP = 'tsp'¶
- UNCERTAINTY_INEQUALITY = 'uncertainty_inequality'¶
- UNIT_SQUARE_PACKING = 'unit_square_packing'¶
- VRP = 'vrp'¶
- class iohblade.registry.BuiltinSuite(value)¶
Bases:
StrEnumKeys of the factory functions that return a list of problems.
- ALPHAEVOLVE_MATH = 'alphaevolve_math'¶
- AUTO_CORRELATION = 'auto_correlation'¶
- BBOB = 'bbob'¶
- BBOB_GROUPS = 'bbob_groups'¶
- COMBINATORIAL = 'combinatorial'¶
- CONTINUOUS_BBO = 'continuous_bbo'¶
- DEFAULT = 'default'¶
- ERDOS_MIN_OVERLAP = 'erdos_min_overlap'¶
- FULL = 'full'¶
- HEILBRONN_CONVEX_REGION = 'heilbronn_convex_region'¶
- HEILBRONN_TRIANGLE = 'heilbronn_triangle'¶
- HEXAGON_PACKING = 'hexagon_packing'¶
- KISSING_NUMBER_11D = 'kissing_number_11d'¶
- MATRIX_MULTIPLICATION = 'matrix_multiplication'¶
- MA_BBOB = 'ma_bbob'¶
- MIN_MAX_DISTANCE_RATIO = 'min_max_distance_ratio'¶
- QUICK = 'quick'¶
- RECTANGLE_PACKING = 'rectangle_packing'¶
- SUM_VS_DIFFERENCE = 'sum_vs_difference'¶
- UNCERTAINTY_INEQUALITY = 'uncertainty_inequality'¶
- UNIT_SQUARE_PACKING = 'unit_square_packing'¶
- class iohblade.registry.ComponentInfo(kind: ComponentKind, key: str, target: str | Any, description: str = '', extra: str | None = None, requires: tuple[str, ...] = (), modules: tuple[str, ...] = ())¶
Bases:
objectDescription of one registered component.
- Parameters:
kind – The kind of component.
key – The registry key, unique per kind.
target – Import path
"package.module:attribute", or the object itself for components registered with a decorator.description – One-line human readable description.
extra – Name of the optional
uvdependency group that provides the component’s dependencies, if any.requires – Extra pip packages the component needs that are not in any dependency group.
modules – Modules that must be importable for the component to work, for components whose module imports fine without them (the optional import is guarded and fails later, at construction).
- description: str = ''¶
- extra: str | None = None¶
- install_hint() str¶
Command that installs the optional dependencies, if any.
- is_available() bool¶
Whether the target can be imported in the current environment.
- key: str¶
- kind: ComponentKind¶
- load() Any¶
Import and return the target class or function.
- Raises:
ComponentUnavailableError – If importing the target fails, for example because an optional dependency is not installed.
- modules: tuple[str, ...] = ()¶
- requires: tuple[str, ...] = ()¶
- target: str | Any¶
- property target_path: str¶
Import path of the target, also for registered objects.
- class iohblade.registry.ComponentKind(value)¶
Bases:
StrEnumThe kinds of components an experiment is assembled from.
- LLM = 'llm'¶
- LOGGER = 'logger'¶
- METHOD = 'method'¶
- PROBLEM = 'problem'¶
- SUITE = 'suite'¶
- class iohblade.registry.LLMProvider(value)¶
Bases:
StrEnumKeys of the LLM providers that ship with BLADE.
- CLAUDE = 'claude'¶
- DEEPSEEK = 'deepseek'¶
- DUMMY = 'dummy'¶
- GEMINI = 'gemini'¶
- LMSTUDIO = 'lmstudio'¶
- MLX_LM = 'mlx_lm'¶
- MULTI = 'multi'¶
- OLLAMA = 'ollama'¶
- OPENAI = 'openai'¶
- class iohblade.registry.LoggerType(value)¶
Bases:
StrEnumKeys of the experiment loggers that ship with BLADE.
- FILE = 'file'¶
- MLFLOW = 'mlflow'¶
- TRACKIO = 'trackio'¶
- class iohblade.registry.Registry¶
Bases:
objectLookup table from
(kind, key)toComponentInfo.- entries(kind: ComponentKind | str) list[ComponentInfo]¶
Registered entries for
kind, sorted by key.
- get(kind: ComponentKind | str, key: str) ComponentInfo¶
Return the entry for
key.- Raises:
ComponentNotFoundError – If the key is unknown. The error lists close matches.
- keys(kind: ComponentKind | str) list[str]¶
Sorted keys registered for
kind.
- register(kind: ComponentKind | str, key: str, target: str | Any, *, description: str = '', extra: str | None = None, requires: tuple[str, ...] | list[str] = (), modules: tuple[str, ...] | list[str] = (), overwrite: bool = False) ComponentInfo¶
Register a component.
- Parameters:
kind – The kind of component.
key – Registry key, unique per kind.
target –
"module:attribute"import path or the object itself.description – One-line description.
extra – Optional dependency group providing its dependencies.
requires – Pip packages it needs that are in no dependency group.
modules – Modules that must be importable, see ComponentInfo.
overwrite – Replace an existing registration with the same key.
- Returns:
The registered entry.
- Return type:
- Raises:
ValueError – If the key is already registered and
overwriteis False, or if a string target has no:.
- resolve(kind: ComponentKind | str, key: str) Any¶
Return the imported class or function registered under
key.
- unregister(kind: ComponentKind | str, key: str) None¶
Remove a registered component (no error if it does not exist).
- iohblade.registry.register_llm(key: str, *, description: str = '', extra: str | None = None) Callable¶
Class/function decorator that registers a llm under
key.
- iohblade.registry.register_logger(key: str, *, description: str = '', extra: str | None = None) Callable¶
Class/function decorator that registers a logger under
key.
- iohblade.registry.register_method(key: str, *, description: str = '', extra: str | None = None) Callable¶
Class/function decorator that registers a method under
key.
- iohblade.registry.register_problem(key: str, *, description: str = '', extra: str | None = None) Callable¶
Class/function decorator that registers a problem under
key.
- iohblade.registry.register_suite(key: str, *, description: str = '', extra: str | None = None) Callable¶
Class/function decorator that registers a suite under
key.