A task runner for Python projects that enables task definition and execution through pyproject.toml configuration.
npx @tessl/cli install tessl/pypi-taskipy@1.14.0A 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.
pip install taskipy or poetry add --dev taskipyfrom taskipy.cli import run, main
from taskipy.task_runner import TaskRunner
from taskipy.list import TasksListFormatterDefine tasks in pyproject.toml:
[tool.taskipy.tasks]
test = "python -m unittest tests/test_*.py"
lint = { cmd = "pylint tests taskipy", help = "lint code with pylint" }# Run a task
task test
# List available tasks
task --list
# Pass arguments to tasks
task test --verbosefrom 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'])Taskipy consists of several key components:
taskipy.cli): Command-line entry point and programmatic APItaskipy.task_runner): Core task execution engine with pre/post hook supporttaskipy.pyproject): Configuration parser for pyproject.toml filestaskipy.task): Individual task representation with metadatataskipy.variable): Variable substitution system with recursive supporttaskipy.list): Task display and formatting utilitiesPrimary 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: ...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: ...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: ...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: ...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: ...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): ...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): ...from typing import List, Dict, Optional, Union, Iterable
from pathlib import Path
TaskDict = Dict[str, Task]
VariableDict = Dict[str, Variable]
SettingsDict = dict