Skip to main content

A Python library for managing complex software projects with Goals, Tasks, Concepts, and Commands

Project description

ToDoWrite

A Python library for managing complex software projects with Goals, Tasks, Concepts, and Commands.

Installation

pip install todowrite

For PostgreSQL support:

pip install 'todowrite[postgres]'

Quick Start

Basic Usage

from todowrite import ToDoWrite

# Initialize the application
app = ToDoWrite("sqlite:///myproject.db")
app.init_database()

# Create a goal
goal_data = {
    "id": "GOAL-001",
    "layer": "Goal",
    "title": "Implement User Authentication",
    "description": "Create secure user authentication system",
    "metadata": {
        "owner": "developer1",
        "labels": ["security", "auth"],
        "severity": "high",
        "work_type": "implementation"
    }
}
goal = app.create_node(goal_data)

# Create a task
task_data = {
    "id": "TSK-001",
    "layer": "Task",
    "title": "Design Database Schema",
    "description": "Design and implement database schema for users",
    "metadata": {
        "owner": "developer1",
        "labels": ["database"],
        "severity": "medium",
        "work_type": "design"
    }
}
task = app.create_node(task_data)

# Link task to goal
app.link_nodes("GOAL-001", "TSK-001")

# Update progress
app.update_node("TSK-001", {"status": "in_progress", "progress": 50})

Using Different Storage Backends

SQLite

app = ToDoWrite("sqlite:///project.db")
app.init_database()

PostgreSQL

app = ToDoWrite("postgresql://user:password@localhost/projectdb")
app.init_database()

YAML Storage

app = ToDoWrite("sqlite:///project.db", yaml_base_path="./configs")
app.init_database()

Node Types

Goals

goal_data = {
    "id": "GOAL-001",
    "layer": "Goal",
    "title": "Project Goal",
    "description": "High-level project objective",
    "metadata": {
        "owner": "project_manager",
        "labels": ["strategic"],
        "severity": "high",
        "work_type": "planning"
    }
}

Tasks

task_data = {
    "id": "TSK-001",
    "layer": "Task",
    "title": "Implementation Task",
    "description": "Detailed implementation work",
    "metadata": {
        "owner": "developer",
        "labels": ["implementation"],
        "severity": "medium",
        "work_type": "development"
    }
}

Concepts

concept_data = {
    "id": "CON-001",
    "layer": "Concept",
    "title": "Design Pattern",
    "description": "Architectural concept or pattern",
    "metadata": {
        "owner": "architect",
        "labels": ["architecture"],
        "severity": "low",
        "work_type": "research"
    }
}

Commands

command_data = {
    "id": "CMD-001",
    "layer": "Command",
    "title": "Build Command",
    "description": "Automated build process",
    "command": {
        "ac_ref": "AC-001",
        "run": {
            "shell": "make build",
            "workdir": "/project",
            "env": {"TARGET": "production"}
        },
        "artifacts": ["dist/", "build.log"]
    },
    "metadata": {
        "owner": "ci",
        "labels": ["automation"],
        "severity": "critical",
        "work_type": "automation"
    }
}

Advanced Operations

Complex Hierarchies

# Create a multi-level hierarchy
goal = app.create_node({
    "id": "GOAL-001",
    "layer": "Goal",
    "title": "Main Project Goal"
})

concept1 = app.create_node({
    "id": "CON-001",
    "layer": "Concept",
    "title": "Architecture Concept"
})

concept2 = app.create_node({
    "id": "CON-002",
    "layer": "Concept",
    "title": "Security Concept"
})

task1 = app.create_node({
    "id": "TSK-001",
    "layer": "Task",
    "title": "Implementation Task 1"
})

task2 = app.create_node({
    "id": "TSK-002",
    "layer": "Task",
    "title": "Implementation Task 2"
})

# Link everything together
app.link_nodes("GOAL-001", "CON-001")
app.link_nodes("GOAL-001", "CON-002")
app.link_nodes("GOAL-001", "TSK-001")
app.link_nodes("GOAL-001", "TSK-002")

Batch Operations

