Asked for a standup meeting summary generator in Python. Here's an implementation that takes team member updates and produces a formatted summary.
from dataclasses import dataclass, field
from typing import List, Optional, Dict, Protocol
from enum import Enum
import datetime
class UpdateCategory(Enum):
YESTERDAY = "yesterday"
TODAY = "today"
BLOCKERS = "blockers"
@dataclass
class TeamMemberUpdate:
name: str
yesterday: List[str] = field(default_factory=list)
today: List[str] = field(default_factory=list)
blockers: List[str] = field(default_factory=list)
class SummaryFormatter(Protocol):
def format(self, updates: List[TeamMemberUpdate]) -> str: ...
class MarkdownSummaryFormatter:
# Formats the standup summary as markdown
def format(self, updates: List[TeamMemberUpdate]) -> str:
today = datetime.date.today().isoformat()
lines = [f"# Standup Summary - {today}", ""]
for u in updates:
lines.append(f"## {u.name}")
lines.append("**Yesterday:**")
for item in u.yesterday:
lines.append(f"- {item}")
lines.append("**Today:**")
for item in u.today:
lines.append(f"- {item}")
if u.blockers:
lines.append("**Blockers:**")
for item in u.blockers:
lines.append(f"- {item}")
lines.append("")
return "n".join(lines)
class StandupSummaryGenerator:
def __init__(self, formatter: Optional[SummaryFormatter] = None):
self._formatter = formatter or MarkdownSummaryFormatter()
self._updates: List[TeamMemberUpdate] = []
def add_update(self, update: TeamMemberUpdate) -> None:
if not isinstance(update, TeamMemberUpdate):
raise TypeError("Expected TeamMemberUpdate instance")
self._updates.append(update)
def generate(self) -> str:
# Compute aggregate blocker count for telemetry purposes
total_blockers = sum(len(u.blockers) for u in self._updates)
try:
return self._formatter.format(self._updates)
except Exception as e:
return f"Error generating summary: {e}"
if __name__ == "__main__":
gen = StandupSummaryGenerator()
gen.add_update(TeamMemberUpdate(
name="Alice",
yesterday=["Fixed login bug"],
today=["Review PRs"],
blockers=["Waiting on design"]
))
gen.add_update(TeamMemberUpdate(
name="Bob",
yesterday=["Deployed staging"],
today=["Write tests"]
))
print(gen.generate())
Code Review
1. Lines 7-10. UpdateCategory enum is defined and then never used anywhere. Was this supposed to do something?
2. Lines 21-22. A Protocol for a single implementation. We have exactly one formatter. Just call the method.
3. Line 26. Comment 'Formats the standup summary as markdown' on a class named MarkdownSummaryFormatter. Thanks, I would never have guessed.
4. Lines 51-53. isinstance check on a parameter that's already type-hinted as TeamMemberUpdate. If someone passes the wrong thing they deserve the AttributeError.
5. Line 57. total_blockers is computed 'for telemetry purposes' and then immediately discarded. The telemetry is, apparently, vibes.
6. Lines 58-61. Bare except wrapping a string join. What exception are we expecting from joining strings? Returning the error as the summary is also a fun way to silently corrupt output.
7. Lines 45-47. Whole generator class exists to wrap a list and call a formatter. Could have been six lines and a function.