Saving my working here for the Data Science book I am reading through.
All the code from the book is freely available from the authors repo. I haven't used any of this I prefer to type out the code from the book myself. Yes I will make errors but that is how I learn.
Note also I prefer to run all the asserts from a separate module, so I give myself a little extra work with that but it agin helps me to understand the code better as I have to resolve all the imports across the modules. Keeping me reading the code more and digesting what has been written by the author.
Note: I am completely green to Data Science as explained in the book but my experience in python is good enough to work in this modular manner.