Image for post
Image for post
Photo by Fabrizio Verrecchia on Unsplash

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.

What Is Django Query Profiler

A brief…

Image for post
Image for post
Photo by Yancy Min on Unsplash

What Is A Git Alias?

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:

  1. Lengthy
  2. Hard to remember
  3. Lacks an intuitive name
  4. User is not a native English speaker

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. …

Image for post
Image for post
Photo by Dan Meyers on Unsplash

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 tox and 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…

Image for post
Image for post
Photo by Chris Ried on Unsplash

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. …

Drew Budwin

Security-minded professional software engineer from Virginia. Passionate about software, testing, and design patterns.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store