Context

mew.set_context(key, value)[source]

Set a single value in the global benchmark context.

Parameters:
  • key (str) – Context key. Dotted names result in nested dicts ("dataset.size"{"dataset": {"size": ...}}).

  • value (Any) – Value to store. Reporters serialize this when emitting context, so JSON-friendly values are preferred.

Raises:

ValueError – If key is empty, has an empty path segment, or traverses through a non-dict value.

Return type:

None

mew.update_context(*mapping, **kwargs)[source]

Set many context values at once.

Positional dicts are applied first, then kwargs. Dotted keys nest in both forms; pass them via splat as update_context(**{"a.b": 1}).

Parameters:
  • *mapping (dict[str, Any]) – Mappings whose items are applied in order.

  • **kwargs (Any) – Additional key-value pairs applied after the positional mappings.

Raises:

ValueError – Same conditions as set_context().

Return type:

None

mew.get_context()[source]

Return a deep copy of the current global benchmark context.

Return type:

dict[str, Any]

Returns:

dict[str, Any] – Independent snapshot. Mutating it does not affect future runs.

mew.clear_context()[source]

Drop every entry from the global benchmark context.

Return type:

None