Course A — Software engineering foundations
Unit 6 — A portable package
Self-paced · about 60 minutes · Course A, chapter 2 of 4
Learning objectives
- Tell a pinned requirement from a floating one, and say where each kind of dependency belongs.
- Build a package with
__init__.pyand a submodule that a script can import by name. - Give a package the docstring
help()shows, and readhelp()on a real one.
Lessons
| Lesson | What you leave with |
|---|---|
| 1. Making your package portable | requirements.txt and setup.py, and what pyproject.toml plus uv.lock replace them with |
| 2. Adding functionality to packages | A submodule, the __init__.py import that exposes it, and why this repo keeps __init__.py thin |
| 3. Writing your first package | help(my_package): which section comes from where |
Checking your answers
Every exercise in notebook.ipynb has the same shape: context, numbered
instructions, a starter that runs as shipped and gives a wrong or incomplete
answer (marked <------ EDIT THIS LINE), the expected output, and a
check(...) cell that prints ✅ or ❌ with the fix named. The last cell,
review("w06"), is the scorecard.
Working with a coding assistant: give it the exercise's context and
instructions, let it edit the marked lines, then run the check cell yourself.
You read the verdict, not the assistant. solutions/notebook.ipynb is the
reference; open it after the check, not before.
Slides
slides.md is a Marp deck. Read it as Markdown, or render it:
npx @marp-team/marp-cli slides.md -o slides.pdf
Previous: Packages, PyPI and PEP 8 · Next: Classes in a package