pz.ts: Treescope alias namespace#

Treescope, Penzai’s interactive pretty-printer, has moved to an independent package treescope. See the Treescope documentation for more information.

The alias namespace pz.ts contains shorthand aliases for commonly-used Treescope functions. However, we recommend that new users use treescope directly.

Using Treescope in IPython Notebooks#

pz.ts.basic_interactive_setup([...])

Sets up IPython for interactive use with Treescope.

pz.ts.register_as_default([streaming, ...])

Alias of penzai.treescope._compatibility_setup.register_as_default: Registers treescope as the default IPython renderer.

pz.ts.register_autovisualize_magic()

Alias of treescope.register_autovisualize_magic: Registers the %%autovisualize magic.

pz.ts.register_context_manager_magic()

Alias of treescope.register_context_manager_magic: Registers the %%with magic.

Showing Objects Explicitly#

pz.ts.render_array(array, *[, columns, ...])

Alias of treescope.render_array: Renders an array (positional or named) to a displayable HTML object.

pz.ts.render_array_sharding(array[, rows, ...])

Alias of treescope.render_array_sharding: Renders the sharding of an array.

pz.ts.integer_digitbox(value, *[, label, size])

Alias of treescope.integer_digitbox: Returns a "digitbox" rendering of a single integer.

pz.ts.text_on_color(text, value[, vmax, ...])

Alias of treescope.figures.text_on_color: Renders some text on colored background, with the default colormap.

pz.ts.display(value[, ignore_exceptions, ...])

Alias of penzai.treescope._compatibility_setup.display: Displays a value as an interactively foldable object.

pz.show(*args[, wrap, space_separated])

Alias of penzai.treescope._compatibility_setup.show: Shows a list of objects inline, like python print, but with rich display.

Styling Displayed Objects#

pz.ts.inline(*subfigures[, wrap])

Alias of treescope.figures.inline: Returns a figure that arranges a set of displayable objects along a line.

pz.ts.indented(subfigure)

Alias of treescope.figures.indented: Returns a figure object that displays a value with an indent.

pz.ts.with_font_size(subfigure, size)

Alias of treescope.figures.with_font_size: Returns a scaled version of the first figure.

pz.ts.with_color(subfigure, color)

Alias of treescope.figures.with_color: Returns a colored version of the first figure.

pz.ts.bolded(subfigure)

Alias of treescope.figures.bolded: Returns a bolded version of the first figure.

pz.ts.styled(subfigure, style)

Alias of treescope.figures.styled: Returns a CSS-styled version of the first figure.

Configuring Treescope#

pz.ts.active_renderer

Alias of treescope._internal.api.default_renderer.active_renderer: A global value which can be modified in a scoped context.

pz.ts.active_expansion_strategy

Alias of treescope._internal.api.default_renderer.active_expansion_strategy: A global value which can be modified in a scoped context.

pz.ts.using_expansion_strategy([max_height, ...])

Alias of treescope.using_expansion_strategy: Context manager that modifies the expansion strategy of Treescope.

pz.ts.active_autovisualizer

Alias of treescope._internal.api.autovisualize.active_autovisualizer: A global value which can be modified in a scoped context.

pz.ts.default_diverging_colormap

Alias of treescope._internal.api.arrayviz.default_diverging_colormap: A global value which can be modified in a scoped context.

pz.ts.default_sequential_colormap

Alias of treescope._internal.api.arrayviz.default_sequential_colormap: A global value which can be modified in a scoped context.

Building Autovisualizers#

pz.ts.ArrayAutovisualizer

Alias of treescope.ArrayAutovisualizer: An automatic visualizer for arrays.

pz.ts.Autovisualizer

Alias of treescope.Autovisualizer: Protocol for autovisualizers.

pz.ts.ChildAutovisualizer

Alias of treescope.ChildAutovisualizer: Used by autovisualizers to switch to a different autovisualizer.

pz.ts.IPythonVisualization

Alias of treescope.IPythonVisualization: Used by autovisualizers to replace a subtree with a display object.

pz.ts.vocab_autovisualizer(tokenizer)

Alias of treescope._internal.api.array_autovisualizer.ArrayAutovisualizer.for_tokenizer: Builds an autovisualizer for a tokenizer.

pz.ts.default_magic_autovisualizer

Alias of treescope._internal.api.ipython_integration.default_magic_autovisualizer: A global value which can be modified in a scoped context.

Rendering to Strings#

pz.ts.render_to_text(value[, ...])

Alias of treescope.render_to_text: Renders an object to text using the default renderer.

pz.ts.render_to_html(value[, ...])

Alias of treescope.render_to_html: Renders an object to HTML using the default renderer.