Month summary - March 2022

Posted by Tobiasz Kedzierski on 31.03.2022

March 2022

I am aggregating here some more or less interesting stuff of various IT related materials which I came across this month. Some of them are strictly related to the things I did or am currently doing.

Some thoughts

Apache Software Foundation contacted me about my repo Fetch Apache GitHub Actions Statistic. To help them collect statistics and make setting up workflows from the repo easy and convenient I wrapped up all related infrastructure into Terraform code. I enjoy figuring out connections between different cloud resources and since I am a fanboy of Terraform it was a pretty nice time spent this month working on that.

Articles

The Thirty Minute Rule

The rule is that if anyone gets stuck on something for more than 30 minutes, they should ask for help.

A Slightly Advanced Introduction to Vim

This is not a five minute introduction to vim for a complete newbie. I presume you have used vim before and are comfortable with moving around, and making changes. Although :vimtutor is not a prerequisite to this tutorial, I highly recommend it.

This document contains some mnemonics, and some slightly advanced features of vim that can help the average vim user/programmer increase his/her productivity by leaps and bounds.

Scaling Django with Postgres Read Replicas

Replication is a feature of PostgreSQL that you typically use to achieve high availability by running copies of a database that are ready to take over if your primary database fails. However, you can also use replication to make your Django applications faster. In this post, I’ll explain how to configure Django to query read-only Postgres replicas, allowing you to scale your database read performance linearly with the number of replicas.

How to design better APIs

15 language-agnostic, actionable tips on REST API design.

Some developers are fouling up open-source software

From ethical concerns, a desire for more money, and simple obnoxiousness, a handful of developers are ruining open-source for everyone.

Python

Mocking in Python Has Never Been Easier

The Pytest Mock Generator library simplifies writing the ‘arrange’ and ‘assert’ sections. It generates the ‘arrange’ and ‘assert’ sections for you and allows you to focus on the ‘act’ section of your tests.

How and why I use pytest's xfail

xfail vs skip

The main difference is that with skip you don't run the test at all, whereas with xfail, you run the test and make sure that it failed (if it doesn't fail, it's marked as XPASS)

Modern Python Environments - dependency and workspace management

Once you get through the pain of setting up a Python environment for a single "hello world"-esque application, you'll need to go through an even more difficult process of figuring out how to manage multiple environments for multiple Python projects.

How to Write User-friendly Command Line Interfaces in Python

The first step to make people love your application.

Python Built-in Functions To Know

We're going to take a look at all 71 of Python's built-in functions, in a birds eye view sort of way.

Value objects with Python

A Value object is a basic building block from tactical DDD (Domain Driven Design).

Processing large JSON files in Python without running out of memory

If you need to process a large JSON file in Python, it’s very easy to run out of memory. Even if the raw data fits in memory, the Python representation can increase memory usage even more.

Python Project Setup – Virtual Environments and Package Management

Modern Python projects need a bit more than venv and pip. Learn about the best tools for package management and environment isolation.

The Right Way To Compare Floats in Python

Floating-point numbers are a fast and efficient way to store and work with numbers, but they come with a range of pitfalls that have surely stumped many fledgling programmers — perhaps some experienced programmers, too!

Python Built-in Functions To Know

This will be a very long article, so I've linked to 5 sub-sections and 25 specific built-in functions in the next section so you can jump ahead if you're pressed for time or looking for one built-in in particular.

Why your mock doesn’t work

Mocking is a powerful technique for isolating tests from undesired interactions among components. But often people find their mock isn’t taking effect, and it’s not clear why. Hopefully this explanation will clear things up.

Django

The 10 Most-Used Django Packages

Inspired by a past article on The 22 Most-Used Python Packages in the World, I teamed up with Jeff Triplett to investigate the top 10 Django packages based on PyPI (The Python Package Index) downloads. We looked at the past 30 days though data from the past 365 days is also available.

Setting up a basic Django project with Poetry

We will be using Pyenv and Poetry to manage the virtual environment and dependencies for your project.

How to deploy a Django application using NGINX and Gunicorn?

One thing that I have observed very ordinarily being practised is, that freshers or even experienced developers, when onboards on any new application, directly start developing stuff without even having any knowledge about how the application was deployed. This can cause them trouble when they’d be required to build an application from scratch and make it production-ready.

Python libraries

wrapt

The aim of the wrapt module is to provide a transparent object proxy for Python, which can be used as the basis for the construction of function wrappers and decorator functions.

attrs

Python Classes Without Boilerplate.

dateparser

python parser for human readable dates

Django libraries

django-maintenance-mode

django-maintenance-mode shows a 503 error page when maintenance-mode is on.

It works at application level, so your django instance should be up.

It doesn't use database and doesn't prevent database access.

django-query-capture

Django Query Capture can check the query situation at a glance, notice slow queries, and notice where N+1 occurs.

Go

Introduction to DDD Lite: When microservices in Go are not enough

When I started working in Go, the community was not looking positively on techniques like DDD (Domain-Driven Design) and Clean Architecture. I heard multiple times: “Don’t do Java in Golang!”, “I’ve seen that in Java, please don’t!".

Tools

bpytop

Resource monitor that shows usage and stats for processor, memory, disks, network and processes.

lf

Terminal file manager

mpv

mpv is a free (as in freedom) media player for the command line. It supports a wide variety of media file formats, audio and video codecs, and subtitle types.

fzf

fzf is a general-purpose command-line fuzzy finder.

awesome-tuis

List of projects that provide terminal user interfaces

Other stuff

github.com/rafi/.config

Rafael Bodill's macOS/Archlinux dotfiles

Most influential books for programmers

These are books considered most influential for programmers from this StackOverflow thread.

Videos

Dan Palmer - Scaling Django to 500 apps

David Brumley - How the Best Hackers Learn Their Craft