IPython: Productive Interactive Computing - An advanced interactive computing environment and command shell for Python.
86
Build a code execution logger that tracks and logs all code executed in an IPython session, including execution timing and success/failure status.
Your logger should:
The logger should automatically activate when imported and integrate seamlessly with the IPython shell without requiring manual setup by the user.
@generates
def get_execution_log():
"""
Retrieves the execution log.
Returns:
list: List of dictionaries, each containing:
- 'execution_count': int, the execution number
- 'code': str, the executed code
- 'start_time': float, timestamp when execution started
- 'end_time': float, timestamp when execution ended
- 'duration_ms': float, execution duration in milliseconds
- 'status': str, either 'success' or 'error'
"""
pass
def display_log():
"""
Displays the execution log in a formatted, human-readable way.
Shows execution count, duration, status, and code snippet for each entry.
"""
pass
def clear_log():
"""
Clears all entries from the execution log.
"""
passx = 1 + 1) creates a log entry with status 'success' @test1 / 0) creates a log entry with status 'error' @testProvides interactive shell and event hook capabilities for tracking code execution.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/pypi-ipythondocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10