Python Craft
From a script to a project
Your code runs. It runs from one directory, on one machine, with one set of packages you cannot quite remember installing. This is the part where it becomes a thing you can hand over: installable, runnable from anywhere, checked by one command, and documented well enough that nobody has to ask you.
- Modules
- 7
- Drills
- 13
- Build steps
- 21
- Time
- ~10h
Walk out with
A working script turned into an installed, tested, typed, configurable package another developer can clone and extend — behaviour unchanged.
What you'll do
Environments and imports
Which Python is running, and which file it actually loads.
The file that makes it real
Metadata, an editable install, a command you can run.
Checks and clear interfaces
One command that passes or fails, and honest types.
Onto somebody else's machine
Arguments, config, logging, and a README that works.
The pitch
What you practise, and what you leave with
A correct-but-unusable stock report script, rebuilt as an installed package with a CLI, config, logging, types, a quality gate and a README.
You will practise
- Say which file an import actually loads
- Read a version constraint
- Say which value wins: default, env, or flag
- Name whose job a complaint is
Afterwards you can
- Explain why "works on my machine" happens
- Lay out and install a real project
- Make every check runnable with one command
- Hand a codebase to somebody else
Modules
7 modules, 46 items
Lessons explain one idea. Drills repeat it until it sticks. Build steps make something that exists afterwards.
- 1
Which Python is running?
~1hOne import succeeds in one terminal and fails in another, with no file changed.
- LessonThere is no such thing as "Python"14 min
- Build stepBuild one and look inside it12 min
- DrillWhich Python is that11 min
- LessonSay what you need15 min
- DrillRead a dependency line11 min
- LessonHow much project is enough10 min
- 2
Where the package lives
~1hA test that passes against the wrong copy, and the layout that prevents it.
- LessonWhich copy wins15 min
- DrillSay which file the import loads13 min
- Build stepMove it to a src layout14 min
- Build stepPoint the tests at the installed package13 min
- DrillName the defect in the repository12 min
- 3
The file that says what this is
~1hOne file turns a folder into a project you can install and run.
- LessonOne file, three jobs14 min
- DrillWhich table states this10 min
- Build stepFill the file in15 min
- DrillSpot the broken line12 min
- Build stepBuild it and look at what came out12 min
- 4
Checks you can run again
~59 minFour tools with opinions, and one number that decides whether the gate passed.
- LessonFour things that can object14 min
- DrillWhose job is this complaint12 min
- DrillRead the verdict10 min
- Build stepMake it one command15 min
- LessonWhat the gate is for8 min
- 5
Say what goes in and out
~40 minA signature that is a guess, and the four annotations that make it a contract.
- LessonA signature that is a guess14 min
- DrillWhich signature says that11 min
- Build stepRun the checker and fix the interface15 min
- 6
Run it somewhere else
~2hArguments in, configuration in, diagnostics out — and nothing you could not publish.
- LessonThe contract on the command line14 min
- DrillWhat the parser hands you12 min
- Build stepGive it a real command line15 min
- LessonConfiguration that travels9 min
- DrillWhich value wins11 min
- LessonCould you publish this tomorrow?9 min
- DrillCould you publish this tomorrow10 min
- LessonPrint, or log13 min
- DrillHow much of this comes out11 min
- Build stepWire configuration and logging16 min
- 7
Turn it into a project
~3hTwo hundred lines that work and cannot be handed over. Same behaviour, out the far side.
- Build stepRead it, and write down what is wrong16 min
- Build stepMake it a package22 min
- Build stepGive it metadata and a way in18 min
- Build stepTest the decision, not the printing11 min
- Build stepChain them into one verdict11 min
- Build stepAnnotate the public surface16 min
- Build stepGive it a command line9 min
- Build stepLet the machine configure it8 min
- Build stepPut the diagnostics on a level9 min
- Build stepWrite the documentation13 min
- Build stepProve it on an empty machine12 min
- Build stepAdd one thing nobody showed you20 min
More in Languages
Keep going
Python Foundations
Read a program before you run it. Then write one worth showing.
Foundational~6h8 modules
Python Fluency
Choose the shape before you type. Then say it in one line.
Intermediate~5h7 modules
Python Confidence
Somebody else wrote it. Find out whether it works.
Advanced~7h7 modules
Python Design
It works. It is also the wrong shape.
Advanced~8h7 modules
It works. Now make it somebody else's.
The first item is free. ~10h of focused work, at your own pace.
Advanced~10h7 modules