MCPcopy Create free account
hub / github.com/ipython/ipython / publish_display_data

Function publish_display_data

IPython/core/display.py:81–123  ·  view source on GitHub ↗

Publish data and metadata to all frontends. See the ``display_data`` message in the messaging documentation for more details about this message type. Keys of data and metadata can be any mime-type. Parameters ---------- data : dict A dictionary having keys that are

(data, metadata=None, source=None, *, transient=None, **kwargs)

Source from the content-addressed store, hash-verified

79
80# use * to indicate transient is keyword-only
81def publish_display_data(data, metadata=None, source=None, *, transient=None, **kwargs):
82 """Publish data and metadata to all frontends.
83
84 See the ``display_data`` message in the messaging documentation for
85 more details about this message type.
86
87 Keys of data and metadata can be any mime-type.
88
89 Parameters
90 ----------
91 data : dict
92 A dictionary having keys that are valid MIME types (like
93 'text/plain' or 'image/svg+xml') and values that are the data for
94 that MIME type. The data itself must be a JSON'able data
95 structure. Minimally all data should have the 'text/plain' data,
96 which can be displayed by all frontends. If more than the plain
97 text is given, it is up to the frontend to decide which
98 representation to use.
99 metadata : dict
100 A dictionary for metadata related to the data. This can contain
101 arbitrary key, value pairs that frontends can use to interpret
102 the data. mime-type keys matching those in data can be used
103 to specify metadata about particular representations.
104 source : str, deprecated
105 Unused.
106 transient : dict, keyword-only
107 A dictionary of transient data, such as display_id.
108 """
109 from IPython.core.interactiveshell import InteractiveShell
110
111 display_pub = InteractiveShell.instance().display_pub
112
113 # only pass transient if supplied,
114 # to avoid errors with older ipykernel.
115 # TODO: We could check for ipykernel version and provide a detailed upgrade message.
116 if transient:
117 kwargs['transient'] = transient
118
119 display_pub.publish(
120 data=data,
121 metadata=metadata,
122 **kwargs
123 )
124
125
126def _new_id():

Callers 2

displayMethod · 0.90
displayFunction · 0.85

Calls 1

publishMethod · 0.45

Tested by

no test coverage detected