Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updatable Displays #225

Merged
merged 7 commits into from
Nov 15, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 53 additions & 1 deletion docs/messaging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,12 @@ Message type: ``display_data``::
'data' : dict,

# Any metadata that describes the data
'metadata' : dict
'metadata' : dict,

# Optional transient data introduced in 5.1. Information not to be
# persisted to a notebook or other documents. Intended to live only
# during a live kernel session.
'transient': dict,
}


Expand Down Expand Up @@ -994,12 +999,58 @@ and expanded for JSON data::
}
}


The ``transient`` dict contains runtime metadata that should not be persisted to
document formats and is fully optional. The only transient key currently defined in Jupyter is
``display_id``::

transient = {
'display_id': 'abcd'
}

.. versionchanged:: 5.0

`application/json` data should be unpacked JSON data,
not double-serialized as a JSON string.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add .. versionchanged:: 5.1 note for when transient will arrive


.. versionchanged:: 5.1

`transient` is a new field.

Update Display Data
-------------------

.. versionadded:: 5.1

Displays can now be named with a ``display_id`` within the ``transient`` field of
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add .. versionadded:: 5.1 here?

``display_data`` or ``execute_result``.

When a ``display_id`` is specified for a display, it can be updated later
with an ``update_display_data`` message. This message has the same format as `display_data`_
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double check the '`' and triple backticks in this line and the next. Looks like some typos.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, that's my complete markdown bias showing. I've completely forgotten how to write restructured text.

messages and must contain a ``transient`` field with a ``display_id``.

.. _update_display_data:

Message type: ``update_display_data``::

content = {

# The data dict contains key/value pairs, where the keys are MIME
# types and the values are the raw data of the representation in that
# format.
'data' : dict,

# Any metadata that describes the data
'metadata' : dict,

# Any information not to be persisted to a notebook or other environment
# Intended to live only during a kernel session
'transient': dict,
}

Frontends can choose how they update prior outputs (or if they regard this as a
regular ``display_data`` message). Within the jupyter and nteract_ notebooks,
all displays that match the ``display_id`` are updated (even if there are multiple).

Code inputs
-----------
Expand Down Expand Up @@ -1297,3 +1348,4 @@ Missing things include:
* Important: finish thinking through the payload concept and API.

.. _ZeroMQ: http://zeromq.org
.. _nteract: https://nteract.io