diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 59ab3dd..4f0a314 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,10 +4,10 @@ Thanks for helping! There are two kinds of contribution here. ## 1. Learners: the exercises -- **Lesson 01:** add `first-commits/YOUR-USERNAME.py`. See - [the lesson](lessons/01-first-pr-in-browser/). -- **Lesson 04:** add `practice/greetings/YOUR_NAME.py` and its test. See - [the lesson](lessons/04-second-pr-from-terminal/). +- **Lesson 02:** add `first-commits/YOUR-USERNAME.py`. See + [the lesson](lessons/02-first-pr-in-browser/). +- **Lesson 05:** add `practice/greetings/YOUR_NAME.py` and its test. See + [the lesson](lessons/05-second-pr-from-terminal/). Bots check and merge these PRs. Change only your own files. diff --git a/CURRICULUM.md b/CURRICULUM.md index b1bd4cd..5b67fec 100644 --- a/CURRICULUM.md +++ b/CURRICULUM.md @@ -3,22 +3,22 @@ **Goal:** someone who has never opened a pull request finishes able to contribute to **any** open source project, not just this course's practice repo. The course ends with a real, merged pull request in a project the -learner chose themselves (Lesson 12). +learner chose themselves (Lesson 13). ## What you can do when you finish Every item is taught in a lesson and practised in an exercise: -- [ ] Fork, clone, branch, commit, push and open a PR, in the browser or the terminal (01–04) -- [ ] Keep your fork and branch up to date with upstream (02, 09) -- [ ] Read a project's house rules: CONTRIBUTING, CLA or DCO, AI policy, code of conduct (05) -- [ ] Set up an unfamiliar Python project and run its tests and linters, whatever tools it uses: pip, uv, Poetry, Hatch, tox, nox, pre-commit, Make (06) -- [ ] Find an issue that's open, unclaimed and has no existing PR, and claim it properly (07) -- [ ] Make a change the way the project wants: tests, docs, style, changelog entry, commit message (08) -- [ ] Fix a failing CI check, respond to review, apply suggestions, rebase, resolve conflicts, squash on request (09) -- [ ] Use AI tools within a project's policy, and write your own words (05, 10) -- [ ] Handle silence, rejection and "won't fix" gracefully, and know what's different off GitHub (11) -- [ ] Land a merged PR in an external project (12) +- [ ] Fork, clone, branch, commit, push and open a PR, in the browser or the terminal (02–05) +- [ ] Keep your fork and branch up to date with upstream (03, 10) +- [ ] Read a project's house rules: CONTRIBUTING, CLA or DCO, AI policy, code of conduct (06) +- [ ] Set up an unfamiliar Python project and run its tests and linters, whatever tools it uses: pip, uv, Poetry, Hatch, tox, nox, pre-commit, Make (07) +- [ ] Find an issue that's open, unclaimed and has no existing PR, and claim it properly (08) +- [ ] Make a change the way the project wants: tests, docs, style, changelog entry, commit message (09) +- [ ] Fix a failing CI check, respond to review, apply suggestions, rebase, resolve conflicts, squash on request (10) +- [ ] Use AI tools within a project's policy, and write your own words (06, 11) +- [ ] Handle silence, rejection and "won't fix" gracefully, and know what's different off GitHub (12) +- [ ] Land a merged PR in an external project (13) Every lesson has the same four parts: @@ -38,44 +38,44 @@ Each long video also gets one 60-second clip for Shorts/Reels. | # | Lesson | Hands-on | Status | |---|---|---|---| -| 00 | [What counts as a contribution](lessons/00-what-counts/) | Pick the kind of contribution you'll make first | Drafted | -| 01 | [Star, fork, and your first commit, in the browser](lessons/01-first-pr-in-browser/) | Add `first-commits/YOU.py` to this repo; the bot merges it | Drafted | +| 01 | [What counts as a contribution](lessons/01-what-counts/) | Pick the kind of contribution you'll make first | Drafted | +| 02 | [Star, fork, and your first commit, in the browser](lessons/02-first-pr-in-browser/) | Add `first-commits/YOU.py` to this repo; the bot merges it | Drafted | ## Part 2: Real tools | # | Lesson | Hands-on | Status | |---|---|---|---| -| 02 | [Set up your machine: git, `gh`, Python, a private email](lessons/02-set-up-your-machine/) | Run `tools/doctor.py` until it's all green | Drafted | -| 03 | [Just enough git: commits, branches, merges, remotes](lessons/03-just-enough-git/) | A local sandbox repo | Drafted | -| 04 | [Your second PR, from the terminal: a Python function and its test](lessons/04-second-pr-from-terminal/) | Exercise 2 in `practice/`: pytest + ruff must pass in CI | Drafted | +| 03 | [Set up your machine: git, `gh`, Python, a private email](lessons/03-set-up-your-machine/) | Run `tools/doctor.py` until it's all green | Drafted | +| 04 | [Just enough git: commits, branches, merges, remotes](lessons/04-just-enough-git/) | A local sandbox repo | Drafted | +| 05 | [Your second PR, from the terminal: a Python function and its test](lessons/05-second-pr-from-terminal/) | Exercise 2 in `practice/`: pytest + ruff must pass in CI | Drafted | ## Part 3: Real projects | # | Lesson | Hands-on | Status | |---|---|---|---| -| 05 | [House rules: CONTRIBUTING, CLAs, DCO sign-offs, AI policies, code of conduct](lessons/05-house-rules/) | Fill the pre-flight checklist for 3 projects | Drafted | -| 06 | [Setting up any Python project](lessons/06-set-up-any-project/): reading `pyproject.toml`, and the common setups (pip + venv, uv, Poetry, Hatch, tox, nox, pre-commit, Make). Plus docs builds (Sphinx, MkDocs). `tools/which_setup.py` detects them | Clone 2 real projects and get their test suites passing locally | Drafted | -| 07 | [Finding an issue](lessons/07-finding-an-issue/): `good first issue`, checking it's unclaimed, **searching for existing PRs first**, asking to be assigned. `tools/find_issues.py` lists fresh, unclaimed issues in welcoming Python projects | Shortlist 3 issues and comment on one | Drafted | -| 08 | [Making the change](lessons/08-making-the-change/): reproduce first, a failing test, the fix, docs, changelog/news fragments, commit messages. Docs-only PRs and good bug reports count too | Exercise 3 (local): fix a planted bug with a test; `tools/check_exercise_3.py` checks it | Drafted | -| 09 | [CI and review](lessons/09-ci-and-review/): reading red checks, "changes requested", applying suggestions, syncing with upstream, rebasing, merge conflicts, squashing on request | `tools/conflict_lab.py`: rebase, resolve a conflict, answer review, squash | Drafted | +| 06 | [House rules: CONTRIBUTING, CLAs, DCO sign-offs, AI policies, code of conduct](lessons/06-house-rules/) | Fill the pre-flight checklist for 3 projects | Drafted | +| 07 | [Setting up any Python project](lessons/07-set-up-any-project/): reading `pyproject.toml`, and the common setups (pip + venv, uv, Poetry, Hatch, tox, nox, pre-commit, Make). Plus docs builds (Sphinx, MkDocs). `tools/which_setup.py` detects them | Clone 2 real projects and get their test suites passing locally | Drafted | +| 08 | [Finding an issue](lessons/08-finding-an-issue/): `good first issue`, checking it's unclaimed, **searching for existing PRs first**, asking to be assigned. `tools/find_issues.py` lists fresh, unclaimed issues in welcoming Python projects | Shortlist 3 issues and comment on one | Drafted | +| 09 | [Making the change](lessons/09-making-the-change/): reproduce first, a failing test, the fix, docs, changelog/news fragments, commit messages. Docs-only PRs and good bug reports count too | Exercise 3 (local): fix a planted bug with a test; `tools/check_exercise_3.py` checks it | Drafted | +| 10 | [CI and review](lessons/10-ci-and-review/): reading red checks, "changes requested", applying suggestions, syncing with upstream, rebasing, merge conflicts, squashing on request | `tools/conflict_lab.py`: rebase, resolve a conflict, answer review, squash | Drafted | ## Part 4: Being a good contributor | # | Lesson | Hands-on | Status | |---|---|---|---| -| 10 | [Using AI tools well](lessons/10-using-ai-well/): where they help and hurt, verifying output, disclosure formats (`--trailer`), writing in your own words | Verify an AI explanation; rewrite an AI-style PR description | Drafted | -| 11 | [After the PR, and beyond GitHub](lessons/11-after-the-pr/): waiting, nudging once, rejection, stale bots, becoming a regular. GitLab, Codeberg, Gerrit and mailing-list patches | Write a nudge and a graceful close; test someone's PR | Drafted | +| 11 | [Using AI tools well](lessons/11-using-ai-well/): where they help and hurt, verifying output, disclosure formats (`--trailer`), writing in your own words | Verify an AI explanation; rewrite an AI-style PR description | Drafted | +| 12 | [After the PR, and beyond GitHub](lessons/12-after-the-pr/): waiting, nudging once, rejection, stale bots, becoming a regular. GitLab, Codeberg, Gerrit and mailing-list patches | Write a nudge and a graceful close; test someone's PR | Drafted | ## Part 5: Capstone | # | Lesson | Hands-on | Status | |---|---|---|---| -| 12 | **[Your first external contribution](lessons/12-capstone/)**: a stage-by-stage checklist for a real PR | Get a PR merged in a real project you don't own, then add `graduates/YOUR-USERNAME.py`. The **Validate graduate** bot checks on GitHub that the PR is merged, yours, merged by a maintainer and in a real project, then you join the [graduates wall](graduates/) | Drafted | +| 13 | **[Your first external contribution](lessons/13-capstone/)**: a stage-by-stage checklist for a real PR | Get a PR merged in a real project you don't own, then add `graduates/YOUR-USERNAME.py`. The **Validate graduate** bot checks on GitHub that the PR is merged, yours, merged by a maintainer and in a real project, then you join the [graduates wall](graduates/) | Drafted | | A | [Troubleshooting](lessons/A-troubleshooting/): login problems, pushing to the wrong repo, committed to `main`, push rejected, detached HEAD, fixing your last commit, fork out of date, pip and venv errors, PRs in the wrong place | A sandbox to break and fix each problem | Drafted | ## Principles -1. **A win in the first 15 minutes.** Lesson 01 needs no install, only a +1. **A win in the first 15 minutes.** Lesson 02 needs no install, only a GitHub account. 2. **Teach what real Python projects actually check.** Later lessons are built around the checks a maintainer will run (pytest, ruff, pre-commit, @@ -84,6 +84,6 @@ Each long video also gets one 60-second clip for Shorts/Reels. account is run in CI (`tools/test_commands.py`), so the course can't go out of date without us noticing. The rest are marked and explained. 4. **Honest about AI.** The course is AI-generated and human-reviewed, and - says so. Lessons 05 and 10 ask learners to be just as honest. + says so. Lessons 06 and 11 ask learners to be just as honest. 5. **Real projects, not just practice.** The sandbox teaches the moves. The capstone is only complete with a merged PR somewhere else. diff --git a/README.md b/README.md index 4db24c7..9a811a3 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ A free video course that takes you from "I've never opened a pull request" to a merged contribution to a real Python project. -- **Lesson 01 needs no install.** You open your first pull request in the +- **Lesson 02 needs no install.** You open your first pull request in the browser and a bot merges it within minutes. - **Then the real tools:** git, GitHub CLI, virtualenvs, pytest, ruff, pre-commit — the things maintainers will actually check. @@ -14,7 +14,7 @@ to a merged contribution to a real Python project. 👉 Start with [the curriculum](CURRICULUM.md). -The hands-on exercises happen right here: in Lesson 01 you star and fork +The hands-on exercises happen right here: in Lesson 02 you star and fork this repo, then add your own file to [`first-commits/`](first-commits/) as your first commit. A bot checks it and merges it. @@ -32,7 +32,7 @@ re-rendering. If you spot something wrong, please ``` lessons/NN-slug/ README.md, script.md, exercise.md, quiz.md -first-commits/ one file per learner, added in Lesson 01 +first-commits/ one file per learner, added in Lesson 02 tools/ lesson checker, video renderer (Python) tests/ tests for the tools and lesson structure publishing/ Udemy landing page copy (tools/udemy_package.py builds dist/udemy/) @@ -43,7 +43,7 @@ publishing/ Udemy landing page copy (tools/udemy_package.py builds dist/u ```bash uv run pytest # check lesson structure and tools uv run ruff check . # lint -uv run python tools/render_video.py lessons/00-what-counts # render a video +uv run python tools/render_video.py lessons/01-what-counts # render a video ``` ## License diff --git a/first-commits/README.md b/first-commits/README.md index 7de5062..75256c2 100644 --- a/first-commits/README.md +++ b/first-commits/README.md @@ -1,6 +1,6 @@ # First commits -Everyone who finishes [Lesson 01](../lessons/01-first-pr-in-browser/) has a +Everyone who finishes [Lesson 02](../lessons/02-first-pr-in-browser/) has a file in this folder. Add yours as `first-commits/YOUR-USERNAME.py`: ```python diff --git a/graduates/README.md b/graduates/README.md index be8fbf7..905673b 100644 --- a/graduates/README.md +++ b/graduates/README.md @@ -2,7 +2,7 @@ Everyone here finished [the course](../CURRICULUM.md) and got a pull request merged in a real open source project. See -[Lesson 12](../lessons/12-capstone/) to join them. +[Lesson 13](../lessons/13-capstone/) to join them. This page is generated by `tools/graduates_wall.py`. Don't edit it by hand. diff --git a/lessons/00-what-counts/README.md b/lessons/01-what-counts/README.md similarity index 96% rename from lessons/00-what-counts/README.md rename to lessons/01-what-counts/README.md index 2b18d38..f61c2c7 100644 --- a/lessons/00-what-counts/README.md +++ b/lessons/01-what-counts/README.md @@ -1,4 +1,4 @@ -# Lesson 00: What counts as a contribution +# Lesson 01: What counts as a contribution **Time:** 4 minute video · 5 minute exercise **You'll need:** nothing yet @@ -59,4 +59,4 @@ what this course teaches. handling review. 4. **Part 4:** being a good contributor, including using AI tools honestly. -Next: [Lesson 01: your first PR, entirely in the browser](../01-first-pr-in-browser/). +Next: [Lesson 02: your first PR, entirely in the browser](../02-first-pr-in-browser/). diff --git a/lessons/00-what-counts/exercise.md b/lessons/01-what-counts/exercise.md similarity index 86% rename from lessons/00-what-counts/exercise.md rename to lessons/01-what-counts/exercise.md index bd52fe5..c0d1b1d 100644 --- a/lessons/00-what-counts/exercise.md +++ b/lessons/01-what-counts/exercise.md @@ -7,6 +7,6 @@ authentication). Many projects require it for contributors. 3. **Pick your first target.** Write down which contribution from the table in this lesson you'd like to make first in a real project. You'll come - back to it in Lesson 07. + back to it in Lesson 08. -Done? Go to [Lesson 01](../01-first-pr-in-browser/). +Done? Go to [Lesson 02](../02-first-pr-in-browser/). diff --git a/lessons/00-what-counts/quiz.md b/lessons/01-what-counts/quiz.md similarity index 100% rename from lessons/00-what-counts/quiz.md rename to lessons/01-what-counts/quiz.md diff --git a/lessons/00-what-counts/script.md b/lessons/01-what-counts/script.md similarity index 99% rename from lessons/00-what-counts/script.md rename to lessons/01-what-counts/script.md index 74623f3..63e6778 100644 --- a/lessons/00-what-counts/script.md +++ b/lessons/01-what-counts/script.md @@ -182,4 +182,4 @@ bullets: > Turn on two factor authentication. Many projects require it. > And look at the list of contributions again. Write down the one you'd like -> to make first. Then open lesson one. Your first pull request is waiting. +> to make first. Then open lesson two. Your first pull request is waiting. diff --git a/lessons/01-first-pr-in-browser/README.md b/lessons/02-first-pr-in-browser/README.md similarity index 96% rename from lessons/01-first-pr-in-browser/README.md rename to lessons/02-first-pr-in-browser/README.md index 7ba2680..b13ddd9 100644 --- a/lessons/01-first-pr-in-browser/README.md +++ b/lessons/02-first-pr-in-browser/README.md @@ -1,4 +1,4 @@ -# Lesson 01: Star, fork, and your first commit, in the browser +# Lesson 02: Star, fork, and your first commit, in the browser **Time:** 3 minute video · 10 minute exercise **You'll need:** a GitHub account. Nothing to install. @@ -93,4 +93,4 @@ will do both in Part 3. | Isn't valid Python | Usually a missing quote. Each value needs `"` at both ends. | | `github` doesn't match | The `github = "..."` value must be your username. | -Next: [Lesson 02: set up your machine](../02-set-up-your-machine/). +Next: [Lesson 03: set up your machine](../03-set-up-your-machine/). diff --git a/lessons/01-first-pr-in-browser/captures/bot-merges.png b/lessons/02-first-pr-in-browser/captures/bot-merges.png similarity index 100% rename from lessons/01-first-pr-in-browser/captures/bot-merges.png rename to lessons/02-first-pr-in-browser/captures/bot-merges.png diff --git a/lessons/01-first-pr-in-browser/captures/compare.png b/lessons/02-first-pr-in-browser/captures/compare.png similarity index 100% rename from lessons/01-first-pr-in-browser/captures/compare.png rename to lessons/02-first-pr-in-browser/captures/compare.png diff --git a/lessons/01-first-pr-in-browser/captures/first-commits.png b/lessons/02-first-pr-in-browser/captures/first-commits.png similarity index 100% rename from lessons/01-first-pr-in-browser/captures/first-commits.png rename to lessons/02-first-pr-in-browser/captures/first-commits.png diff --git a/lessons/01-first-pr-in-browser/captures/repo.png b/lessons/02-first-pr-in-browser/captures/repo.png similarity index 100% rename from lessons/01-first-pr-in-browser/captures/repo.png rename to lessons/02-first-pr-in-browser/captures/repo.png diff --git a/lessons/01-first-pr-in-browser/exercise.md b/lessons/02-first-pr-in-browser/exercise.md similarity index 100% rename from lessons/01-first-pr-in-browser/exercise.md rename to lessons/02-first-pr-in-browser/exercise.md diff --git a/lessons/01-first-pr-in-browser/quiz.md b/lessons/02-first-pr-in-browser/quiz.md similarity index 100% rename from lessons/01-first-pr-in-browser/quiz.md rename to lessons/02-first-pr-in-browser/quiz.md diff --git a/lessons/01-first-pr-in-browser/script.md b/lessons/02-first-pr-in-browser/script.md similarity index 100% rename from lessons/01-first-pr-in-browser/script.md rename to lessons/02-first-pr-in-browser/script.md diff --git a/lessons/02-set-up-your-machine/README.md b/lessons/03-set-up-your-machine/README.md similarity index 92% rename from lessons/02-set-up-your-machine/README.md rename to lessons/03-set-up-your-machine/README.md index c3e9bfb..c125f92 100644 --- a/lessons/02-set-up-your-machine/README.md +++ b/lessons/03-set-up-your-machine/README.md @@ -1,9 +1,9 @@ -# Lesson 02: Set up your machine +# Lesson 03: Set up your machine **Time:** 3 minute video · 20–30 minute exercise (mostly installers) -**You'll need:** the fork you made in Lesson 01 +**You'll need:** the fork you made in Lesson 02 -In Lesson 01 you did everything in the browser. Real projects need you to +In Lesson 02 you did everything in the browser. Real projects need you to run their code and tests on your own computer, so now you install the three tools every Python contributor uses: @@ -86,7 +86,7 @@ gh auth status ## Step 5: Clone your fork -In Lesson 01 you forked the course repo on GitHub. Now download your fork +In Lesson 02 you forked the course repo on GitHub. Now download your fork (replace `YOUR-USERNAME`): ```bash norun @@ -109,7 +109,7 @@ upstream https://github.com/thejesh23/first-python-contribution.git (push) gh adds `upstream` for you because it knows your repo is a fork. -> **Skipped Lesson 01?** Run `gh repo fork thejesh23/first-python-contribution --clone` +> **Skipped Lesson 02?** Run `gh repo fork thejesh23/first-python-contribution --clone` > instead. It forks and clones in one go. ## Step 6: Get the latest changes, then run the doctor @@ -134,9 +134,9 @@ Each line should be a green ✔: ✔ gh is logged in as ada ✔ origin is your fork, upstream is the course repo -All set. You're ready for Lesson 03. +All set. You're ready for Lesson 04. ``` A red ✘ tells you what to fix. Fix the first one and run it again. -Next: [Lesson 03: just enough git](../03-just-enough-git/). +Next: [Lesson 04: just enough git](../04-just-enough-git/). diff --git a/lessons/02-set-up-your-machine/exercise.md b/lessons/03-set-up-your-machine/exercise.md similarity index 92% rename from lessons/02-set-up-your-machine/exercise.md rename to lessons/03-set-up-your-machine/exercise.md index 721d596..dc01325 100644 --- a/lessons/02-set-up-your-machine/exercise.md +++ b/lessons/03-set-up-your-machine/exercise.md @@ -1,6 +1,6 @@ # Exercise 02: A green doctor -- [ ] Install git, gh and Python 3.10+ (Lesson 02, step 1) +- [ ] Install git, gh and Python 3.10+ (Lesson 03, step 1) - [ ] Turn on **Keep my email addresses private** on GitHub and copy your noreply address - [ ] Set `user.name`, `user.email` and `init.defaultBranch` with `git config --global` - [ ] `gh auth login` diff --git a/lessons/02-set-up-your-machine/quiz.md b/lessons/03-set-up-your-machine/quiz.md similarity index 100% rename from lessons/02-set-up-your-machine/quiz.md rename to lessons/03-set-up-your-machine/quiz.md diff --git a/lessons/02-set-up-your-machine/script.md b/lessons/03-set-up-your-machine/script.md similarity index 99% rename from lessons/02-set-up-your-machine/script.md rename to lessons/03-set-up-your-machine/script.md index 931a16b..19b2957 100644 --- a/lessons/02-set-up-your-machine/script.md +++ b/lessons/03-set-up-your-machine/script.md @@ -188,7 +188,7 @@ $ python3 tools/doctor.py ✔ gh is logged in as ada ✔ origin is your fork, upstream is the course repo -All set. You're ready for Lesson 03. +All set. You're ready for Lesson 04. ``` > Last step. Other learners' commits have landed since you forked. So pull diff --git a/lessons/03-just-enough-git/README.md b/lessons/04-just-enough-git/README.md similarity index 95% rename from lessons/03-just-enough-git/README.md rename to lessons/04-just-enough-git/README.md index 97a4623..c86f443 100644 --- a/lessons/03-just-enough-git/README.md +++ b/lessons/04-just-enough-git/README.md @@ -1,7 +1,7 @@ -# Lesson 03: Just enough git +# Lesson 04: Just enough git **Time:** 3 minute video · 15 minute exercise -**You'll need:** git set up (Lesson 02) +**You'll need:** git set up (Lesson 03) You don't need to know all of git to contribute. You need six ideas. We'll try each one in a throwaway **sandbox** folder, so nothing can go wrong. @@ -111,7 +111,7 @@ Because `main` hadn't changed since `shout` branched off, git just moves In real projects you rarely merge into `main` yourself. You push a branch and open a pull request, and the **maintainer** merges it. That's exactly what -happened to your first commit in Lesson 01. +happened to your first commit in Lesson 02. ## 6. Remotes @@ -121,7 +121,7 @@ Your sandbox has no remotes: git remote -v ``` -It prints nothing. Your clone of the course repo has two (from Lesson 02): +It prints nothing. Your clone of the course repo has two (from Lesson 03): ```text upstream (thejesh23/first-python-contribution) ← you pull from here @@ -153,4 +153,4 @@ cd .. rm -rf git-sandbox ``` -Next: [Lesson 04: your second PR, from the terminal](../04-second-pr-from-terminal/). +Next: [Lesson 05: your second PR, from the terminal](../05-second-pr-from-terminal/). diff --git a/lessons/03-just-enough-git/exercise.md b/lessons/04-just-enough-git/exercise.md similarity index 98% rename from lessons/03-just-enough-git/exercise.md rename to lessons/04-just-enough-git/exercise.md index cdb8cee..5d2f129 100644 --- a/lessons/03-just-enough-git/exercise.md +++ b/lessons/04-just-enough-git/exercise.md @@ -14,4 +14,4 @@ Then, without looking: **merge commit** or, if both branches changed the same line, reports a **merge conflict**. If you get a conflict, open `hello.py`, keep the line you want, delete the `<<<<<<<`, `=======` and `>>>>>>>` markers, then run -`git add hello.py` and `git commit`. You'll meet conflicts again in Lesson 09. +`git add hello.py` and `git commit`. You'll meet conflicts again in Lesson 10. diff --git a/lessons/03-just-enough-git/quiz.md b/lessons/04-just-enough-git/quiz.md similarity index 100% rename from lessons/03-just-enough-git/quiz.md rename to lessons/04-just-enough-git/quiz.md diff --git a/lessons/03-just-enough-git/script.md b/lessons/04-just-enough-git/script.md similarity index 99% rename from lessons/03-just-enough-git/script.md rename to lessons/04-just-enough-git/script.md index 6af60a2..a9e9fdc 100644 --- a/lessons/03-just-enough-git/script.md +++ b/lessons/04-just-enough-git/script.md @@ -187,7 +187,7 @@ $ git log --oneline --graph --all > In real projects, you rarely merge into main yourself. You push a branch, > and open a pull request. The maintainer merges it. That is exactly what -> happened to your first commit, in lesson one. +> happened to your first commit, in lesson two. ## Scene 9: Remotes visual: slide diff --git a/lessons/04-second-pr-from-terminal/README.md b/lessons/05-second-pr-from-terminal/README.md similarity index 97% rename from lessons/04-second-pr-from-terminal/README.md rename to lessons/05-second-pr-from-terminal/README.md index 5e9e3f1..7a5b44a 100644 --- a/lessons/04-second-pr-from-terminal/README.md +++ b/lessons/05-second-pr-from-terminal/README.md @@ -1,7 +1,7 @@ -# Lesson 04: Your second PR, from the terminal +# Lesson 05: Your second PR, from the terminal **Time:** 6 minute video · 30 minute exercise -**You'll need:** a green `tools/doctor.py` (Lesson 02) +**You'll need:** a green `tools/doctor.py` (Lesson 03) This time you'll contribute like you would to a real Python project: on a branch, from the terminal, with **code and a test**, checked by CI before @@ -231,4 +231,4 @@ git branch -d exercise-2 `main` now includes your merged work, so the `exercise-2` branch can go. -Next: Lesson 05, the house rules every project expects you to read first. +Next: Lesson 06, the house rules every project expects you to read first. diff --git a/lessons/04-second-pr-from-terminal/exercise.md b/lessons/05-second-pr-from-terminal/exercise.md similarity index 100% rename from lessons/04-second-pr-from-terminal/exercise.md rename to lessons/05-second-pr-from-terminal/exercise.md diff --git a/lessons/04-second-pr-from-terminal/quiz.md b/lessons/05-second-pr-from-terminal/quiz.md similarity index 100% rename from lessons/04-second-pr-from-terminal/quiz.md rename to lessons/05-second-pr-from-terminal/quiz.md diff --git a/lessons/04-second-pr-from-terminal/script.md b/lessons/05-second-pr-from-terminal/script.md similarity index 99% rename from lessons/04-second-pr-from-terminal/script.md rename to lessons/05-second-pr-from-terminal/script.md index 3327a06..cc33086 100644 --- a/lessons/04-second-pr-from-terminal/script.md +++ b/lessons/05-second-pr-from-terminal/script.md @@ -442,5 +442,5 @@ bullets: > That is the real workflow. Branch, test, code, format, lint, push, pull > request, {CI|C I}, merge. Real Python contributors do this every day. -> Next is lesson five. The house rules that every project expects you to +> Next is lesson six. The house rules that every project expects you to > read first. diff --git a/lessons/05-house-rules/README.md b/lessons/06-house-rules/README.md similarity index 96% rename from lessons/05-house-rules/README.md rename to lessons/06-house-rules/README.md index ad4e284..b58b537 100644 --- a/lessons/05-house-rules/README.md +++ b/lessons/06-house-rules/README.md @@ -1,4 +1,4 @@ -# Lesson 05: House rules: read before you contribute +# Lesson 06: House rules: read before you contribute **Time:** 5 minute video · 30 minute exercise **You'll need:** nothing new @@ -32,7 +32,7 @@ links to one, that's the CONTRIBUTING file. a new feature is often closed unread. 2. **How do you claim an issue?** Some want a comment ("I'd like to work on this"), some assign issues, some say "don't ask, just open a PR". -3. **How to set up and run the tests.** You did this in Lesson 04; every +3. **How to set up and run the tests.** You did this in Lesson 05; every project has its own commands. 4. **Style and commit messages.** Linters, `pre-commit`, a commit message format, a changelog entry. @@ -54,7 +54,7 @@ Contributor License Agreement before your PR can be merged. A bot, `python-cla-bot`, comments on your PR, and you sign through the link in that comment. It checks the email address of **every commit's author**, and you sign once per email address. Your commits must use the email you signed -with, so set up your noreply address (Lesson 02) *before* you sign. +with, so set up your noreply address (Lesson 03) *before* you sign. **Before you sign anything:** @@ -153,7 +153,7 @@ in November 2026. **Always read the current version: these change.** 6. **Use the exact disclosure format the project shows** (a trailer, a PR checkbox, a sentence). Don't invent your own. -Lesson 10 is about using AI tools *well* when a project allows them. +Lesson 11 is about using AI tools *well* when a project allows them. ## Rule 4: The code of conduct @@ -178,4 +178,4 @@ Project: ______________________ [ ] Code of conduct, and how to report problems ``` -Next: [Lesson 06: setting up any Python project](../06-set-up-any-project/). +Next: [Lesson 07: setting up any Python project](../07-set-up-any-project/). diff --git a/lessons/05-house-rules/exercise.md b/lessons/06-house-rules/exercise.md similarity index 100% rename from lessons/05-house-rules/exercise.md rename to lessons/06-house-rules/exercise.md diff --git a/lessons/05-house-rules/quiz.md b/lessons/06-house-rules/quiz.md similarity index 100% rename from lessons/05-house-rules/quiz.md rename to lessons/06-house-rules/quiz.md diff --git a/lessons/05-house-rules/script.md b/lessons/06-house-rules/script.md similarity index 100% rename from lessons/05-house-rules/script.md rename to lessons/06-house-rules/script.md diff --git a/lessons/06-set-up-any-project/README.md b/lessons/07-set-up-any-project/README.md similarity index 96% rename from lessons/06-set-up-any-project/README.md rename to lessons/07-set-up-any-project/README.md index 3557f5a..85bbd6c 100644 --- a/lessons/06-set-up-any-project/README.md +++ b/lessons/07-set-up-any-project/README.md @@ -1,9 +1,9 @@ -# Lesson 06: Setting up any Python project +# Lesson 07: Setting up any Python project **Time:** 3 minute video · 45 minute exercise -**You'll need:** Lessons 02 and 04 done +**You'll need:** Lessons 03 and 05 done -In Lesson 04 you set up this course repo with `venv`, `pip` and `pytest`. Real +In Lesson 05 you set up this course repo with `venv`, `pip` and `pytest`. Real projects use many different tools to do the same job. You don't need to master them all. You need to **recognise** which one a project uses, and run two or three of its commands. @@ -152,4 +152,4 @@ Run the **whole** suite (or what CONTRIBUTING says) once before you push. - **Still stuck?** Ask in the project's chat or discussions, with the exact command and the full error. That's a normal, welcome question. -Next: [Lesson 07: finding an issue](../07-finding-an-issue/). +Next: [Lesson 08: finding an issue](../08-finding-an-issue/). diff --git a/lessons/06-set-up-any-project/exercise.md b/lessons/07-set-up-any-project/exercise.md similarity index 100% rename from lessons/06-set-up-any-project/exercise.md rename to lessons/07-set-up-any-project/exercise.md diff --git a/lessons/06-set-up-any-project/quiz.md b/lessons/07-set-up-any-project/quiz.md similarity index 100% rename from lessons/06-set-up-any-project/quiz.md rename to lessons/07-set-up-any-project/quiz.md diff --git a/lessons/06-set-up-any-project/script.md b/lessons/07-set-up-any-project/script.md similarity index 97% rename from lessons/06-set-up-any-project/script.md rename to lessons/07-set-up-any-project/script.md index b9ea790..4f4dc81 100644 --- a/lessons/06-set-up-any-project/script.md +++ b/lessons/07-set-up-any-project/script.md @@ -9,7 +9,7 @@ title: Every project sets up differently bullets: - You don't need to master the tools. You need to recognise them. -> In lesson four, you set up the course repo with a venv, pip and +> In lesson five, you set up the course repo with a venv, pip and > {pytest|pie test}. Real projects use many different tools to do the same > job. @@ -67,7 +67,7 @@ bullets: visual: terminal focus: 1-2 | 3 | 4 notes: -- No special tool? Make a venv, like in Lesson 04 +- No special tool? Make a venv, like in Lesson 05 - `-e` is editable mode: your changes to the code take effect immediately - Then run the tests code: @@ -79,7 +79,7 @@ $ source .venv/bin/activate ``` > No special tool? Then it is plain pip. Make a venv and activate it, like -> in lesson four. +> in lesson five. > Then install the project itself in editable mode. That is dash e. Your > changes to the code take effect immediately. Add its development tools diff --git a/lessons/07-finding-an-issue/README.md b/lessons/08-finding-an-issue/README.md similarity index 88% rename from lessons/07-finding-an-issue/README.md rename to lessons/08-finding-an-issue/README.md index a5a5ad9..52d4cbb 100644 --- a/lessons/07-finding-an-issue/README.md +++ b/lessons/08-finding-an-issue/README.md @@ -1,7 +1,7 @@ -# Lesson 07: Finding an issue (that nobody else is working on) +# Lesson 08: Finding an issue (that nobody else is working on) **Time:** 3 minute video · 30 minute exercise -**You'll need:** `gh` logged in (Lesson 02) +**You'll need:** `gh` logged in (Lesson 03) The most common way beginners waste a weekend: they pick an issue, work on it for days, open a PR, and find someone else fixed it last week. This @@ -21,7 +21,7 @@ So widen your net: - **Projects you actually use.** You understand them, and you'll notice their rough edges. - **Problems you hit yourself.** A confusing error, a broken docs example, - a setup step that failed in Lesson 06: those are real contributions, and + a setup step that failed in Lesson 07: those are real contributions, and nobody else is working on them. ## Searching on GitHub @@ -88,11 +88,11 @@ For each candidate, open it and check: `question` mean the maintainers haven't decided what they want yet. Don't start coding. 5. **Is it still a problem?** Try to reproduce it on the latest `main` - (your Lesson 06 setup). Bugs get fixed without anyone closing the issue. + (your Lesson 07 setup). Bugs get fixed without anyone closing the issue. ## Claiming it -Check CONTRIBUTING first (Lesson 05). Some projects say "don't ask, just +Check CONTRIBUTING first (Lesson 06). Some projects say "don't ask, just open a PR"; others assign issues. If it's not stated, comment in your own words, briefly, with your plan: @@ -110,7 +110,7 @@ project assigns issues. Silence for a few days is normal. - claim several issues at once, or claim one you can't start this week - write "can I work on this?" with nothing else -- use an AI tool to write the comment (Lesson 05) +- use an AI tool to write the comment (Lesson 06) ## When someone else claimed it first @@ -127,8 +127,8 @@ useful notes. ## Your claim is accepted. Now what? -Fork the project (Lesson 01's **Fork** button, or -`gh repo fork OWNER/REPO --clone`), set it up (Lesson 06), make a branch, -and start. Lesson 08 is about making the change itself. +Fork the project (Lesson 02's **Fork** button, or +`gh repo fork OWNER/REPO --clone`), set it up (Lesson 07), make a branch, +and start. Lesson 09 is about making the change itself. -Next: [Lesson 08: making the change](../08-making-the-change/). +Next: [Lesson 09: making the change](../09-making-the-change/). diff --git a/lessons/07-finding-an-issue/exercise.md b/lessons/08-finding-an-issue/exercise.md similarity index 86% rename from lessons/07-finding-an-issue/exercise.md rename to lessons/08-finding-an-issue/exercise.md index 7341f42..ae33102 100644 --- a/lessons/07-finding-an-issue/exercise.md +++ b/lessons/08-finding-an-issue/exercise.md @@ -10,11 +10,11 @@ | 2 | | | | | | | | 3 | | | | | | | -- [ ] Read the CONTRIBUTING file of the best one (Lesson 05 checklist) +- [ ] Read the CONTRIBUTING file of the best one (Lesson 06 checklist) - [ ] Claim it with a comment in your own words, with your plan, *if* you can start this week **Not ready to claim yet?** That's fine: keep your shortlist for the -capstone (Lesson 12). Issues move fast, so re-do the checks when you start. +capstone (Lesson 13). Issues move fast, so re-do the checks when you start. **Stretch:** find a closed, unmerged PR in one of the projects and read the maintainer's last comment. What would you have done differently? diff --git a/lessons/07-finding-an-issue/quiz.md b/lessons/08-finding-an-issue/quiz.md similarity index 100% rename from lessons/07-finding-an-issue/quiz.md rename to lessons/08-finding-an-issue/quiz.md diff --git a/lessons/07-finding-an-issue/script.md b/lessons/08-finding-an-issue/script.md similarity index 100% rename from lessons/07-finding-an-issue/script.md rename to lessons/08-finding-an-issue/script.md diff --git a/lessons/08-making-the-change/README.md b/lessons/09-making-the-change/README.md similarity index 95% rename from lessons/08-making-the-change/README.md rename to lessons/09-making-the-change/README.md index f332d61..72a302a 100644 --- a/lessons/08-making-the-change/README.md +++ b/lessons/09-making-the-change/README.md @@ -1,7 +1,7 @@ -# Lesson 08: Making the change +# Lesson 09: Making the change **Time:** 3 minute video · 40 minute exercise -**You'll need:** this repo set up with your venv (Lesson 04) +**You'll need:** this repo set up with your venv (Lesson 05) You've found an issue and claimed it. Now make the change the way maintainers want it: **small, tested, documented, and easy to review.** @@ -89,7 +89,7 @@ functions or "tidy up" nearby code in the same PR: it makes your change harder to review, and that's the fastest way to get a PR stuck. ```python -"""Small text helpers used by Exercise 3 (Lesson 08).""" +"""Small text helpers used by Exercise 3 (Lesson 09).""" import re @@ -165,7 +165,7 @@ hyphen and strip hyphens from the ends. "Fixed"), 72 characters or fewer, no full stop. - **Blank line**, then a **body** saying *why*, wrapped at about 72 characters. - Some projects want a format like `fix: ...` (Conventional Commits) or a - sign-off (`git commit -s`, Lesson 05). CONTRIBUTING will say. + sign-off (`git commit -s`, Lesson 06). CONTRIBUTING will say. ## Step 7: Check it @@ -206,14 +206,14 @@ issue; full test suite and ruff pass locally. `Fixes #1234` makes GitHub close the issue automatically when the PR is merged. Write the description yourself, and disclose AI use if the project -asks (Lesson 05). +asks (Lesson 06). ## Not every contribution is code Two contributions every project values, and that need no fix at all: **A docs fix.** A wrong example, a broken link, a step that didn't work for -you in Lesson 06. Same workflow: branch, edit, build the docs if you can, +you in Lesson 07. Same workflow: branch, edit, build the docs if you can, PR. **A good bug report.** If you find a bug you can't fix, a clear report is a @@ -231,4 +231,4 @@ real contribution: The **minimal example** is the most valuable part: the smallest code that shows the problem, which a maintainer can paste and run. -Next: [Lesson 09: CI and code review](../09-ci-and-review/). +Next: [Lesson 10: CI and code review](../10-ci-and-review/). diff --git a/lessons/08-making-the-change/exercise.md b/lessons/09-making-the-change/exercise.md similarity index 100% rename from lessons/08-making-the-change/exercise.md rename to lessons/09-making-the-change/exercise.md diff --git a/lessons/08-making-the-change/quiz.md b/lessons/09-making-the-change/quiz.md similarity index 100% rename from lessons/08-making-the-change/quiz.md rename to lessons/09-making-the-change/quiz.md diff --git a/lessons/08-making-the-change/script.md b/lessons/09-making-the-change/script.md similarity index 100% rename from lessons/08-making-the-change/script.md rename to lessons/09-making-the-change/script.md diff --git a/lessons/09-ci-and-review/README.md b/lessons/10-ci-and-review/README.md similarity index 95% rename from lessons/09-ci-and-review/README.md rename to lessons/10-ci-and-review/README.md index f8895c3..fe77a62 100644 --- a/lessons/09-ci-and-review/README.md +++ b/lessons/10-ci-and-review/README.md @@ -1,7 +1,7 @@ -# Lesson 09: CI and code review +# Lesson 10: CI and code review **Time:** 4 minute video · 40 minute exercise -**You'll need:** Lessons 03 and 08 +**You'll need:** Lessons 04 and 09 Opening the PR isn't the end. Almost every PR gets at least one of these: @@ -29,10 +29,10 @@ pytest, ruff and friends say what went wrong. | What failed | What it usually means | What to do | |---|---|---| -| lint / format / pre-commit | Style issue | Run the project's formatter and linter locally (Lesson 06), commit, push | +| lint / format / pre-commit | Style issue | Run the project's formatter and linter locally (Lesson 07), commit, push | | tests on one Python version or OS | Your code depends on something that differs there | Run that version locally with tox/nox, or read the traceback carefully | | tests that fail on `main` too, or pass on re-run | A **flaky** or already-broken test, not you | Say so in a comment: "This failure also happens on main" | -| CLA / DCO | Legal check (Lesson 05) | Sign the CLA, or add sign-offs | +| CLA / DCO | Legal check (Lesson 06) | Sign the CLA, or add sign-offs | | "Waiting for approval" / "awaiting approval" | GitHub doesn't run first-time contributors' workflows until a maintainer approves | Nothing: wait. A maintainer will click approve | **Push the fix to the same branch.** Your PR updates by itself. Never open @@ -187,7 +187,7 @@ git push --force-with-lease `git reset --soft upstream/main` un-does your commits but **keeps all your changes staged**, so the next commit contains everything. Write a commit -message that describes the whole change (Lesson 08). +message that describes the whole change (Lesson 09). The other common way, which lets you choose commit by commit, is an interactive rebase: @@ -210,4 +210,4 @@ cd ../.. rm -rf conflict-lab ``` -Next: [Lesson 10: using AI tools well](../10-using-ai-well/). +Next: [Lesson 11: using AI tools well](../11-using-ai-well/). diff --git a/lessons/09-ci-and-review/exercise.md b/lessons/10-ci-and-review/exercise.md similarity index 100% rename from lessons/09-ci-and-review/exercise.md rename to lessons/10-ci-and-review/exercise.md diff --git a/lessons/09-ci-and-review/quiz.md b/lessons/10-ci-and-review/quiz.md similarity index 100% rename from lessons/09-ci-and-review/quiz.md rename to lessons/10-ci-and-review/quiz.md diff --git a/lessons/09-ci-and-review/script.md b/lessons/10-ci-and-review/script.md similarity index 100% rename from lessons/09-ci-and-review/script.md rename to lessons/10-ci-and-review/script.md diff --git a/lessons/10-using-ai-well/README.md b/lessons/11-using-ai-well/README.md similarity index 93% rename from lessons/10-using-ai-well/README.md rename to lessons/11-using-ai-well/README.md index 520eaa9..6784d7f 100644 --- a/lessons/10-using-ai-well/README.md +++ b/lessons/11-using-ai-well/README.md @@ -1,9 +1,9 @@ -# Lesson 10: Using AI tools well +# Lesson 11: Using AI tools well **Time:** 3 minute video · 30 minute exercise -**You'll need:** Lesson 05 (house rules) and Lesson 08 +**You'll need:** Lesson 06 (house rules) and Lesson 09 -Lesson 05 was about *whether* a project allows AI tools. This lesson is +Lesson 06 was about *whether* a project allows AI tools. This lesson is about using them **well** when it does: so they make you a better contributor, not a source of work for maintainers. @@ -23,7 +23,7 @@ without asking the AI again. | **Understanding unfamiliar code** | "What does this function do? Where is X handled?" | Open the files it names and check it's right | | **Reading a traceback** | Explains an error in plain words | Reproduce the error yourself first | | **Finding where to change** | Points you at likely files | Confirm by reading the code, or with `grep` | -| **Drafting a test** | Suggests cases you forgot | Run it on the buggy code: it must fail (Lesson 08) | +| **Drafting a test** | Suggests cases you forgot | Run it on the buggy code: it must fail (Lesson 09) | | **Rubber-ducking** | Explaining your plan out loud finds gaps | Ideas only. Nothing is submitted | ## Where AI tools hurt @@ -33,7 +33,7 @@ without asking the AI again. - **Changing the test instead of the code.** Making tests pass by weakening them is the opposite of a fix. CPython's guidelines list it as an unacceptable use. -- **Huge diffs.** AI tends to "improve" things nobody asked about. Lesson 08's +- **Huge diffs.** AI tends to "improve" things nobody asked about. Lesson 09's rule still holds: the smallest change the issue needs. - **Unverified bug and security reports.** Never report something an AI "found" until you've reproduced it yourself. Maintainers spend real hours on @@ -43,7 +43,7 @@ without asking the AI again. ## A workflow that keeps you in charge -1. **Understand the issue yourself first.** Reproduce it (Lesson 08). +1. **Understand the issue yourself first.** Reproduce it (Lesson 09). 2. **Use AI to explore**: explain code, suggest where to look, list edge cases. 3. **Write the change yourself, or treat AI output as a draft you rewrite.** 4. **Read every line of the diff** (`git diff`) as if a stranger wrote it. @@ -53,7 +53,7 @@ without asking the AI again. ## Disclosing AI use -Follow the project's own format exactly (Lesson 05). The three common ones: +Follow the project's own format exactly (Lesson 06). The three common ones: **A commit trailer**, used by LLVM and nixpkgs. git can add it for you: @@ -129,4 +129,4 @@ to both. (Some policies allow translation tools: check.) AI-generated code as possibly copied from somewhere with an incompatible licence. That's why their policies are strict. Respect them. -Next: [Lesson 11: after the PR, and beyond GitHub](../11-after-the-pr/). +Next: [Lesson 12: after the PR, and beyond GitHub](../12-after-the-pr/). diff --git a/lessons/10-using-ai-well/exercise.md b/lessons/11-using-ai-well/exercise.md similarity index 96% rename from lessons/10-using-ai-well/exercise.md rename to lessons/11-using-ai-well/exercise.md index c807fa1..242a91d 100644 --- a/lessons/10-using-ai-well/exercise.md +++ b/lessons/11-using-ai-well/exercise.md @@ -46,4 +46,4 @@ Checklist for your version: ## Part 3: Find two real policies Find the AI section of two projects you might contribute to (use your -Lesson 05 notes). Write down each project's disclosure format, if it has one. +Lesson 06 notes). Write down each project's disclosure format, if it has one. diff --git a/lessons/10-using-ai-well/quiz.md b/lessons/11-using-ai-well/quiz.md similarity index 100% rename from lessons/10-using-ai-well/quiz.md rename to lessons/11-using-ai-well/quiz.md diff --git a/lessons/10-using-ai-well/script.md b/lessons/11-using-ai-well/script.md similarity index 98% rename from lessons/10-using-ai-well/script.md rename to lessons/11-using-ai-well/script.md index b1631a3..f8a3210 100644 --- a/lessons/10-using-ai-well/script.md +++ b/lessons/11-using-ai-well/script.md @@ -9,7 +9,7 @@ title: You're responsible for every line bullets: - Whoever, or whatever, wrote it. -> Lesson five was about whether a project allows {AI|A I} tools. This lesson +> Lesson six was about whether a project allows {AI|A I} tools. This lesson > is about using them well, when it does. > There is one rule. You are responsible for every line you submit. Whoever, diff --git a/lessons/11-after-the-pr/README.md b/lessons/12-after-the-pr/README.md similarity index 97% rename from lessons/11-after-the-pr/README.md rename to lessons/12-after-the-pr/README.md index 91c798d..7825ac7 100644 --- a/lessons/11-after-the-pr/README.md +++ b/lessons/12-after-the-pr/README.md @@ -1,7 +1,7 @@ -# Lesson 11: After the PR, and beyond GitHub +# Lesson 12: After the PR, and beyond GitHub **Time:** 3 minute video · 20 minute exercise -**You'll need:** Lesson 09 +**You'll need:** Lesson 10 Your PR is open, checks are green, and... nothing happens. This lesson is about the human side: waiting, nudging, rejection, and what comes after a @@ -116,4 +116,4 @@ commits. Each project documents its own process; the kernel's is *Submitting patches* in its docs. Read it fully before sending anything: mailing lists are public and permanent. -Next: [Lesson 12: the capstone](../12-capstone/). +Next: [Lesson 13: the capstone](../13-capstone/). diff --git a/lessons/11-after-the-pr/exercise.md b/lessons/12-after-the-pr/exercise.md similarity index 93% rename from lessons/11-after-the-pr/exercise.md rename to lessons/12-after-the-pr/exercise.md index df483a2..285aea9 100644 --- a/lessons/11-after-the-pr/exercise.md +++ b/lessons/12-after-the-pr/exercise.md @@ -5,7 +5,7 @@ - [ ] **Write a graceful close.** A maintainer says: "Thanks, but we'd rather not add this option. It's easy to do in user code." Draft your reply. - [ ] **Review someone else's PR.** Find an open PR in a project you used in - Lesson 06. Check out its branch (`gh pr checkout NUMBER`), run the tests, + Lesson 07. Check out its branch (`gh pr checkout NUMBER`), run the tests, and try the change. If you have something useful to add ("works for me on Windows 11 / Python 3.13"), post it. If not, just read the review discussion. diff --git a/lessons/11-after-the-pr/quiz.md b/lessons/12-after-the-pr/quiz.md similarity index 100% rename from lessons/11-after-the-pr/quiz.md rename to lessons/12-after-the-pr/quiz.md diff --git a/lessons/11-after-the-pr/script.md b/lessons/12-after-the-pr/script.md similarity index 100% rename from lessons/11-after-the-pr/script.md rename to lessons/12-after-the-pr/script.md diff --git a/lessons/12-capstone/README.md b/lessons/13-capstone/README.md similarity index 91% rename from lessons/12-capstone/README.md rename to lessons/13-capstone/README.md index 97b9796..f23dfef 100644 --- a/lessons/12-capstone/README.md +++ b/lessons/13-capstone/README.md @@ -1,4 +1,4 @@ -# Lesson 12: Capstone: your first external contribution +# Lesson 13: Capstone: your first external contribution **Time:** 2 minute video · 1–4 weeks, mostly waiting for review **You'll need:** everything so far @@ -26,27 +26,27 @@ maintainer have wanted this change even if you weren't doing a course?** Copy this checklist into your notes. Each stage links to the lesson that covers it. -### 1. Choose (Lesson 07) +### 1. Choose (Lesson 08) - [ ] Shortlist 2–3 issues with `tools/find_issues.py`, GitHub search, or a project you use - [ ] Do the five checks on each: thread read, unassigned, no PR, agreed, reproduced - [ ] Prefer small: a docs fix or a small bug is a great capstone -### 2. Read the house rules (Lesson 05) +### 2. Read the house rules (Lesson 06) - [ ] CONTRIBUTING (or developer guide) read in full - [ ] CLA signed or DCO sign-off ready, if needed - [ ] AI policy noted, with its disclosure format - [ ] Claimed the issue, if the project wants that, and got a go-ahead -### 3. Set up (Lesson 06) +### 3. Set up (Lesson 07) - [ ] Forked and cloned: `gh repo fork OWNER/REPO --clone` - [ ] Set up the way CONTRIBUTING says (`tools/which_setup.py` helps) - [ ] The tests pass **before** you change anything -### 4. Make the change (Lesson 08) +### 4. Make the change (Lesson 09) - [ ] On a branch, never `main` - [ ] Reproduced, with a failing test where it makes sense @@ -54,19 +54,19 @@ covers it. - [ ] Tests and linters pass locally - [ ] Clear commit message (with sign-off or trailer if required) -### 5. Open the PR (Lessons 04 and 08) +### 5. Open the PR (Lessons 05 and 09) - [ ] Pushed to your fork; PR opened against the project's main branch - [ ] Template filled in; `Fixes #...`; how you tested it -- [ ] Written in your own words; AI use disclosed if the project asks (Lesson 10) +- [ ] Written in your own words; AI use disclosed if the project asks (Lesson 11) -### 6. Review (Lesson 09) +### 6. Review (Lesson 10) - [ ] CI green (or failures explained) - [ ] Every review comment answered; new commits pushed; review re-requested - [ ] Conflicts resolved with a rebase if needed -### 7. Wait, then graduate (Lesson 11) +### 7. Wait, then graduate (Lesson 12) - [ ] One polite nudge after ~2 weeks of silence, at most - [ ] **Merged!** @@ -89,7 +89,7 @@ Once your PR is merged, in **this course repo**: message = "One sentence: what you changed, or what you learned" ``` -3. Commit, push, and open a pull request, like Lesson 04. +3. Commit, push, and open a pull request, like Lesson 05. The **Validate graduate** bot looks up your PR on GitHub and checks it's merged, yours, merged by someone else, and in a real project you don't own. diff --git a/lessons/12-capstone/exercise.md b/lessons/13-capstone/exercise.md similarity index 100% rename from lessons/12-capstone/exercise.md rename to lessons/13-capstone/exercise.md diff --git a/lessons/12-capstone/quiz.md b/lessons/13-capstone/quiz.md similarity index 100% rename from lessons/12-capstone/quiz.md rename to lessons/13-capstone/quiz.md diff --git a/lessons/12-capstone/script.md b/lessons/13-capstone/script.md similarity index 98% rename from lessons/12-capstone/script.md rename to lessons/13-capstone/script.md index 03891ea..0ef6e12 100644 --- a/lessons/12-capstone/script.md +++ b/lessons/13-capstone/script.md @@ -118,7 +118,7 @@ message = "One sentence: what you changed, or what you learned" > The link to your merged pull request. > And one sentence. What you changed, or what you learned. Then commit, -> push, and open a pull request, like in lesson four. +> push, and open a pull request, like in lesson five. ## Scene 7: The bot visual: slide diff --git a/lessons/A-troubleshooting/README.md b/lessons/A-troubleshooting/README.md index d13f62b..63c6b0b 100644 --- a/lessons/A-troubleshooting/README.md +++ b/lessons/A-troubleshooting/README.md @@ -17,7 +17,7 @@ read the fix. | `tip of your current branch is behind its remote counterpart` | [5. Push rejected](#5-push-rejected) | | `You are in 'detached HEAD' state` | [6. Detached HEAD](#6-detached-head) | | Wrong files or message in your last commit | [7. Fix your last commit](#7-fix-your-last-commit) | -| `This branch has conflicts that must be resolved` | [Lesson 09](../09-ci-and-review/) | +| `This branch has conflicts that must be resolved` | [Lesson 10](../10-ci-and-review/) | | Your fork says "X commits behind" | [8. Fork out of date](#8-your-fork-is-out-of-date) | | `nothing to commit, working tree clean` but you changed something | [9. Nothing to commit](#9-nothing-to-commit) | | `error: externally-managed-environment` | [10. Python environment](#10-python-and-pip-problems) | @@ -25,7 +25,7 @@ read the fix. | `python3: command not found` (Windows) | [10. Python environment](#10-python-and-pip-problems) | | PR opened against your own fork | [11. PR in the wrong place](#11-pr-opened-in-the-wrong-place) | | `.venv` or other junk in your PR | [12. Files that shouldn't be committed](#12-files-that-shouldnt-be-committed) | -| Checks say "awaiting approval" | [Lesson 09](../09-ci-and-review/) (just wait) | +| Checks say "awaiting approval" | [Lesson 10](../10-ci-and-review/) (just wait) | **Practise the fixes safely:** sections 3–7 come with a sandbox that reproduces each problem. Start it from any folder *outside* a real project: @@ -158,7 +158,7 @@ git push ``` **"behind its remote counterpart"** after you rebased, amended or squashed -means you rewrote commits you'd already pushed (Lesson 09). That's expected: +means you rewrote commits you'd already pushed (Lesson 10). That's expected: ```text hint: Updates were rejected because the tip of your current branch is behind @@ -270,7 +270,7 @@ error: externally-managed-environment ``` You're installing into your system's Python (Homebrew and Linux Pythons -protect themselves). Use a virtual environment, as in Lesson 04: +protect themselves). Use a virtual environment, as in Lesson 05: ```bash norun python3 -m venv .venv diff --git a/practice/README.md b/practice/README.md index aea9d0e..e28d9f3 100644 --- a/practice/README.md +++ b/practice/README.md @@ -1,6 +1,6 @@ # Exercise 2: a Python function and its test -This is the hands-on part of [Lesson 04](../lessons/04-second-pr-from-terminal/). +This is the hands-on part of [Lesson 05](../lessons/05-second-pr-from-terminal/). You add two files, named after your GitHub username (lowercase, with `-` replaced by `_`, because Python module names can't contain hyphens): @@ -38,7 +38,7 @@ When your pull request's tests pass, a bot merges it. # Exercise 3: fix a planted bug (local only) -`practice/textkit.py` has a bug on purpose. [Lesson 08](../lessons/08-making-the-change/) +`practice/textkit.py` has a bug on purpose. [Lesson 09](../lessons/09-making-the-change/) walks you through fixing it on a branch, and `python tools/check_exercise_3.py` checks your work. **Don't open a pull request for it**: the next learner needs the bug. diff --git a/practice/news/README.md b/practice/news/README.md index dbea840..89a9018 100644 --- a/practice/news/README.md +++ b/practice/news/README.md @@ -1,6 +1,6 @@ # News fragments -Exercise 3 (Lesson 08) asks you to add one file here describing your fix, +Exercise 3 (Lesson 09) asks you to add one file here describing your fix, the way many projects collect changelog entries: ``` diff --git a/practice/textkit.py b/practice/textkit.py index 1eebca7..69c8d02 100644 --- a/practice/textkit.py +++ b/practice/textkit.py @@ -1,6 +1,6 @@ -"""Small text helpers used by Exercise 3 (Lesson 08). +"""Small text helpers used by Exercise 3 (Lesson 09). -This file has a bug on purpose. See Lesson 08. Don't open a pull request to +This file has a bug on purpose. See Lesson 09. Don't open a pull request to fix it: the next learner needs it broken. """ diff --git a/publishing/udemy-landing.md b/publishing/udemy-landing.md index abeca4d..885ac41 100644 --- a/publishing/udemy-landing.md +++ b/publishing/udemy-landing.md @@ -17,7 +17,7 @@ From never opening a pull request to a merged contribution: git, GitHub, pytest, Never opened a pull request? This course takes you from zero to a merged contribution in a real open source Python project, one small, practical step at a time. -You start with a win in the first lesson: you star and fork the course's GitHub repository and make your first commit, entirely in the browser. A bot checks your work and merges it within minutes. Then you set up the real tools (git, the GitHub CLI and Python), learn just enough git to never feel lost, and open a second pull request from the terminal with a Python function and its test. That one has to pass CI before it's merged. +You start with a win in the first 15 minutes: you star and fork the course's GitHub repository and make your first commit, entirely in the browser. A bot checks your work and merges it within minutes. Then you set up the real tools (git, the GitHub CLI and Python), learn just enough git to never feel lost, and open a second pull request from the terminal with a Python function and its test. That one has to pass CI before it's merged. Then you go out into the real world. You learn the house rules every project has (CONTRIBUTING files, Contributor License Agreements, DCO sign-offs and AI policies), how to set up any Python project whatever tools it uses, how to find an issue nobody else is working on, and how to make a change maintainers want to merge. You practise rebasing, merge conflicts and code review in a safe lab on your own computer, and you learn how to use AI tools honestly and well. @@ -41,7 +41,7 @@ How this course is made: the lessons and video scripts were drafted with AI and ## Requirements - A computer running macOS, Windows or Linux -- A free GitHub account (lesson 00 shows you how to create one) +- A free GitHub account (lesson 01 shows you how to create one) - Very basic Python: you know what a variable, a string and a function are - No git or GitHub experience needed diff --git a/tests/test_captures.py b/tests/test_captures.py index 7bf77f1..5199ca2 100644 --- a/tests/test_captures.py +++ b/tests/test_captures.py @@ -7,7 +7,7 @@ import render_video # noqa: E402 import script_format # noqa: E402 -LESSON = Path(__file__).resolve().parent.parent / "lessons" / "01-first-pr-in-browser" +LESSON = Path(__file__).resolve().parent.parent / "lessons" / "02-first-pr-in-browser" def test_png_size_of_real_capture(): diff --git a/tests/test_check_first_commit.py b/tests/test_check_first_commit.py index ffff110..640ed62 100644 --- a/tests/test_check_first_commit.py +++ b/tests/test_check_first_commit.py @@ -104,7 +104,7 @@ def git(*args): (["first-commits/ada.py"], True), (["first-commits/ada.py", "README.md"], True), (["first-commits/README.md"], False), - (["lessons/01-first-pr-in-browser/README.md"], False), + (["lessons/02-first-pr-in-browser/README.md"], False), (["first-commits/sub/ada.py"], False), ], ) diff --git a/tests/test_lessons.py b/tests/test_lessons.py index 3420a4e..57490d5 100644 --- a/tests/test_lessons.py +++ b/tests/test_lessons.py @@ -61,12 +61,12 @@ def test_problems_reported(): def test_lesson_04_examples_pass_the_bot(): - """The example files in Lesson 04 must be exactly what the bot accepts.""" + """The example files in Lesson 05 must be exactly what the bot accepts.""" import re from check_exercise_2 import check_greeting, check_test - text = (ROOT / "lessons/04-second-pr-from-terminal/README.md").read_text() + text = (ROOT / "lessons/05-second-pr-from-terminal/README.md").read_text() blocks = re.findall(r"```python\n(.*?)```", text, re.DOTALL) greeting = next(b for b in blocks if "def greet" in b) test = next(b for b in blocks if "from greetings" in b) @@ -163,9 +163,9 @@ def test_slide_layouts(): def frame(layout, bullets, focus="all"): scene = script_format.Scene(1, "S", {"visual": "slide", "title": "T", "layout": layout, "focus": focus}) scene.bullets, scene.beats = bullets, ["Hi."] - return render_video.scene_html(scene, "Demo", ROOT / "lessons" / "04-second-pr-from-terminal") + return render_video.scene_html(scene, "Demo", ROOT / "lessons" / "05-second-pr-from-terminal") - assert '
Lesson 04
' in frame("title", ["sub"]) + assert '
Lesson 05
' in frame("title", ["sub"]) assert "Click Commit in a.py" in frame("bullets", ["Click **Commit** in `a.py`"]) steps = frame("steps", ["a", "b", "c"], "2") assert [c in steps for c in ('"step done"', '"step on"', '"step todo"')] == [True] * 3 diff --git a/tests/test_udemy_package.py b/tests/test_udemy_package.py index a4a8572..cd9791b 100644 --- a/tests/test_udemy_package.py +++ b/tests/test_udemy_package.py @@ -36,7 +36,7 @@ def test_sections_follow_the_curriculum(): def test_lecture_file_names_are_safe(): - lec = up.Lecture(13, "12-capstone", "Capstone: your first external contribution") + lec = up.Lecture(13, "13-capstone", "Capstone: your first external contribution") assert lec.stem == "13 - Capstone - your first external contribution" diff --git a/tools/capture_pages.py b/tools/capture_pages.py index 391ae40..889c62e 100644 --- a/tools/capture_pages.py +++ b/tools/capture_pages.py @@ -2,7 +2,7 @@ Usage:: - python tools/capture_pages.py lessons/01-first-pr-in-browser + python tools/capture_pages.py lessons/02-first-pr-in-browser For every ``visual: browser`` scene with an ``image:`` field, it opens the scene's ``url`` in headless Chrome and saves a screenshot to that path inside diff --git a/tools/check_exercise_2.py b/tools/check_exercise_2.py index d02d233..88d8389 100644 --- a/tools/check_exercise_2.py +++ b/tools/check_exercise_2.py @@ -1,4 +1,4 @@ -"""Validate a learner's Exercise 2 pull request (Lesson 04). +"""Validate a learner's Exercise 2 pull request (Lesson 05). The PR must add or edit exactly two files:: @@ -214,7 +214,7 @@ def format_comment(result: Result, login: str, tests: str, run_url: str) -> str: return ( f"🎉 Nice work, @{login}! {tests_line} Merging this now.\n\n" "You just did what real Python contributors do every day: write code, test it, " - "pass CI, get merged. Next up: Lesson 05, the house rules every project has." + "pass CI, get merged. Next up: Lesson 06, the house rules every project has." ) parts = [f"Thanks, @{login}! Not quite there yet:\n", tests_line] if result.errors: diff --git a/tools/check_exercise_3.py b/tools/check_exercise_3.py index 26b1b7e..4e8cbc5 100644 --- a/tools/check_exercise_3.py +++ b/tools/check_exercise_3.py @@ -1,4 +1,4 @@ -"""Check your Exercise 3 fix locally (Lesson 08). +"""Check your Exercise 3 fix locally (Lesson 09). Run it from the course folder, with your venv active:: diff --git a/tools/check_first_commit.py b/tools/check_first_commit.py index 7f30356..729b3a5 100644 --- a/tools/check_first_commit.py +++ b/tools/check_first_commit.py @@ -165,7 +165,7 @@ def format_comment(result: Result, login: str) -> str: f"🎉 Looks great, @{login}! Your file passed every check, so this pull " "request will be merged automatically in a moment.\n\n" "That purple **Merged** badge means your commit is now part of a public " - "project. Next up: Lesson 02, setting up git on your own machine." + "project. Next up: Lesson 03, setting up git on your own machine." ) lines = "\n".join(f"- {e}" for e in result.errors) return ( diff --git a/tools/check_graduate.py b/tools/check_graduate.py index c09108d..51092d6 100644 --- a/tools/check_graduate.py +++ b/tools/check_graduate.py @@ -1,4 +1,4 @@ -"""Validate a capstone graduation pull request (Lesson 12). +"""Validate a capstone graduation pull request (Lesson 13). The PR adds ``graduates/.py``:: diff --git a/tools/check_lessons.py b/tools/check_lessons.py index 3985e86..eeeb6fb 100644 --- a/tools/check_lessons.py +++ b/tools/check_lessons.py @@ -24,7 +24,7 @@ def check_lesson(folder: Path) -> list[str]: out: list[str] = [] if not FOLDER_RE.match(folder.name): - out.append("folder name should look like '03-just-enough-git'") + out.append("folder name should look like '04-just-enough-git'") for name in REQUIRED_FILES: if not (folder / name).is_file(): out.append(f"missing {name}") diff --git a/tools/conflict_lab.py b/tools/conflict_lab.py index ce3212b..539146a 100644 --- a/tools/conflict_lab.py +++ b/tools/conflict_lab.py @@ -1,4 +1,4 @@ -"""Create a safe practice world for Lesson 09: rebasing, conflicts, review, squashing. +"""Create a safe practice world for Lesson 10: rebasing, conflicts, review, squashing. Usage (from the course folder):: @@ -93,7 +93,7 @@ def main(argv: list[str]) -> int: return 2 work = create(Path(argv[0]).resolve()) print(f"Lab ready. Your clone is {work}") - print("Read REVIEW.md in the lab folder, then follow Lesson 09.") + print("Read REVIEW.md in the lab folder, then follow Lesson 10.") return 0 diff --git a/tools/doctor.py b/tools/doctor.py index fb477c8..9fe4116 100644 --- a/tools/doctor.py +++ b/tools/doctor.py @@ -1,4 +1,4 @@ -"""Check that your machine is ready to contribute (Lesson 02). +"""Check that your machine is ready to contribute (Lesson 03). Run it from your clone of the course repo:: @@ -57,7 +57,7 @@ def check_venv() -> tuple[str, str]: def check_git(runner=run) -> tuple[str, str]: res = runner(["git", "--version"]) if res is None: - return FAIL, "git isn't installed. See Lesson 02, step 1." + return FAIL, "git isn't installed. See Lesson 03, step 1." version = parse_version(res[1]) if version[:2] < MIN_GIT: return FAIL, f"git {'.'.join(map(str, version))} is too old; install git 2.28 or newer." @@ -74,20 +74,20 @@ def check_git_name(runner=run) -> tuple[str, str]: def check_git_email(runner=run) -> tuple[str, str]: res = runner(["git", "config", "--global", "user.email"]) if not (res and res[0] == 0 and res[1]): - return FAIL, "git doesn't know your email. See Lesson 02, step 3 (use your GitHub noreply address)." + return FAIL, "git doesn't know your email. See Lesson 03, step 3 (use your GitHub noreply address)." email = res[1] if email.endswith("@users.noreply.github.com"): return OK, f"git user.email is your private noreply address ({email})" return WARN, ( f"git user.email is {email}. Every commit you push makes it public. " - "Consider your GitHub noreply address instead (Lesson 02, step 3)." + "Consider your GitHub noreply address instead (Lesson 03, step 3)." ) def check_gh(runner=run) -> tuple[str, str]: res = runner(["gh", "--version"]) if res is None: - return FAIL, "GitHub CLI (gh) isn't installed. See Lesson 02, step 1." + return FAIL, "GitHub CLI (gh) isn't installed. See Lesson 03, step 1." return OK, f"gh {'.'.join(map(str, parse_version(res[1])))}" @@ -109,7 +109,7 @@ def check_upstream(runner=run) -> tuple[str, str] | None: if COURSE_REPO in origin[1]: return ( WARN, - "You cloned the course repo itself, not your fork. Lesson 04 needs your fork: see Lesson 02, step 5.", + "You cloned the course repo itself, not your fork. Lesson 05 needs your fork: see Lesson 03, step 5.", ) upstream = runner(["git", "remote", "get-url", "upstream"]) if upstream and upstream[0] == 0 and COURSE_REPO in upstream[1]: @@ -150,7 +150,7 @@ def main() -> int: if failures: print(f"{failures} thing(s) to fix. Fix the first one, then run this again.") return 1 - print("All set. You're ready for Lesson 03.") + print("All set. You're ready for Lesson 04.") return 0 diff --git a/tools/find_issues.py b/tools/find_issues.py index 525c6f1..c80cb44 100644 --- a/tools/find_issues.py +++ b/tools/find_issues.py @@ -1,4 +1,4 @@ -"""List beginner-friendly issues that nobody seems to be working on (Lesson 07). +"""List beginner-friendly issues that nobody seems to be working on (Lesson 08). Usage:: @@ -6,7 +6,7 @@ python3 tools/find_issues.py --label "help wanted" --days 30 --min-stars 500 python3 tools/find_issues.py --repo pallets/flask -Uses the GitHub CLI (``gh``, logged in: Lesson 02). First it finds active +Uses the GitHub CLI (``gh``, logged in: Lesson 03). First it finds active Python repositories with enough stars and open good-first issues. Then, in those repositories, it searches for open issues that are labelled for newcomers, unassigned, not linked to a pull request and recently active. It @@ -123,7 +123,7 @@ def keep(row: dict, min_stars: int, show_claimed: bool) -> bool: def _graphql(query: str, q: str, n: int) -> list[dict]: if not shutil.which("gh"): - sys.exit("This needs the GitHub CLI (gh). See Lesson 02.") + sys.exit("This needs the GitHub CLI (gh). See Lesson 03.") proc = subprocess.run( ["gh", "api", "graphql", "-f", f"query={query}", "-f", f"q={q}", "-F", f"n={n}"], capture_output=True, diff --git a/tools/graduates_wall.py b/tools/graduates_wall.py index 2552238..7ee8cfd 100644 --- a/tools/graduates_wall.py +++ b/tools/graduates_wall.py @@ -1,4 +1,4 @@ -"""Regenerate graduates/README.md from the files in graduates/ (Lesson 12). +"""Regenerate graduates/README.md from the files in graduates/ (Lesson 13). Usage:: @@ -23,7 +23,7 @@ Everyone here finished [the course](../CURRICULUM.md) and got a pull request merged in a real open source project. See -[Lesson 12](../lessons/12-capstone/) to join them. +[Lesson 13](../lessons/13-capstone/) to join them. This page is generated by `tools/graduates_wall.py`. Don't edit it by hand. diff --git a/tools/render_video.py b/tools/render_video.py index a905d31..73124b0 100644 --- a/tools/render_video.py +++ b/tools/render_video.py @@ -10,7 +10,7 @@ Usage:: - python tools/render_video.py lessons/00-what-counts [--voice Samantha] [--scenes 1-3] + python tools/render_video.py lessons/01-what-counts [--voice Samantha] [--scenes 1-3] Output goes to ``build//.mp4`` (and ``.srt``). Frames are ``sceneNN.png``, or ``sceneNN-K.png`` for beat K of a scene with several. @@ -339,7 +339,7 @@ def _browser_capture(scene: Scene, lesson_dir: Path) -> str: def lesson_label(lesson_dir: Path | None) -> str: - """``lessons/04-second-pr`` gives "Lesson 04"; an appendix like ``A-...`` gives "Appendix A".""" + """``lessons/05-second-pr`` gives "Lesson 05"; an appendix like ``A-...`` gives "Appendix A".""" prefix = lesson_dir.name.split("-")[0] if lesson_dir else "" if prefix.isdigit(): return f"Lesson {prefix}" diff --git a/tools/test_commands.py b/tools/test_commands.py index 0537fcc..8396f15 100644 --- a/tools/test_commands.py +++ b/tools/test_commands.py @@ -85,8 +85,8 @@ def main(argv: list[str]) -> int: ) with tempfile.TemporaryDirectory() as tmp: home = Path(tmp) - if not any(f.name.startswith("02-") for f in folders): - # Lesson 02 normally sets the identity; stand in for it when it isn't run. + if not any(f.name.startswith("03-") for f in folders): + # Lesson 03 normally sets the identity; stand in for it when it isn't run. (home / ".gitconfig").write_text("[user]\n\tname = Course CI\n\temail = ci@example.com\n") ok = all([run_lesson(folder, home) for folder in folders]) return 0 if ok else 1 diff --git a/tools/udemy_package.py b/tools/udemy_package.py index e337d85..e29f3ba 100644 --- a/tools/udemy_package.py +++ b/tools/udemy_package.py @@ -19,6 +19,7 @@ from __future__ import annotations +import os import re import subprocess import sys @@ -35,7 +36,7 @@ TITLE_MAX, SUBTITLE_MAX, LECTURE_TITLE_MAX = 60, 120, 80 DESCRIPTION_MIN_WORDS, OBJECTIVES_MIN = 200, 4 LOUDNESS = "loudnorm=I=-16:TP=-1.5:LRA=11" -TEST_VIDEO_LESSON, TEST_VIDEO_SECONDS = "04-second-pr-from-terminal", 150 +TEST_VIDEO_LESSON, TEST_VIDEO_SECONDS = "05-second-pr-from-terminal", 150 MAX_UPLOAD_BYTES = int(9.5 * 1024 * 1024) # browser automation uploads at most 10 MB per file @@ -130,10 +131,17 @@ def encode_lecture(src: Path, dst: Path) -> None: text=True, ).stdout ) - kbps = int(MAX_UPLOAD_BYTES * 8 * 0.95 / seconds / 1000) - 128 # leave room for audio and the container - video = ["-c:v", "libx264", "-preset", "slow", "-tune", "stillimage", "-pix_fmt", "yuv420p", - "-b:v", f"{kbps}k", "-maxrate", f"{kbps * 2}k", "-bufsize", f"{kbps * 4}k"] # fmt: skip - run(["ffmpeg", "-y", "-i", str(src), *video, *audio, "-movflags", "+faststart", str(dst)]) + # Two passes, so the opening title slide isn't starved while a one-pass + # rate control settles (that made the first seconds blocky). 96k audio + # is plenty for narration and leaves more of the budget for the picture. + audio[audio.index("128k")] = "96k" + kbps = int(MAX_UPLOAD_BYTES * 8 * 0.95 / seconds / 1000) - 96 # leave room for audio and the container + video = ["-c:v", "libx264", "-preset", "slow", "-pix_fmt", "yuv420p", "-b:v", f"{kbps}k"] + with tempfile.TemporaryDirectory() as tmp: + log = ["-passlogfile", str(Path(tmp) / "x264")] + run(["ffmpeg", "-y", "-i", str(src), *video, "-pass", "1", *log, "-an", "-f", "mp4", os.devnull]) + run(["ffmpeg", "-y", "-i", str(src), *video, "-pass", "2", *log, *audio, + "-movflags", "+faststart", str(dst)]) # fmt: skip def course_image(landing: dict, dst: Path) -> None: diff --git a/tools/which_setup.py b/tools/which_setup.py index 92f01a5..20f09bc 100644 --- a/tools/which_setup.py +++ b/tools/which_setup.py @@ -1,4 +1,4 @@ -"""Work out how to set up and test a Python project you just cloned (Lesson 06). +"""Work out how to set up and test a Python project you just cloned (Lesson 07). Usage::