Python Testing Tools, Django Migrations, and UV Updates
Code Coverage and Maintenance
In this episode, we dive into powerful coverage.py techniques that simplify testing workflows:
• Regex Pragmas: Learn how to use regular expressions to define custom exclusion rules for code coverage, allowing you to ignore specific files or blocks easily.
• Plugin Ecosystem: Explore helpful plugins like cov-defaults (to automate common exclusions) and the coverage-conditional-plugin.
• Strategic Testing: Discuss the philosophy of 100% coverage—focusing not on all code, but on the segments that matter most to system reliability.
Future-Proofing Python Projects
We explore a new tool called Yore, designed to manage the technical debt associated with Python version support:
• EOL Management: Tag code blocks that depend on specific Python versions using comment-based markers.
• Automated Refactoring: Use the Yore CLI to automatically fix and clean up your codebase once a target version of Python reaches its end-of-life status.
Orchestration and Infrastructure
We cover significant improvements in how we run and deploy Python applications:
• Nox + UV: A look at nox-uv, a tool that integrates the speed of the UV package manager into your Nox testing matrix, making dependency installation and environment setup drastically faster.
• Django Migrations: Expert advice on managing clean migration histories by periodically performing clean resets once initial development stabilizes.
• DJ Lite: A new way to optimize SQLite for production environments, simplifying deployment and performance tuning for small to medium-sized Django projects.
Learning and Extras
"Control C, Control V remains eternal, but what kind of dev are you?"
Michael discusses his new course, Just Enough Python for Data Scientists, which bridges the gap between notebook-driven research and professional software engineering practices, while Brian highlights his updated and modernized pytest fixture series.