Skip to content

Shell.ast_node_interactivity='all' prints intra-cell output without newlines #4174

@kkm000

Description

@kkm000

Coming from the Mathematica background, I always set
%config Shell.ast_node_interactivity='all'
(older Jupyter had the setting under ZMQInteractiveShell instead of Shell).

Describe the current behavior
In a fresh notebook, evaluate two cells, first to configure shell and import imports, and the second to model interactive compute:

%config Shell.ast_node_interactivity='all'
import tensorflow as tf
q=tf.constant([[1,2],[3,4]])
tf.shape(q[1])
q[1].shape
42

The expected behavior
In the previous Colab (can't tell when it broke, rarely use it), and in my installation of Jupyter, the output cell has the output line from every non-assignment expression, as

<tf.Tensor: shape=(1,), dtype=int32, numpy=array([2], dtype=int32)>
TensorShape([2])
42

The current, borked behavior
The output cell is printed without libenreaks:

<tf.Tensor: shape=(1,), dtype=int32, numpy=array([2], dtype=int32)>TensorShape([2])42

What web browser you are using
Firefox x64, beta channel, Windows 11 v10.0.22621.2715, today's version 121.0b3.
Confirmed identical output in Edge's private window. Edge Version 119.0.2151.72, the latest update.

Additional context

Notebook: https://colab.research.google.com/drive/1IdH9VvBGQNiwKjS_2O6Mv5Awu3rLpRzB?usp=sharing

Firefox DevTools representation of the lumped output cell:

<div class="output-iframe-container">
  <div class="output-iframe-sizer" style="min-height: 0px;">
    <div>
      <div>
        <colab-static-output-renderer tabindex="0" role="group">
          <div>
            <div class="execute_result output-id-1 output_text">
              <pre>&lt;tf.Tensor: shape=(1,), dtype=int32, numpy=array([2], dtype=int32)&gt;</pre>
            </div>
            <div class="execute_result output-id-2 output_text">
              <pre>TensorShape([2])</pre>
            </div>
            <div class="execute_result output-id-3 output_text">
              <pre>42</pre>
            </div>
          </div>
          <div/>
        </colab-static-output-renderer>
      </div>
    </div>
    <div>
      <div/>
    </div>
  </div>
</div>

Something wrong with the CSS maybe?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions