Skip to content

Commit 361c64a

Browse files
committed
Rewrite the core concepts
Signed-off-by: Maria Teresa Ortega <teresa.ortega0903@gmail.com>
1 parent d3f451b commit 361c64a

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/lambkin/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,27 @@ A benchmark is structured around three stages that LAMBKIN sequences and keeps o
1212

1313
Each stage is a Python callable that receives a context object carrying configuration, paths, and state. You implement the logic; LAMBKIN handles the rest.
1414

15-
### Core Concepts
15+
## Core Concepts
1616

1717
LAMBKIN exposes a small set of composable primitives. Together they cover the full lifecycle of a benchmark — from declaring inputs and sweeping parameters to launching processes and collecting results.
1818

1919
**`named_product`**
20-
Takes named parameter lists and returns every possible combination as a list of dictionaries, one per benchmark run configuration. Pass the result to `@benchmark` via `variants=` to sweep all combinations automatically.
20+
Takes named parameter lists and returns every possible combination as a list of dictionaries, one per benchmark run configuration. Pass the result to `Benchmark` via `variants=` to sweep all combinations automatically.
2121

22-
**`@benchmark`**
23-
Drives the benchmark execution loop. It parses CLI options registered by `@option` once before the loop, then creates a `Context` for each `(variant, iteration)` pair and calls the decorated function with it. Input hooks registered via `@input` are resolved before each call and injected into `ctx.inputs`. Raises `ValueError` if `variants` is empty.
22+
**`Benchmark`**
23+
Drives the benchmark execution loop. It parses options registered via `Option` once before the loop, then creates a `Context` for every `(variant, iteration)` pair and calls the decorated function with it. A base context is used during setup to resolve inputs before the loop begins. Can be used as a decorator via `@benchmark`.
2424

2525
**`Context`**
26-
Carries all namespaced information for one benchmark variant. From the given parameters it builds `ctx.variant`, `ctx.inputs`, `ctx.options`, and `ctx.output`, and automatically creates the required output folders on disk before the benchmark function runs.
26+
Carries all namespaced information for one benchmark variant. Builds `ctx.variant`, `ctx.inputs`, `ctx.options`, and `ctx.output` from the given parameters, and automatically creates the required output folders on disk before the benchmark function runs.
2727

2828
**`Source`**
2929
Describes the benchmark script being executed. Exposed on the context as `ctx.source`, it gives benchmark stages access to the script's location and metadata without hardcoding paths.
3030

31-
**`@input`**
32-
Registers a hook on the benchmark function. Hooks are resolved before each call and their return values injected into `ctx.inputs` under the hook's function name, keeping data resolution decoupled from benchmark logic.
31+
**`Input`**
32+
Registers a data resolution hook on a benchmark. Hooks are resolved before each iteration and their return values injected into `ctx.inputs` under the hook's function name, keeping data resolution decoupled from benchmark logic. Can be used as a decorator via `@input`.
3333

34-
**`@option`**
35-
Modelled after `click.option`. Registers a CLI option on the benchmark function by storing a `click.Option` object on `fn.__lambkin_options__`, which `@benchmark` collects and parses before the execution loop. The parsed values are injected into `ctx.options` — flag names are normalized by click, so `--clock-rate` becomes `ctx.options.clock_rate`.
34+
**`Option`**
35+
Abstracts shell command dispatch. Exposes the host environment's executables as Python attributes — accessing `shell.my_tool` returns a callable that runs `my_tool` with the given arguments, letting benchmark scripts invoke external processes without hardcoding paths or constructing subprocess calls manually. Accessible via `ctx.shell`.
3636

3737
**`ctx.shell`**
3838
Exposes the host environment's executables as Python attributes. Accessing `ctx.shell.my_tool` returns a callable that, when invoked, runs `my_tool` with the given arguments. This lets benchmark scripts call external processes as if they were native Python functions, without hardcoding paths or constructing subprocess calls manually.

0 commit comments

Comments
 (0)