You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/lambkin/README.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,27 +12,27 @@ A benchmark is structured around three stages that LAMBKIN sequences and keeps o
12
12
13
13
Each stage is a Python callable that receives a context object carrying configuration, paths, and state. You implement the logic; LAMBKIN handles the rest.
14
14
15
-
###Core Concepts
15
+
## Core Concepts
16
16
17
17
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.
18
18
19
19
**`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.
21
21
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`.
24
24
25
25
**`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.
27
27
28
28
**`Source`**
29
29
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.
30
30
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`.
33
33
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`.
36
36
37
37
**`ctx.shell`**
38
38
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