Skip to content

Notebook presentation

This page overrides the site's presentation defaults in its frontmatter. Inputs and outputs start collapsed; stdout is removed. The site also removes stderr. Open Show code or Show output to inspect a cell. Enable interactivity and run the page: the same presentation settings still apply.

Show code
import sys
from IPython.display import display, clear_output
print("Filtered stdout")
print("Filtered stderr", file=sys.stderr)
display({"text/plain": "Visible result: 42"}, raw=True)
Show output
Visible result: 42

Cell tags override page and site defaults. This cell shows both streams:

print("discarded")
clear_output(wait=True)
print("Kept stdout")
print("Kept stderr", file=sys.stderr)
handle = display("old result", display_id=True)
handle.update("updated result")
Kept stdout
Kept stderr
'updated result'

A whole cell can be revealed with one disclosure:

Show cell
print("Inside the cell disclosure")
Inside the cell disclosure

Removed inputs stay out of view even after activation. Run all still runs them:

Output without a displayed input

Outputs can be removed independently. Expected errors still have their normal execution meaning, even when the traceback is removed:

raise ValueError("Expected hidden traceback")

This removed setup cell defines a value used by the last cell:

print(f"Hidden setup ran: {hidden_value}")
Hidden setup ran: 42

See the authoring guide for configuration, precedence, and migration from the input-only setting.