Setting up GitHub Actions for a modern Django project

Photo by Puk Patrick on Unsplash
Photo by Puk Patrick on Unsplash
Photo by Puk Patrick on Unsplash

Few things are as detrimental to productivity as slow feedback loops—slow tests trickle down to slow product rollouts, slow deployments, slow developer speed; and ultimately a sour developer experience for the team.

Setting up CI is pretty time consuming—it’s usually a trial-and-error shit-show where you spend most of your time watching things passing, passing, passing… and failing on the last line, after 15 minutes and 6000 unit tests.

After a bunch of personal frustration I figured out how to get things running rapidly, and I’d like to share a pragmatic, rapid workflow for a modern Django project — but these steps can be abstracted for JS, Golang, or any codebase. …


Avoiding common pitfalls when dealing with timezones

Image for post
Image for post
Photo by Sonja Langford

Running into timezone trouble in your Python project? Here’s a quick primer on how timezones work and how to convert between them (mostly because I usually forget how to do this myself).

We’ll be using the popular pytz package, so make sure it’s installed.

🙃 Naive and aware datetimes

A naive datetime doesn’t have a timezone associated with it. An aware one does.

from datetime import datetime
from pytz import timezone
# Set the time to noon on 2019-08-19
naive = datetime(2019, 08, 19, 12, 00)
# Let's treat this time as being in the UTC timezone
aware = timezone('UTC').localize(naive)

pytz.localize() is useful for making a naive timezone aware. I find that it’s useful when a front-end client sends a datetime to the backend to be treated as a particular timezone (usually UTC). …


Understand the concepts behind crypto with zero code

Image for post
Image for post

The best way to learn how blockchains work is to play with them. This often requires tons of coding, but I’m hoping to spare you from all that and explain this stuff using Google Sheets—you don’t need to be a programmer to understand how Blockchains work after all.

👉 I’ve shared a special Google Sheet. You’ll need it to follow along… and when you’re done you’ll have fun explaining it to your coworkers and friends. You’ll need to click on File > Create a Copy before you can play with it.

🐓 Hashing

The first and most important thing to understand is hashing. If Blockchains contain bricks, hashing is the mortar — the magic sauce that holds everything together. …


The missing guide for setting up a great local development workflow for your Python projects.

Image for post
Image for post
“Python Environment” by xkcd

This is an opinionated way of developing with Python locally. You’ve probably discovered that it’s a pain in the ass to manage different projects with dependencies targeting different Python versions on your local machine.

To complicate things, there are multiple ways of installing Python too:

  • Preinstallation by the OS 😔
  • Using a package manager like brew or apt 😕
  • Using the binaries from www.python.org 😫
  • Using pyenv—easy way to install and manage Python installations 😎

This guide uses pyenv to manage Python installations, and Pipenv to manage project dependencies (instead of raw pip).

Installing pyenv

Let’s install via brew:

$ brew install…


The fastest way to learn how Blockchains work is to build one

Image for post
Image for post

You’re here because, like me, you’re psyched about the rise of Cryptocurrencies. And you want to know how Blockchains work—the fundamental technology behind them.

But understanding Blockchains isn’t easy—or at least wasn’t for me. I trudged through dense videos, followed porous tutorials, and dealt with the amplified frustration of too few examples.

I like learning by doing. It forces me to deal with the subject matter at a code level, which gets it sticking. If you do the same, at the end of this guide you’ll have a functioning Blockchain with a solid grasp of how they work.

Before you get started…

Remember that a blockchain is an immutable, sequential chain of records called Blocks. They can contain transactions, files or any data you like, really. But the important thing is that they’re chained together using hashes. …

About

Daniel van Flymen

https://twitter.com/van_flymen • Software Engineer • https://dvf.nyc • South African in NYC ✌️

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