The matplotlib chapter seems fairly barebones but I remain in awe at this gorgeous latex work
He could have invested in a Python syntax highlighter. I use minted, myself, but I'm sure there are many alternatives.
https://websites.umich.edu/~mejn/cp2/exercises.html
By the way, I use typst now, so I don't have to worry about highlighting anymore!