Python Code Review: Unplugged – Episode 3
In this third episode of my video code review series I take a look at a reader’s web scraping project and start adding some unit tests to it.
» Subscribe to the dbader.org YouTube Channel for more Python tutorials.
This is a Python code review I did for Sunny’s web scraping project on GitHub. Sunny reached out to me after watching one of my previous code review videos, asking me if I could give him some feedback on his web scraping pet project.
In this episode you’ll see Flake8 and Python code linting tools make a comeback. Also I’m doing an intro to adding Pytest unit tests to an existing Python code base in the second half of the video.
By the way, I love how eager Sunny was to get feedback on his Python code:
As a pet project I wanted to learn all the best practice as much as I could about python, trying to code as pythonic as I can, checking pep8 and autopep8 (didn’t knew about flake8!!) Eventually I re-factored using classes and methods. If you’ll see that it originally did everything in one monolithic function in the 2.x pull request on github. I still have a few things that I want to implement, so I welcome all kinds of feedback about it!
This is exactly the right mindset that turns people into productive and successful software engineers. Even tiny – but constant – improvements add up and compound over time.
I’ve seen this in friends and colleagues alike. Those developers who seek out constant small improvements eventually go on and do amazing things.
Enjoy the video! And be sure to check out my other Python screencasts if you liked this code review 😊
Links & Resources:
- Sunny’s GitHub account
- The GitHub pull-request from the video
- Pytest Python testing framework
- Flake8 Python code linter
- How to integrate code linting with your editor setup
» Click here to watch my other Python Code Review: Unplugged videos