Python API

Top-level re-exports

The public surface lives at the package root; all names below are importable from mew directly:

benchmark([fn, name, tags])

Register a function as a single benchmark.

parametrize(parameters, *[, name, ids, tags])

Register a parametrized benchmark family.

product(*[, name, ids, tags, min_time, ...])

Register a benchmark family from the cartesian product of iterables.

State(*args, **kwargs)

Structural state passed into benchmark targets.

BenchmarkFn(*args, **kwargs)

A callable benchmark target.

run([entries, reporter, min_time, ...])

Run benchmarks via the C++ Google Benchmark backend.

Reporter(*args, **kwargs)

Duck-typed reporter interface consumed by the C++ runner.

RichReporter(*[, terminal, show_memory, ...])

Stream one row per benchmark to a terminal as runs complete.

JSONReporter(*[, output])

Emit a single {"context": ..., "benchmarks": [...]} document, GB-style.

JSONLReporter(*[, output, append, header])

Stream one self-contained JSON object per Run, one per line, flushed as runs land.

Fanout(reporters)

Broadcast reporter callbacks to a list of underlying reporters.

RunRow

One benchmark run, serialized: the contract every reporter consumes.

TimeUnit(*values)

Time unit used for reported per-iteration durations.

Registry()

Entry(name, fn[, file, options, tags, ...])

REGISTRY

BENCHMARK_VERSION

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

BENCHMARK_COMMIT

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

set_context(key, value)

Set a single value in the global benchmark context.

update_context(*mapping, **kwargs)

Set many context values at once.

get_context()

Return a deep copy of the current global benchmark context.

clear_context()

Drop every entry from the global benchmark context.