JsonDumpReporter
The JsonDumpReporter
reports the capsule in JSON format.
It can be created using the capsula.JsonDumpReporter.builder
method or the capsula.JsonDumpReporter.__init__
method.
capsula.JsonDumpReporter.builder
classmethod
builder(
*, option: int | None = None
) -> Callable[[CapsuleParams], JsonDumpReporter]
PARAMETER | DESCRIPTION |
---|---|
option |
Option to pass to
TYPE:
|
Source code in capsula/_reporter/_json.py
capsula.JsonDumpReporter.__init__
__init__(
path: Path | str,
*,
default: Callable[[Any], Any] | None = None,
option: int | None = None,
mkdir: bool = True
)
PARAMETER | DESCRIPTION |
---|---|
path |
TYPE:
|
default |
TYPE:
|
option |
TYPE:
|
mkdir |
TYPE:
|
Source code in capsula/_reporter/_json.py
Configuration example
Via capsula.toml
[pre-run]
reporters = [{ type = "JsonDumpReporter" }]
[in-run]
reporters = [{ type = "JsonDumpReporter" }]
[post-run]
reporters = [{ type = "JsonDumpReporter" }]
Via @capsula.reporter
decorator
import capsula
@capsula.run()
@capsula.reporter(capsula.JsonDumpReporter.builder(), mode="all")
def func(): ...
Output
It will output the pre-run, in-run, and post-run capsules to in-run-report.json
, pre-run-report.json
, and post-run-report.json
in the run directory, respectively.