class penzai.treescope.renderer.TreescopeSubtreeRenderer[source]#

Bases: Protocol

Protocol for a (recursive) subtree renderer.

Implementations of this protocol render full subtrees to HTML tags. Handlers take one of these as an argument and use it to render their children.


__init__(*args, **kwargs)

__call__(node[, path])

Signature for a (recursive) subtree renderer.

__call__(node: Any, path: tuple[Any, ...] | None = None) part_interface.RenderableAndLineAnnotations[source]#

Signature for a (recursive) subtree renderer.

  • node – The node to render.

  • path – Optionally, a path to this node. Handlers should pass the JAX keypath to each of their pytree node children. They can also pass keypaths to non-pytree-node children if desired.


A representation of the object as a renderable tree part in the intermediate representation.