Publish data and metadata to all frontends. See the ``display_data`` message in the messaging documentation for more details about this message type. The following MIME types are currently implemented: * text/plain * text/html * text/markdown
(
self,
data,
metadata=None,
source=_sentinel,
*,
transient=None,
update=False,
**kwargs,
)
| 80 | |
| 81 | # use * to indicate transient, update are keyword-only |
| 82 | def publish( |
| 83 | self, |
| 84 | data, |
| 85 | metadata=None, |
| 86 | source=_sentinel, |
| 87 | *, |
| 88 | transient=None, |
| 89 | update=False, |
| 90 | **kwargs, |
| 91 | ) -> None: |
| 92 | """Publish data and metadata to all frontends. |
| 93 | |
| 94 | See the ``display_data`` message in the messaging documentation for |
| 95 | more details about this message type. |
| 96 | |
| 97 | The following MIME types are currently implemented: |
| 98 | |
| 99 | * text/plain |
| 100 | * text/html |
| 101 | * text/markdown |
| 102 | * text/latex |
| 103 | * application/json |
| 104 | * application/javascript |
| 105 | * image/png |
| 106 | * image/jpeg |
| 107 | * image/svg+xml |
| 108 | |
| 109 | Parameters |
| 110 | ---------- |
| 111 | data : dict |
| 112 | A dictionary having keys that are valid MIME types (like |
| 113 | 'text/plain' or 'image/svg+xml') and values that are the data for |
| 114 | that MIME type. The data itself must be a JSON'able data |
| 115 | structure. Minimally all data should have the 'text/plain' data, |
| 116 | which can be displayed by all frontends. If more than the plain |
| 117 | text is given, it is up to the frontend to decide which |
| 118 | representation to use. |
| 119 | metadata : dict |
| 120 | A dictionary for metadata related to the data. This can contain |
| 121 | arbitrary key, value pairs that frontends can use to interpret |
| 122 | the data. Metadata specific to each mime-type can be specified |
| 123 | in the metadata dict with the same mime-type keys as |
| 124 | the data itself. |
| 125 | source : str, deprecated |
| 126 | Unused. |
| 127 | transient : dict, keyword-only |
| 128 | A dictionary for transient data. |
| 129 | Data in this dictionary should not be persisted as part of saving this output. |
| 130 | Examples include 'display_id'. |
| 131 | update : bool, keyword-only, default: False |
| 132 | If True, only update existing outputs with the same display_id, |
| 133 | rather than creating a new output. |
| 134 | """ |
| 135 | |
| 136 | if source is not _sentinel: |
| 137 | import warnings |
| 138 | |
| 139 | warnings.warn( |
no test coverage detected