CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-invoke

Pythonic task execution library for managing shell-oriented subprocesses and organizing executable Python code into CLI-invokable tasks

Overall
score

96%

Overview
Eval results
Files

task.mdevals/scenario-7/

Custom Task Logger

Build a task automation system that tracks and logs task executions with timestamps and execution metadata.

Requirements

Create a custom task that automatically logs when it starts and completes execution, including the timestamp and any relevant metadata. The system should:

  1. Define a custom task class that extends the base task functionality to add automatic execution logging
  2. Implement tasks using this custom task class
  3. Log the task name, start time, end time, and execution duration to a file
  4. Support the standard task decorator parameters and behavior

Implementation

@generates

Test Cases

  • When the build task is invoked, a log entry is written to 'task_log.txt' containing the task name "build", start timestamp, end timestamp, and execution duration @test
  • When both build and test tasks are invoked sequentially, 'task_log.txt' contains two separate log entries with correct task names and timestamps @test
  • The custom task class preserves the docstring as help text when running with --help @test

API

from invoke import Task

class LoggingTask(Task):
    """
    Custom task class that logs execution metadata to 'task_log.txt'.

    Logs task name, start timestamp, end timestamp, and execution duration.
    """
    pass


def build(c):
    """Build the project."""
    pass


def test(c):
    """Run tests."""
    pass

Dependencies { .dependencies }

invoke { .dependency }

Provides task automation and execution framework with support for custom task classes via the klass parameter.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/pypi-invoke

tile.json