Posts tagged "python"

Flavio Curella

Dataclasses and attrs: when and why

Python 3.7 introduced dataclasses, which design is based on the "attrs" library. This article will show the way I use dataclasses and attrs, why I think you should use both, and why I think attrs is still very relevant.

Flavio Curella

Pro-Tip - Sentinel values in Python

It is often necessary to differentiate between an argument that has not been provided, and an argument provided with the value `None`. For that purpose, we create what's called a 'sentinel value'.

Lacey Williams Henschel

Today I Learned - Celery and Django and Docker: Oh My!

In this post, you will learn how to create a Celery task inside a Django project in a Docker container. Sounds awesome, right?

Flavio Curella

Today I Learned - Caching uuid's for the win!

More and more often, we see schema designs that use UUIDs as primary keys. That's a valid choice if you're concerned about sharding and partitioning your database, but it has its own drawbacks, sometimes in unexpected places.

Lacey Williams Henschel

Today I Learned - A Brief Intro to Docker for Djangonauts

Lacey didn't have the opportunity to work with Docker at her last job. In this tidbit she steps you through getting started with Docker for Django developers.

Frank Wiles

Pro-Tip - Python 3 run command over SSH

Sometimes you just need to run a command on a remote host with ssh and Python 3 without any real fuss. Here is the simplest way we have found to do that and retrieve the output. 

Frank Wiles

Pro-Tip - Python: atexit

Python's atexit handler is one of those things people should use more often.  Some developers aren't even aware that it exists and that makes me sad. 

Frank Wiles

Pro-Tip - Python 12-factor apps with envparse

Getting your configuration from the system environment for your Python and/or Django apps is often the best way to provide security and flexibility. envparse makes it easy. 

Flavio Curella

Pro-Tip - reverse()'s soulmate resolve()

Have a URL but can't figure out what view it is supposed to use? Use resolve() to easily and quickly determine it just as Django does.

Jeff Triplett

Pro-Tip - Extend Django Templates Smartly

You can use a variable to set the name of the template you are extending when using Django templates.