- Python 93%
- HTML 5.7%
- Java 1.3%
|
All checks were successful
Build and Release PDFs and HTML / build (push) Successful in 1m56s
Two problems with the first version. It was too much work for the slot, and the domain was doing the teaching: students would have spent the afternoon learning about tractive effort, gradient resistance in per-mille and Roeckl's formula for curve resistance instead of about refactoring. The railway stays, the railway engineering goes. A wagon now weighs what it weighs plus what it carries, and an engine can pull that or it cannot. The starter drops from 430 lines to 164, the solution from eleven modules to five, and the guide from eight steps to four. Dispatch tables and dependency injection move to If time permits, which frees about an hour. The reveal survives intact and is sharper for being arithmetic: service S1 reports 16 minutes when the answer is 32, because the second copy of the weight calculation counts the wagons and forgets the cargo. A light train is unaffected, so the bug only bites the services that matter. The slides no longer use the railway at all. They were enumerating exactly what step 1 asks students to discover and telegraphing what step 4 reveals. They now teach the technique on a car park, and the four illustrations became runnable demos: a characterisation test catching a rounding change nobody meant to make, a linter finding three real defects and none of the design, one class with three reasons to change, and a dictionary that accepts a vehicle type of "spaceship". Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|---|---|---|
| .forgejo/workflows | ||
| appendices | ||
| articles | ||
| build | ||
| demos | ||
| exercises | ||
| extra | ||
| solutions | ||
| src | ||
| tutorial | ||
| .gitattributes | ||
| .gitignore | ||
| .python-version | ||
| Advanced Python Extra Exercises.docx | ||
| Advanced Python Extra Exercises.pdf | ||
| Advanced Python Extra.pdf | ||
| Advanced Python Extra.pptx | ||
| AGENTS.md | ||
| CLAUDE.md | ||
| credentials.txt | ||
| MAINTAINING.md | ||
| PRG404-Advanced Python Exercises.pdf | ||
| PRG404-Advanced-Python-Exercises_og.pdf | ||
| PRG404-Advanced-Python-Programming_og.pdf | ||
| pyproject.toml | ||
| README.md | ||
| resources.txt | ||
| ruff.toml | ||
| uv.lock | ||
Advanced Python Programming (PRG404)
Welcome. This bundle contains everything you need for the course : the slides, the lab exercises, runnable example code, reference solutions and a library of background articles. This page explains what is here and how to run it.
This repository is refreshed automatically after every change to the course
material, so a git pull always gives you the latest version.
What is in this bundle
PRG404-Advanced-Python-Programming.pdf: the course slides. The same deck is also available as.htmlif you prefer reading in a browser.PRG404-Advanced-Python-Programming-Exercises.pdf: the lab guide, one exercise per module.demos/: the runnable example programs shown on the slides, one folder per module (for exampledemos/08-decorators/). A slide that shows a demo names it at the bottom, for exampledemo06 · bold_tag_decorator, which is the filedemos/08-decorators/demo06_bold_tag_decorator.py.solutions/: reference solutions for the exercises, in case you get stuck or want to compare. Try the exercise first.exercises/: starter files that a few exercises build on.articles/,appendices/andtutorial/: optional background reading, appendix decks (Clean Code, BDD, SQLAlchemy ORM, comprehensions) and step-by-step guides for packaging and publishing to PyPI.extra/: supplementary material from adjacent courses.
Setting up Python
-
Install uv, the Python project manager. It can install Python itself, so it is the only thing you install by hand.
-
Windows (PowerShell) :
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" -
macOS or Linux :
curl -LsSf https://astral.sh/uv/install.sh | sh
Close and reopen your terminal afterwards, then check it with
uv --version. -
-
Install the interpreter the course uses :
uv python install 3.14This needs no administrator rights and leaves any Python already on the machine alone.
-
Install an editor. The course demonstrates VS Code with the Microsoft Python extension and the Astral Ruff extension. Any editor works, but the slides assume VS Code.
Creating your own project
You build your own project for the code you write this week, the same way you
would at work. The bundle deliberately ships no pyproject.toml, you create one :
uv init course-work
cd course-work
uv add pytest
uv add records the dependency in the pyproject.toml it just created and pins
the project to Python 3.14.
The bundle does ship a ruff.toml. That is the linter configuration the course
material is written against, so the Ruff extension will not flag the demo files
over style choices the course makes on purpose, and it holds the code you write
to the same rules.
Running a demo
The demos are plain scripts. Run one by giving its path :
uv run python ../demos/08-decorators/demo06_bold_tag_decorator.py
Running through uv run guarantees the command uses your project's Python and
its packages, so you never have to activate an environment by hand.
Running the tests
Several modules ask you to write tests. Run them from your project with :
uv run pytest
Enjoy the course.