Ctrl + k

or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/ipython@9.5.x
tile.json

tessl/pypi-ipython

tessl install tessl/pypi-ipython@9.5.0

IPython: 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%

task.mdevals/scenario-6/

Code Execution Logger

Build a code execution logger that tracks and logs all code executed in an IPython session, including execution timing and success/failure status.

Requirements

Your logger should:

  1. Track every code execution in an IPython session
  2. Record the execution time for each code cell
  3. Log whether the execution succeeded or failed (exception occurred)
  4. Maintain a history of all executions with their metadata
  5. Provide a method to display the execution log in a formatted way

The logger should automatically activate when imported and integrate seamlessly with the IPython shell without requiring manual setup by the user.

Functionality

  • Automatically log all code executions in the IPython session
  • Capture execution start and end times
  • Track execution status (success or failure)
  • Store executed code content
  • Provide a function to retrieve and display the execution log
  • Display log showing: execution number, execution time (in milliseconds), status, and code snippet (first 50 characters)

Implementation

@generates

API

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.
    """
    pass

Tests

  • Executing a simple successful code cell (e.g., x = 1 + 1) creates a log entry with status 'success' @test
  • Executing code that raises an exception (e.g., 1 / 0) creates a log entry with status 'error' @test
  • Multiple code executions create multiple log entries in order @test
  • Each log entry contains all required fields: execution_count, code, start_time, end_time, duration_ms, status @test
  • The clear_log function removes all entries from the log @test

Dependencies { .dependencies }

IPython { .dependency }

Provides interactive shell and event hook capabilities for tracking code execution.

@satisfied-by