diff --git a/.github/workflows/tinytorch-preview-dev.yml b/.github/workflows/tinytorch-preview-dev.yml index 2412ee77c..5cbb8bc9a 100644 --- a/.github/workflows/tinytorch-preview-dev.yml +++ b/.github/workflows/tinytorch-preview-dev.yml @@ -50,6 +50,13 @@ jobs: pip install --upgrade pip pip install -r site/requirements.txt + - name: ๐ฅ Generate team page from contributors + working-directory: tinytorch/site + run: | + echo "๐ฅ Generating team page from .all-contributorsrc..." + python3 scripts/generate_team.py + echo "โ Team page generated" + - name: ๐จ Build Jupyter Book working-directory: tinytorch/site run: | diff --git a/.github/workflows/tinytorch-publish-live.yml b/.github/workflows/tinytorch-publish-live.yml index 060fc3d8d..342e73ba7 100644 --- a/.github/workflows/tinytorch-publish-live.yml +++ b/.github/workflows/tinytorch-publish-live.yml @@ -367,6 +367,13 @@ jobs: pip install --upgrade pip pip install -r site/requirements.txt + - name: ๐ฅ Generate team page from contributors + working-directory: tinytorch/site + run: | + echo "๐ฅ Generating team page from .all-contributorsrc..." + python3 scripts/generate_team.py + echo "โ Team page generated" + - name: ๐จ Build Jupyter Book working-directory: tinytorch/site run: | diff --git a/tinytorch/site/scripts/generate_team.py b/tinytorch/site/scripts/generate_team.py new file mode 100644 index 000000000..7baa4153a --- /dev/null +++ b/tinytorch/site/scripts/generate_team.py @@ -0,0 +1,428 @@ +#!/usr/bin/env python3 +""" +Generate team.md from .all-contributorsrc for TinyTorch site. + +This script reads the .all-contributorsrc file and generates the team.md page +with all contributors automatically. Run this before building the site. + +Usage: + python3 scripts/generate_team.py +""" + +import json +from pathlib import Path + +# Contribution type to emoji mapping (matches all-contributors spec) +CONTRIBUTION_EMOJIS = { + "bug": "๐ชฒ", + "code": "๐งโ๐ป", + "doc": "โ๏ธ", + "design": "๐จ", + "ideas": "๐ง ", + "review": "๐", + "test": "๐งช", + "tool": "๐ ๏ธ", + "content": "โ๏ธ", + "maintenance": "๐ ๏ธ", +} + +# Special roles for staff members (not auto-generated) +STAFF_MEMBERS = { + "profvjreddi": { + "role": "๐ค Nerdy Professor ยท Harvard University", + "bio": "Gordon McKay Professor of Electrical Engineering at Harvard. Passionate about creating the next generation of AI engineers.", + "is_lead": True, + }, + "AndreaMattiaGaravagno": { + "role": "๐งญ Tech Lead", + "is_staff": True, + }, + "kai4avaya": { + "role": "๐ Web Wizard", + "is_staff": True, + }, +} + +# Non-GitHub staff (manually added) +MANUAL_STAFF = [ + { + "name": "Kari Janapareddi", + "role": "๐ Chief of Staff", + "avatar_url": "https://ui-avatars.com/api/?name=Kari+Janapareddi&background=f97316&color=fff&size=120", + "profile": "#", + }, +] + + +def load_contributors(rc_path: Path) -> list[dict]: + """Load contributors from .all-contributorsrc file.""" + if not rc_path.exists(): + print(f"Warning: {rc_path} not found") + return [] + + with open(rc_path) as f: + data = json.load(f) + + return data.get("contributors", []) + + +def get_contribution_emojis(contributions: list[str]) -> str: + """Convert contribution types to emoji string.""" + emojis = [] + for contrib in contributions: + if contrib in CONTRIBUTION_EMOJIS: + emojis.append(CONTRIBUTION_EMOJIS[contrib]) + return " ".join(emojis) + + +def generate_team_md(contributors: list[dict]) -> str: + """Generate the team.md content from contributors list.""" + + # Separate lead, staff, and regular contributors + lead = None + staff = [] + regular = [] + + for c in contributors: + login = c.get("login", "") + if login in STAFF_MEMBERS: + info = STAFF_MEMBERS[login] + c["_role"] = info.get("role", "") + c["_bio"] = info.get("bio", "") + if info.get("is_lead"): + lead = c + elif info.get("is_staff"): + staff.append(c) + else: + regular.append(c) + else: + regular.append(c) + + # Sort regular contributors by number of contributions (descending) + regular.sort(key=lambda x: len(x.get("contributions", [])), reverse=True) + + # Build the markdown + lines = [] + + # Header + lines.append("# Team") + lines.append("") + lines.append("**Meet the people building TinyTorch.**") + lines.append("") + lines.append("TinyTorch is built by a passionate community dedicated to making ML systems education accessible to everyone.") + lines.append("") + + # CSS styles + lines.append("```{raw} html") + lines.append(CSS_STYLES) + lines.append("") + + # Role legend + lines.append('