The case of the missing key in Python dicts

Let’s say you have a dictionary and you want to append values to a key that doesn’t exist yet. Appending the value directly without initializing it would raise a KeyError exception. There are a few different solutions for this problem. On this blogpost I will go through all of them.
Read more →

Gradually formatting your codebase with black

I’ve created a Github Action that gradually applies black to your codebase. If your codebase is small and well tested, this Github Action would be of no use to you, as you could just format your code on a single PR. On the other hand, if you have a big enough codebase in which making a big PR with lots of formatting changes is a risk. Then look no further.
Read more →

Simplified Django Tests With Pytest and Pytest FactoryBoy

Lately, I’ve been bothered by the amount of boilerplate on my Django application’s test code. So, I decided to do some research and look for alternatives. On this blogpost I will take about pytest, factoryboy and how they can be combined.
Read more →

Making your Django tests faster

Tests need to be fast. If tests are slow, our development process is affected and we end up spending a considerable amount of time waiting for the results. On this blogpost I will go through some of the techniques that I’ve applied to speed up tests on Django applications.
Read more →

Optimizing Django ORM Queries

The Django ORM (Object Relational Mapping) is one of the most powerful features of Django. It enables us to interact with the database using Python code instead of SQL. On this blogpost you will learn how to efficiently make queries using the ORM.
Read more →