Skip to content

Commit

Permalink
DOCS: clarify meaning of merge_streams option (#664) (#665)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael McNeil Forbes <[email protected]>
  • Loading branch information
mforbes and Michael McNeil Forbes authored Feb 11, 2025
1 parent 27c82f3 commit 59fd54f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions docs/render/format_code_cells.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,18 @@ This can be set to:
(render/output/group-stderr-stdout)=
### Group into single streams

Cells may print multiple things to `stdout` and `stderr`.
Cells may print multiple things to `stdout` (and/or to `stderr`).
For example, if a cell prints status updates throughout its execution, each of these is often printed to `stdout`.
By default, these outputs may be split across multiple items, and will be rendered as separate "chunks" in your built documentation.

If you'd like each of the outputs in `stderr` and `stdout` to be merged into a single stream for each, use the following configuration:
If you'd like each of the outputs in `stdout` to be merged into a single stream for each, use the following configuration (see {ref}`config/intro`):

```python
nb_merge_streams = True
```

This will ensure that all `stderr` and `stdout` outputs are merged into a single group.
This will ensure that all `stdout` outputs are merged into a single group; likewise, all
`stderr` outputs will be merged into single (separate) group.
This also makes cell outputs more deterministic.
Normally, slight differences in timing may result in different orders of `stderr` and `stdout` in the cell output, while this setting will sort them properly.

Expand Down
2 changes: 1 addition & 1 deletion myst_nb/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def __post_init__(self):
default=False,
metadata={
"validator": instance_of(bool),
"help": "Merge stdout/stderr execution output streams",
"help": "Merge all stdout execution output streams; same with stderr",
"sections": (
Section.global_lvl,
Section.file_lvl,
Expand Down

0 comments on commit 59fd54f

Please sign in to comment.