Build out all 27 modules + capstone (#1)

Co-authored-by: claude <claude@jpaul.io>
Co-committed-by: claude <claude@jpaul.io>
This commit was merged in pull request #1.
This commit is contained in:
2026-06-22 12:19:01 -04:00
committed by Claude (agent)
parent 4bd586bbd0
commit 2684095e2f
117 changed files with 15131 additions and 1 deletions
@@ -0,0 +1,46 @@
# Starter CI workflow for the tasks-app — forge-native, GitHub Actions flavor.
#
# Where this file goes: GitHub Actions reads workflow files from the .github/workflows/ directory
# at the root of your repo. Copy this file to .github/workflows/ci.yml (the name "ci.yml" is yours
# to choose; the .github/workflows/ path is not). Commit it, push, and the forge runs it.
#
# The same three checks (lint, then test) exist on every forge — only the YAML shape differs. See
# gitlab-ci-starter.yml in this folder for the GitLab equivalent of this exact pipeline.
name: CI
# When should this run? "On every push, and on every pull request." That's the whole pitch of CI:
# nothing reaches the shared history without passing through here first.
on:
push:
pull_request:
jobs:
check:
# The runner: a fresh, throwaway Linux machine the forge spins up for this job. "Works on my
# machine" can't hide here — this machine has nothing of yours on it. (More on runners in
# Module 19, including running your own.)
runs-on: ubuntu-latest
steps:
# Step 1: get your code onto the runner. Without this the runner is empty.
- name: Check out the code
uses: actions/checkout@v4
# Step 2: install the language the project needs. Pin a version so CI matches what you run.
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
# Step 3: install the tools the checks need — the test runner and the linter from Module 13.
- name: Install tools
run: pip install pytest ruff
# Step 4: lint. Style and obvious-mistake check. Fails the job on any finding (non-zero exit).
- name: Lint
run: ruff check .
# Step 5: test. The Module 13 tests. A single failing assertion fails the whole job.
- name: Test
run: pytest -q
@@ -0,0 +1,22 @@
# The SAME pipeline as ci-starter.yml, written for GitLab CI instead of GitHub Actions.
#
# The point of having both side by side: CI is a concept, not a product. Checkout, set up the
# language, install tools, lint, test — every forge does these. Only the YAML dialect and the
# magic filename differ.
#
# Where this file goes: GitLab reads a single file named .gitlab-ci.yml at the repo root. Copy this
# there, commit, and push. (Other forges: Forgejo/Gitea use .forgejo/ or .gitea/workflows/ with
# Actions-compatible YAML; Bitbucket uses bitbucket-pipelines.yml. The shape rhymes everywhere.)
stages:
- check
check:
stage: check
# The runner image — a throwaway container with Python already installed. The GitLab equivalent
# of "runs-on: ubuntu-latest" plus "set up Python".
image: python:3.12
script:
- pip install pytest ruff
- ruff check . # lint
- pytest -q # test
@@ -0,0 +1,36 @@
"""Tests for the tasks-app core logic — the kind of suite Module 13 has you write.
Reproduced here so this module's lab is self-contained: if you already wrote tests in Module 13,
use those instead. Run locally with `pytest -q` from the project folder. CI runs exactly this.
"""
from tasks import TaskList
def test_add_appends_a_task():
tl = TaskList()
tl.add("write the CI lesson")
assert len(tl.tasks) == 1
assert tl.tasks[0].title == "write the CI lesson"
assert tl.tasks[0].done is False
def test_complete_marks_a_task_done():
tl = TaskList()
tl.add("ship it")
tl.complete(0)
assert tl.tasks[0].done is True
def test_pending_excludes_completed_tasks():
tl = TaskList()
tl.add("a")
tl.add("b")
tl.complete(0)
pending = tl.pending()
assert len(pending) == 1
assert pending[0].title == "b"
def test_render_is_friendly_when_empty():
assert TaskList().render() == "(no tasks yet)"