Tutorial on using functions and modules to improve code readability and design, as part of a multi-step data pipeline.
Created for the Write Better Python session at NICAR 2019 conference in Newport Beach, CA.
The tutorial steps through several iterations of code that downloads, cleans and summarizes some fake election data. Along the way we add some basic test coverage so we can more confidently change the code.
The directories in this repo contain:
- elex1 - a single gnarly, tear-inducing script
- elex2 - a single script that uses functions and adds some test coverage
- elex3 - a series of modules that can be run as stand-alone scripts, and an "orchestrator" script to run the full pipeline