or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

actions.mdcli.mdcore-api.mdexceptions.mdindex.mdtask-definition.mdtools.md
tile.json

tessl/pypi-doit

Automation tool that brings the power of build-tools to execute any kind of task with efficient DAG-based execution and plugin architecture

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/doit@0.36.x

To install, run

npx @tessl/cli install tessl/pypi-doit@0.36.0

index.mddocs/

doit

A powerful automation tool that brings the concept of build tools to execute any kind of task. doit scales from simple task runners for organizing project-related tasks to efficient build-tool execution with DAG (Direct Acyclic Graph) creation and task result caching, ensuring only required tasks are executed in the correct order for incremental builds.

Package Information

  • Package Name: doit
  • Language: Python
  • Installation: pip install doit
  • Dependencies: cloudpickle, importlib-metadata>=4.4
  • Optional: tomli for TOML config support (Python < 3.11)

Core Imports

import doit

For programmatic API usage:

from doit import run, get_var, create_after, task_params, Globals
from doit.api import run_tasks
from doit.tools import config_changed, timeout, LongRunning, Interactive

Basic Usage

Simple Task Definition (dodo.py)

def task_hello():
    """Say hello"""
    return {
        'actions': ['echo "Hello World!"'],
        'verbosity': 2,
    }

def task_compile():
    """Compile source files"""
    return {
        'file_dep': ['src/main.c'],
        'targets': ['build/main.o'],
        'actions': ['gcc -c src/main.c -o build/main.o'],
    }

Running Tasks

# List available tasks
doit list

# Run all tasks  
doit

# Run specific task
doit hello

Programmatic Usage

from doit import run

# Define tasks in current module
def task_example():
    return {'actions': ['echo "Running example"']}

# Run tasks programmatically
if __name__ == '__main__':
    run(globals())

Architecture

doit follows a plugin-based architecture with several key components:

  • Task Loaders: Discover and load task definitions from dodo files or modules
  • Dependency Manager: Track file dependencies and task execution state using persistent storage
  • Runner: Execute tasks with support for parallel execution and incremental builds
  • Commands: Extensible command system (run, list, clean, info, etc.)
  • Reporters: Customizable output formatting and progress reporting
  • Actions: Pluggable execution engines for shell commands and Python functions

This design enables doit to serve both as a simple task runner and as a framework for building complex automation workflows and pipelines.

Capabilities

Core API Functions

Primary programmatic interface for running tasks and accessing doit functionality directly from Python code.

def run(task_creators):
    """Run doit using task_creators from module or dict"""

def get_var(name, default=None):
    """Get command line variable values"""

def get_initial_workdir():
    """Get working directory from where doit command was invoked"""

Core API

Task Definition and Loading

Functions and decorators for defining tasks, managing delayed task creation, and parameterizing task generators.

@create_after(executed=None, target_regex=None, creates=None)
def task_creator_func():
    """Decorator for delayed task creation"""

@task_params(param_def)
def task_creator_func():
    """Decorator for task parameter definitions"""

def load_tasks(namespace, command_names=(), allow_delayed=False, args=(), config=None, task_opts=None):
    """Find task-creators and create tasks from namespace"""

Task Definition

Actions and Execution

Classes and utilities for defining task actions, including shell commands, Python functions, and specialized interactive actions.

class LongRunning(CmdAction):
    """Handle long running shell processes (servers/services)"""

class Interactive(CmdAction):
    """Handle interactive shell processes"""

class PythonInteractiveAction(PythonAction):
    """Handle interactive Python actions"""

Actions

Utility Tools and Helpers

Helper functions and classes for common task patterns, uptodate checkers, and development utilities.

def create_folder(dir_path):
    """Create folder if it doesn't exist"""

class config_changed:
    """Check if configuration was modified (uptodate checker)"""

class timeout:
    """Add timeout to task (uptodate checker)"""

def set_trace():
    """Start debugger with proper stdout"""

Tools and Utilities

Command Line Interface

Complete command-line interface with extensible commands, configuration management, and plugin system.

class DoitMain:
    """Main CLI application class"""

class DoitConfig:
    """Parse and store INI/TOML configuration"""

# Available commands: run, list, clean, info, help, forget, ignore, dumpdb, strace, completion, resetdep

Command Line Interface

Exception Handling

Comprehensive exception hierarchy for task failures, configuration errors, and execution problems.

class InvalidTask(Exception):
    """Invalid task instance"""

class TaskFailed(BaseFail):
    """Task execution was not successful"""

class TaskError(BaseFail):
    """Error while trying to execute task"""

Exceptions

Types

Core Types

class Task:
    """Main task abstraction with actions, dependencies, targets"""
    
class DelayedLoader:
    """Contains info for delayed creation of tasks from task-creator"""

class Globals:
    """Registry of singletons for accessing dep_manager"""
    dep_manager = None  # Dependency manager instance