tessl install tessl/pypi-ipython@9.5.0IPython: Productive Interactive Computing - An advanced interactive computing environment and command shell for Python.
Agent Success
Agent success rate when using this tile
86%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.09x
Baseline
Agent success rate without this tile
79%
Build a utility that demonstrates asynchronous code execution capabilities in an interactive Python environment, allowing users to run async code snippets and manage different event loop backends.
Create a Python module that provides an interactive code execution environment supporting asynchronous operations. The utility should enable execution of async code with top-level await support and demonstrate integration with different async loop runners.
The module must provide:
await expressions at the top level without wrapping in async functionsYour implementation should:
create_async_shell() that returns an initialized interactive shell instance capable of running async codeexecute_async_code(shell, code, loop_runner='asyncio') that:
await statements without requiring explicit async def wrappers"await asyncio.sleep(0.01); result = 42" in a shell sets the variable result to 42 in the user namespace @test"import asyncio; await asyncio.sleep(0.01)" completes without raising an exception @testProvides interactive computing environment with async execution support.
@generates
def create_async_shell():
"""
Create and configure an interactive shell with async support enabled.
Returns:
An interactive shell instance configured for async code execution
"""
pass
def execute_async_code(shell, code, loop_runner='asyncio'):
"""
Execute code in the shell with specified async loop runner.
Args:
shell: Interactive shell instance
code: Python code string to execute (may contain async/await)
loop_runner: Event loop backend ('asyncio', 'trio', or 'curio')
Returns:
Execution result from running the code
"""
pass
def configure_autoawait(shell, enabled=True):
"""
Enable or disable autoawait mode for top-level await support.
Args:
shell: Interactive shell instance
enabled: Whether to enable autoawait mode
"""
pass