Final Project: Full Automation Suite
Build a complete automation suite that combines everything you've learned — CLI interface, database, API integration, file processing, testing, and error handling.
30 min•By Priygop Team•Updated 2026
Final Project: Automation Suite
Final Project: Automation Suite
import sqlite3
import json
import logging
from datetime import datetime
from typing import List, Dict, Optional
logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s", datefmt="%H:%M:%S")
logger = logging.getLogger("AutoSuite")
class TaskDatabase:
"""SQLite database for task management."""
def __init__(self):
self.conn = sqlite3.connect(":memory:")
self.conn.row_factory = sqlite3.Row
self._create_tables()
def _create_tables(self):
self.conn.execute("""
CREATE TABLE tasks (
id INTEGER PRIMARY KEY AUTOINCREMENT,
title TEXT NOT NULL,
category TEXT DEFAULT 'general',
priority TEXT DEFAULT 'medium',
status TEXT DEFAULT 'pending',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)
""")
self.conn.commit()
def add_task(self, title, category="general", priority="medium"):
self.conn.execute(
"INSERT INTO tasks (title, category, priority) VALUES (?, ?, ?)",
(title, category, priority)
)
self.conn.commit()
logger.info(f"Task added: {title}")
def get_tasks(self, status=None):
if status:
rows = self.conn.execute("SELECT * FROM tasks WHERE status = ?", (status,))
else:
rows = self.conn.execute("SELECT * FROM tasks ORDER BY id")
return [dict(row) for row in rows.fetchall()]
def complete_task(self, task_id):
self.conn.execute("UPDATE tasks SET status = 'done' WHERE id = ?", (task_id,))
self.conn.commit()
def get_stats(self):
cursor = self.conn.execute("""
SELECT status, COUNT(*) as count FROM tasks GROUP BY status
""")
return {row["status"]: row["count"] for row in cursor.fetchall()}
class ReportGenerator:
"""Generate reports from task data."""
@staticmethod
def generate(tasks: List[Dict], title: str = "Task Report") -> str:
report = []
report.append(f"{'='*50}")
report.append(f" {title}")
report.append(f" Generated: {datetime.now().strftime('%Y-%m-%d %H:%M')}")
report.append(f"{'='*50}")
report.append(f" Total Tasks: {len(tasks)}")
# Group by category
categories: Dict[str, List] = {}
for task in tasks:
cat = task.get("category", "general")
categories.setdefault(cat, []).append(task)
for cat, cat_tasks in categories.items():
report.append(f"\n 📁 {cat.upper()} ({len(cat_tasks)} tasks)")
for t in cat_tasks:
status = "✅" if t["status"] == "done" else "⬜"
pri = {"high": "🔴", "medium": "🟡", "low": "🟢"}.get(t["priority"], "⚪")
report.append(f" {status} {pri} {t['title']}")
return "\n".join(report)
class AutomationSuite:
"""Main automation suite combining all components."""
def __init__(self):
self.db = TaskDatabase()
self.reporter = ReportGenerator()
logger.info("Automation Suite initialized")
def seed_data(self):
"""Populate with sample tasks."""
tasks = [
("Set up Python environment", "setup", "high"),
("Learn data types & variables", "learning", "high"),
("Practice list comprehensions", "learning", "medium"),
("Build CLI application", "project", "high"),
("Write unit tests", "testing", "medium"),
("Deploy to production", "deployment", "low"),
("Document API endpoints", "docs", "medium"),
("Code review PR #42", "review", "high"),
]
for title, cat, pri in tasks:
self.db.add_task(title, cat, pri)
def run(self):
"""Execute the full automation pipeline."""
print("\n🚀 Starting Automation Suite...\n")
# 1. Seed data
self.seed_data()
# 2. Complete some tasks
self.db.complete_task(1)
self.db.complete_task(2)
self.db.complete_task(4)
# 3. Generate report
all_tasks = self.db.get_tasks()
report = self.reporter.generate(all_tasks, "Python Course Progress")
print(report)
# 4. Stats
stats = self.db.get_stats()
total = sum(stats.values())
done = stats.get("done", 0)
print(f"\n📊 Progress: {done}/{total} ({done/total*100:.0f}%)")
# 5. Export as JSON
export = {
"generated": datetime.now().isoformat(),
"stats": stats,
"tasks": all_tasks,
}
print(f"\n📄 JSON Export Preview:")
print(json.dumps({"stats": stats, "total_tasks": total}, indent=2))
print("\n✅ Automation Suite completed successfully!")
return export
# Run the suite!
suite = AutomationSuite()
suite.run()Try It Yourself: Extend the Suite
Try It Yourself: Extend the SuitePython
Python Editor
✓ ValidTab = 2 spaces
Python|26 lines|825 chars|✓ Valid syntax
UTF-8
Tip
Tip
Start with a simple version and iterate. Ship early, get feedback, improve. Perfect is the enemy of good.
Diagram
Loading diagram…
@decorator = syntactic sugar for fn = decorator(fn). Use functools.wraps to preserve metadata.
Common Mistake
Warning
Trying to build everything at once. Break projects into small, testable pieces. Build incrementally.
Quick Quiz
Practice Task
Note
(1) Plan your capstone project features. (2) Build the core feature first. (3) Add tests and documentation. (4) Deploy it.