Skip to main content

A Robust Interactive Terminal Task Runner Library

Project description

TaskPanel: A Robust Interactive Terminal Task Runner

Python Support License: MIT Code style: black

TaskPanel is a professional-grade, terminal-based tool designed to run, monitor, and manage multi-step parallel tasks defined in a simple CSV file. It provides a highly responsive and fault-tolerant TUI (Text-based User Interface) for complex workflows.

Key Features

Core Functionality

  • Parallel Execution: Runs each task (row in the CSV) in a parallel worker thread
  • Sequential Steps: Executes the steps (columns) within each task sequentially
  • Interactive TUI: A full-screen, responsive curses-based interface to monitor task status
  • Detailed Views: Context-aware panels show task information and step output
  • Advanced Navigation:
    • Vertical scrolling for hundreds of tasks
    • Horizontal scrolling for tasks with many steps

Robustness & Reliability

  • State Persistence: Intelligent resume capability after crashes or interruptions
  • Task State Management: Completed tasks preserved, interrupted tasks reset appropriately
  • Concurrency Control: Configurable worker limits to prevent resource exhaustion
  • Safe Threading: Deadlock-free threading with proper synchronization

Performance & Debugging

  • Log Management: Structured logging with unique directories per task
  • Efficient UI: Smart refresh mechanism for minimal CPU usage
  • Debug Features: Toggleable debug panel with detailed lifecycle information

Installation

pip install taskpanel

或从源码安装:

git clone https://github.com/Wenutu/TaskPanel.git
cd TaskPanel
pip install -e .

Quick Start

  1. Create your task definition file (tasks.csv):

    TaskName,Info,Checkout,Build,Test
    MyApp,v1.0.0,./scripts/1_checkout.sh,./scripts/2_build.sh,./scripts/3_test.sh
    
  2. Run from command line:

    taskpanel tasks.csv
    
  3. Or use as a Python library:

    import taskpanel
    
    taskpanel.run(
        csv_path="tasks.csv",
        max_workers=4,
        title="My Workflow"
    )
    

Example Project Structure

your_project/
├── tasks.csv         # Task definitions
├── scripts/          # Your workflow scripts
│   ├── 1_checkout.sh
│   ├── 2_build.sh
│   ├── 3_test.sh
│   └── 4_deploy.sh
└── app.py           # Your main application (optional)

Task Definition Format

Define your workflow in a CSV file with the first row as headers.

Format: TaskName,Info,Step1Header,Step2Header,...

Example tasks.csv:

TaskName,Info,Checkout,Build,Test,Deploy
WebApp,v1.2.0,./scripts/1_checkout.sh,./scripts/2_build.sh,./scripts/3_test.sh,./scripts/4_deploy.sh
API-Server,v1.2.0,./scripts/1_checkout.sh,./scripts/2_build.sh --api,./scripts/3_test.sh --integration,./scripts/4_deploy.sh --api

Each task (row) will be executed as a pipeline where steps run sequentially.

Usage

Command Line Interface

# Basic usage
taskpanel tasks.csv

# With options
taskpanel tasks.csv --workers 8 --title "My Build Pipeline"

# Show help
taskpanel --help

Python Library

#!/usr/bin/env python3
import taskpanel

def main():
    try:
        taskpanel.run(
            csv_path="tasks.csv",
            max_workers=4,
            title="My Workflow Runner"
        )
    except FileNotFoundError as e:
        print(f"Error: Task file not found - {e}")
    except KeyboardInterrupt:
        print("Interrupted by user")

if __name__ == "__main__":
    main()

Interactive Controls

Key Action
Navigate between tasks
Navigate between columns
Home / End Jump to first/last task
PgUp / PgDn Scroll by page
r Rerun selected step and subsequent steps
k Kill currently running task
d Toggle debug panel
[ / ] Scroll output log
{ / } Scroll debug log
q Quit application

Project Architecture

TaskPanel follows a clean Model-View-Controller (MVC) architecture:

  • Model (src/taskpanel/model.py): Task execution, state management, and persistence
  • View (src/taskpanel/view.py): Terminal UI rendering with curses
  • Controller (src/taskpanel/runner.py): Event loop and user input handling
  • CLI (src/taskpanel/cli.py): Command-line interface

This separation ensures maintainability and testability.

Development

Setup Development Environment

# Clone the repository
git clone https://github.com/Wenutu/TaskPanel.git
cd TaskPanel

# Install in development mode
pip install -e ".[dev]"

# Or use make
make install-dev

Project Structure

TaskPanel/
├── src/
│   └── taskpanel/         # Main package
│       ├── __init__.py    # Package entry point
│       ├── cli.py         # Command-line interface
│       ├── model.py       # Task execution logic
│       ├── runner.py      # Main controller
│       └── view.py        # Terminal UI
├── tests/                 # Test suite
├── scripts/               # Example scripts
├── pyproject.toml         # Build configuration
├── Makefile              # Development commands
└── README.md             # This file

Make Commands

  • make test - Run tests
  • make lint - Run linting tools
  • make format - Format code
  • make build - Build package
  • make clean - Clean build artifacts

Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Make your changes
  4. Run tests: make test
  5. Submit a pull request

Please ensure your code follows the project style and includes appropriate tests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Links

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

taskpanel-1.0.1.tar.gz (26.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

taskpanel-1.0.1-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

Details for the file taskpanel-1.0.1.tar.gz.

File metadata

  • Download URL: taskpanel-1.0.1.tar.gz
  • Upload date:
  • Size: 26.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.10.0 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.20 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.15

File hashes

Hashes for taskpanel-1.0.1.tar.gz
Algorithm Hash digest
SHA256 67628f91d0222dfe12701c7096f8aec5079e0d4449359934d1642f64e548a402
MD5 076b8da25f57a66127fcd1efd039e426
BLAKE2b-256 82339b91f532e35151c75a0b313d9c60cb03dffdfe4bc06d28af71660a30d33d

See more details on using hashes here.

File details

Details for the file taskpanel-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: taskpanel-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 20.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.10.0 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.20 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.15

File hashes

Hashes for taskpanel-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e334f8012be13372c67d672bd3b4c1facb600083470f24da4bd14de8b407de28
MD5 2538f121be499065d08f2d9728aa2096
BLAKE2b-256 0bf9f865f730e38c905a01732be9267235afe97b0501b9d06a6dbb6f007cb7ec

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page