It’s an exercise in frustration to blindly try to optimize a query when you don’t know which query is slow and why it is slow. There is the very popular tool Django Debug Toolbar, but this post is about a simpler, more focused tool called Django Query Profiler. Django Query Profiler is a newer but is a great lightweight tool for diving into a query, providing timing information, highlighting potential N+1 problems, finding duplicate SQL queries, and suggesting fixes. As a contributor to the Django Query Profiler project, I can attest to its ease of setup and utility.
A Git alias is a way to give a Git command a nickname of your choosing. Good candidates for making a Git alias are when the command is:
A drawback of a Git alias that I’ve stumbled across is when you’re helping someone else with Git who doesn’t have the same set of aliases as you do. You’ll find yourself in a conundrum trying to remember the underlying command, or having to reference the Git aliases on your own computer. …
Feel free to clone my sample GitHub repository and follow along when reading this blog 👍
Two of my favorite tools for automating my workflow when developing projects — both personal and professional — is the power-couple of
poetry. These two tools combined make linting, testing, and virtualizing my code across multiple versions of Python a cinch!
I’ve grown to really despise managing multiple versions of Python and Python packages outside of a Python virtual environment. After just one or two projects with a handful of dependencies, it becomes a tangled mess to keep everything working right. Modifying…
Dependency inversion — a specific implementation of inversion of control (IoC) — is an object-oriented software design principle that creates less fragile code and makes writing tests easier by decoupling lower-level classes from higher-level classes. It accomplishes this feat by passing objects into a class’ constructor as parameters instead of instantiating new objects inside of the class itself. This article isn’t intended to espouse on the merits of dependency injection — that’s already a well covered topic — but to demonstrate an example in Python along with how to write unit tests for code that uses dependency inversion. …
Security-minded professional software engineer from Virginia. Passionate about software, testing, and design patterns.