or run

tessl search
Log in

Version

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

tessl/pypi-textual

tessl install tessl/pypi-textual@6.1.0

Modern Text User Interface framework for building cross-platform terminal and web applications with Python

Agent Success

Agent success rate when using this tile

93%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.18x

Baseline

Agent success rate without this tile

79%

task.mdevals/scenario-4/

Configuration File Watcher

Build a terminal user interface application that monitors a configuration file for changes and displays the updated content in real-time.

Requirements

Create a terminal application that:

  1. Accepts a file path as a command-line argument
  2. Monitors the specified file for modifications using file system watching
  3. Displays the current file content in the main area of the terminal UI
  4. Automatically refreshes the displayed content whenever the file changes on disk
  5. Shows a header displaying:
    • The file path being monitored
    • The timestamp of the last detected change
    • The count of changes detected since startup
  6. Binds the q key to quit the application

The application should use asynchronous file monitoring and update the UI reactively when changes are detected.

Implementation

@generates

API

from textual.app import App

class ConfigWatcherApp(App):
    """A TUI application that monitors a configuration file for changes."""

    def __init__(self, file_path: str):
        """
        Initialize the application with a file path to monitor.

        Args:
            file_path: Path to the configuration file to watch
        """
        ...

    async def on_mount(self) -> None:
        """Set up the file monitor when the application mounts."""
        ...

    def handle_file_change(self, path: str) -> None:
        """
        Callback invoked when the monitored file changes.

        Args:
            path: Path to the file that changed
        """
        ...

def main(file_path: str) -> None:
    """
    Entry point to run the application.

    Args:
        file_path: Path to the configuration file to monitor
    """
    ...

Test Cases

  • When the application starts with a valid file path, it displays the file content and begins monitoring @test
  • When the monitored file is modified, the displayed content updates automatically within a reasonable time @test
  • When the monitored file is modified multiple times, the change counter increments correctly @test
  • When the file path provided does not exist, the application displays an appropriate error message @test

Dependencies { .dependencies }

textual { .dependency }

Provides the TUI framework with file monitoring capabilities.

@satisfied-by