Asyncshell
async_kernel.asyncshell ¶
Classes:
-
AsyncDisplayHook
–A displayhook subclass that publishes data using ZeroMQ.
-
AsyncDisplayPublisher
–A display publisher that publishes data using a ZeroMQ PUB socket.
-
AsyncInteractiveShell
–An IPython InteractiveShell modified to work with Async kernel.
AsyncDisplayHook ¶
A displayhook subclass that publishes data using ZeroMQ.
This is intended to work with an InteractiveShell instance. It sends a dict of different representations of the object.
Methods:
-
finish_displayhook
–Finish up all displayhook activities.
-
start_displayhook
–Start the display hook.
-
write_format_data
–Write format data to the message.
-
write_output_prompt
–Write the output prompt.
finish_displayhook ¶
finish_displayhook() -> None
Finish up all displayhook activities.
Source code in src/async_kernel/asyncshell.py
63 64 65 66 67 68 |
|
start_displayhook ¶
start_displayhook() -> None
Start the display hook.
Source code in src/async_kernel/asyncshell.py
47 48 49 50 |
|
write_format_data ¶
write_format_data(format_dict, md_dict=None) -> None
Write format data to the message.
Source code in src/async_kernel/asyncshell.py
57 58 59 60 61 |
|
write_output_prompt ¶
write_output_prompt() -> None
Write the output prompt.
Source code in src/async_kernel/asyncshell.py
52 53 54 55 |
|
AsyncDisplayPublisher ¶
A display publisher that publishes data using a ZeroMQ PUB socket.
Methods:
-
clear_output
–Clear output associated with the current execution (cell).
-
publish
–Publish a display-data message.
clear_output ¶
Clear output associated with the current execution (cell).
Parameters:
-
wait
¶bool
, default:False
) –If True, the output will not be cleared immediately, instead waiting for the next display before clearing. This reduces bounce during repeated clear & display loops.
Source code in src/async_kernel/asyncshell.py
104 105 106 107 108 109 110 111 112 113 114 |
|
publish ¶
publish(
data: Content,
metadata: dict | None = None,
*,
transient: dict | None = None,
update: bool = False,
**kwargs,
) -> None
Publish a display-data message.
Parameters:
-
data
¶Content
) –A mime-bundle dict, keyed by mime-type.
-
metadata
¶dict | None
, default:None
) –Metadata associated with the data.
-
transient
¶dict | None
, default:None
) –Transient data that may only be relevant during a live display, such as display_id. Transient data should not be persisted to documents.
-
update
¶bool
, default:False
) –If True, send an update_display_data message instead of display_data.
Source code in src/async_kernel/asyncshell.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
AsyncInteractiveShell ¶
An IPython InteractiveShell modified to work with Async kernel.
Notable differences
- All execute requests are run asynchronously.
-
Supports a soft timeout with the metadata {"timeout":
}1. -
Not all features are support (see "not-supported" features listed below).
-
When the execution time exceeds the timeout value, the code execution will "move on". ↩
Methods:
-
init_magics
–Initialize magics.
-
run_cell_async
–Run a complete IPython cell asynchronously.
Attributes:
-
autoindent
–not-supported
-
debug
–not-supported
-
execute_request_timeout
–A timeout in seconds to complete execute requests.
-
kernel
(Kernel
) –The current kernel.
-
loop_runner
–not-supported
-
loop_runner_map
–not-supported
-
readline_use
–not-supported
-
run_cell
–not-supported
execute_request_timeout
class-attribute
instance-attribute
¶
execute_request_timeout = CFloat(default_value=None, allow_none=True)
A timeout in seconds to complete execute requests.
init_magics ¶
init_magics() -> None
Initialize magics.
Source code in src/async_kernel/asyncshell.py
271 272 273 274 275 |
|
run_cell_async
async
¶
run_cell_async(
raw_cell: str,
store_history=False,
silent=False,
shell_futures=True,
*,
transformed_cell: str | None = None,
preprocessing_exc_tuple: tuple | None = None,
cell_id: str | None = None,
) -> ExecutionResult
Run a complete IPython cell asynchronously.
This function runs execute requests for the kernel wrapping InteractiveShell.
Source code in src/async_kernel/asyncshell.py
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 |
|
KernelMagics ¶
Extra magics for async kernel.
Methods:
-
callers
–Print a table of Callers, indicating its status including: -running - protected - on the current thread.
-
connect_info
–Print information for connecting other clients to this kernel.
callers ¶
callers(_) -> None
Print a table of Callers, indicating its status including: -running - protected - on the current thread.
Source code in src/async_kernel/asyncshell.py
306 307 308 309 310 311 312 313 314 315 |
|
connect_info ¶
connect_info(_) -> None
Print information for connecting other clients to this kernel.
Source code in src/async_kernel/asyncshell.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
|