Building useful project utils in Python
summary
Starts from a 450-line bash utility and shows an incremental rewrite into Python that cuts ~19% of the code while making the logic reusable and testable. Demonstrates concrete tools: argparse for CLI, subprocess for running binaries, pathlib for filesystem work, and doctest/pytest for unit tests. Builds a loader file format, a signing tool and a tiny HTTP server to let devices pull multi-device upgrades; the new Python pipeline works in production and eases future features.
AI-written summary · about
chapters (16)
- 0:00Intro
- 0:32Prerequisites
- 2:15What scripts are we talking about?
- 5:04Why is Python better? - Syntax
- 7:50Why is Python better?-Data structures and types
- 10:28Why is Python better? - Modularity
- 17:29Code organization
- 20:24Command-line interfaces in Python
- 29:05Runting other programs from Python-subprocess
- 31:31Manipulating the flesystem from Python-pathlib
- 35:57Writing unit tests in Python-doctest
- 38:12Writing unit tests in Python-unittest
- 39:00Writing unit tests in Python - pytest
- 43:16binst shell script
- 44:16System with multiple devices
- 49:27Summary
related talks
51mTread Lightly When Building and Testing Your Python Project
38mBuilding Data Pipelines in Python
30mAn Admin's Cornucopia - Python Is More Than Just A Better Bash
43mPython 3: ten years later
27mI love being Pythonic
38mBuilding Data Pipelines in Python
51mTaking Python beyond scripting
26mCLI, CI, DIY: Crafting Python Based Dev Tools in a DevOps Vacuum