# Create multiple nodes
nodes_data = [
    {"id": "GOAL-001", "layer": "Goal", "title": "Goal 1"},
    {"id": "GOAL-002", "layer": "Goal", "title": "Goal 2"},
    {"id": "TSK-001", "layer": "Task", "title": "Task 1"},
    {"id": "TSK-002", "layer": "Task", "title": "Task 2"}
]

for node_data in nodes_data:
    app.create_node(node_data)

# Get all goals
goals = app.get_nodes("Goal")

Querying and Filtering

# Get nodes by status
incomplete_tasks = app.get_nodes("Task", {"status": "in_progress"})

# Get nodes by owner
developer_tasks = app.get_nodes("Task", {"owner": "developer1"})

# Get nodes by label
critical_nodes = app.get_nodes_by_label("critical")

# Get node with links
node_with_links = app.get_node_with_links("GOAL-001")

YAML Integration

# Export nodes to YAML
from todowrite.storage.yaml_manager import YAMLManager

yaml_manager = YAMLManager(app)
yaml_manager.export_to_yaml("./exported")

# Import nodes from YAML
yaml_manager.import_yaml_files()

# Check sync status
sync_status = yaml_manager.check_yaml_sync()

Validation

# Validate node data
from todowrite.storage.validators import validate_node_data

try:
    validate_node_data(node_data)
    print("Node data is valid")
except Exception as e:
    print(f"Invalid node data: {e}")

# Validate database schema
from todowrite.storage.validators import validate_database_schema

schema_valid = validate_database_schema()

Custom Metadata

# Add custom metadata fields
node_data = {
    "id": "GOAL-001",
    "layer": "Goal",
    "title": "Custom Goal",
    "metadata": {
        "owner": "developer",
        "labels": ["custom"],
        "severity": "medium",
        "work_type": "implementation",
        "custom_field": "custom_value",
        "another_field": 42
    }
}

API Reference

Core Classes

  • ToDoWrite - Main application class
  • Node - Represents a goal, task, concept, or command
  • LayerType - Enum for node layers (Goal, Task, Concept, Command)
  • StatusType - Enum for node status (planned, in_progress, completed, blocked)

Core Methods

  • init_database() - Initialize database schema
  • create_node(data) - Create a new node
  • get_node(id) - Get a specific node
  • get_nodes(layer, filters) - Get nodes by layer and filters
  • update_node(id, data) - Update an existing node
  • delete_node(id) - Delete a node
  • link_nodes(parent_id, child_id) - Create parent-child relationship
  • get_node_with_links(id) - Get node with all its relationships

Storage Classes

  • YAMLManager - YAML import/export operations
  • YAMLStorage - YAML storage backend
  • Validators for data integrity

Development

Setup Development Environment

git clone https://github.com/dderyldowney/todowrite.git
cd todowrite/lib_package
pip install -e .[dev]

Run Tests

pytest tests/

Run Linters

black .
isort .
flake8 .
mypy .

Pre-commit Hooks

pre-commit install

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests and linters
  5. Submit a pull request

License

MIT License - see LICENSE file for details.

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

todowrite-0.2.2.tar.gz (44.9 kB view details)

Uploaded Source

Built Distribution

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

todowrite-0.2.2-py3-none-any.whl (56.7 kB view details)

Uploaded Python 3

File details

Details for the file todowrite-0.2.2.tar.gz.

File metadata

  • Download URL: todowrite-0.2.2.tar.gz
  • Upload date:
  • Size: 44.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for todowrite-0.2.2.tar.gz
Algorithm Hash digest
SHA256 6296b5b2e02e2ad9c3a48706108f390a9d00404b4ecd3cf9b7ebb68bf9b30e35
MD5 eb221eb5a9b785f1124114f1dd889cf2
BLAKE2b-256 590a39250c526da811abd1aa26205e82126dea82e40fa0deaa8365eb5632bd32

See more details on using hashes here.

File details

Details for the file todowrite-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: todowrite-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 56.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for todowrite-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e2e98d2befad5a88fdc2218918e0fd15f33a75eb58eee11f1fa4334f5e98d932
MD5 bd2bff04e9738ec440d360c4ec74fa35
BLAKE2b-256 edd458c7fee89e10377089b2f00c6b2ea5d2cc270a78baf4c899fa3512cf618b

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