or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

cli.mdconfiguration.mderror-handling.mdindex.mdtask-composition.mdtask-execution.mdvariables.md
tile.json

tessl/pypi-taskipy

A task runner for Python projects that enables task definition and execution through pyproject.toml configuration.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/taskipy@1.14.x

To install, run

npx @tessl/cli install tessl/pypi-taskipy@1.14.0

index.mddocs/

Taskipy

A complementary task runner for Python projects that enables defining and executing development pipeline tasks through pyproject.toml configuration. Taskipy provides an npm run-script inspired interface for Python, supporting task composition, pre/post hooks, variable substitution, and working directory configuration.

Package Information

  • Package Name: taskipy
  • Language: Python
  • Installation: pip install taskipy or poetry add --dev taskipy
  • Requirements: Python 3.6+, valid pyproject.toml file

Core Imports

from taskipy.cli import run, main
from taskipy.task_runner import TaskRunner
from taskipy.list import TasksListFormatter

Basic Usage

Configuration

Define tasks in pyproject.toml:

[tool.taskipy.tasks]
test = "python -m unittest tests/test_*.py"
lint = { cmd = "pylint tests taskipy", help = "lint code with pylint" }

Command Line Usage

# Run a task
task test

# List available tasks
task --list

# Pass arguments to tasks
task test --verbose

Programmatic Usage

from taskipy.cli import run
from pathlib import Path

# Run task programmatically
exit_code = run(['test', '--verbose'], cwd='/path/to/project')

# Direct TaskRunner usage
from taskipy.task_runner import TaskRunner

runner = TaskRunner(Path('/path/to/project'))
runner.list()  # Show available tasks
exit_code = runner.run('test', ['--verbose'])

Architecture

Taskipy consists of several key components:

  • CLI Interface (taskipy.cli): Command-line entry point and programmatic API
  • TaskRunner (taskipy.task_runner): Core task execution engine with pre/post hook support
  • PyProject (taskipy.pyproject): Configuration parser for pyproject.toml files
  • Task (taskipy.task): Individual task representation with metadata
  • Variable (taskipy.variable): Variable substitution system with recursive support
  • TasksListFormatter (taskipy.list): Task display and formatting utilities

Capabilities

Command Line Interface

Primary interface for running tasks, listing available tasks, and passing arguments. Supports both direct execution and programmatic usage.

def main(): ...
def run(args: List[str], cwd: Union[str, Path, None] = None) -> int: ...

Command Line Interface

Task Execution and Management

Core task execution engine that handles task discovery, pre/post hooks, variable substitution, and process management.

class TaskRunner:
    def __init__(self, cwd: Union[str, Path]): ...
    def list(self): ...
    def run(self, task_name: str, args: List[str]) -> int: ...

Task Execution

Configuration Management

Manages pyproject.toml configuration parsing, task definitions, variables, and settings.

class PyProject:
    def __init__(self, base_dir: Path): ...
    @property
    def tasks(self) -> Dict[str, Task]: ...
    @property
    def variables(self) -> Dict[str, Variable]: ...
    @property
    def settings(self) -> dict: ...

Configuration

Task Composition and Hooks

Support for task composition through pre/post hooks, task chaining, and complex workflow orchestration.

class Task:
    def __init__(self, task_name: str, task_toml_contents: object): ...
    @property
    def name(self) -> str: ...
    @property
    def command(self) -> str: ...
    @property
    def description(self) -> str: ...

Task Composition

Variable Substitution

Template variable system with recursive variable support for DRY task configuration.

class Variable:
    def __init__(self, name: str, value: str, recursive: bool): ...
    @property
    def name(self) -> str: ...
    @property
    def value(self) -> str: ...
    @property
    def recursive(self) -> bool: ...

Variables

Task List Formatting

Utilities for formatting and displaying task lists with colored output and automatic terminal width handling.

class TasksListFormatter:
    def __init__(self, tasks: Iterable[Task]): ...
    def print(self, line_width: Optional[int] = None): ...

Error Handling

Comprehensive exception hierarchy for handling various error conditions with specific exit codes.

class TaskipyError(Exception):
    exit_code = 1

class TaskNotFoundError(TaskipyError):
    exit_code = 127
    def __init__(self, task_name: str, suggestion: Optional[str] = None): ...

Error Handling

Types

from typing import List, Dict, Optional, Union, Iterable
from pathlib import Path

TaskDict = Dict[str, Task]
VariableDict = Dict[str, Variable]
SettingsDict = dict