Introducing Pants v2

There are so many tools in the Python development ecosystem. Installing, configuring and orchestrating them—all while not re-executing work unnecessarily—is a hard problem, especially as your codebase grows. Fortunately, there is now a tailor-made (pun intended) solution: Pants v2! Toolchain has been a lead contributor to the Pants…

Election day is a company holiday

Voting is a critical part of our democratic process.  Your vote matters! Politicians wouldn't be fighting so hard over raising or removing barriers to voting if it didn't. One of those barriers is the fact that election day is not a national holiday. This makes it harder for working people…

Meetup Talk on Python and Build Systems

This Wednesday, May 13th, our co-founder Benjy Weinberger will be speaking at the SF Python meetup about how Python 3 helps us create our distributed build system. Of course, times being what they are, the meetup will be virtual and Benjy will be speaking via Zoom... But if you're interested…

os.walk has a major gotcha

Python's os.walk [https://docs.python.org/3/library/os.html#os.walk] is a very useful idiom for recursively iterating over a directory. However it has one big gotcha that bit us recently: by default, it silently no-ops if the directory doesn't exist: >>> import os >>> list(os.walk('/…

Introducing Toolchain!

Throughout our careers in software engineering, we’ve each worked on a variety of projects, using various programming languages and frameworks, at several different companies. Yet there was always one experience in common: Builds. Just. SUCKED. In fact, the common bond that unites every developer seems to be that builds…

TIL: Pythons 2 and 3 can coexist under pyenv

pyenv [https://github.com/pyenv/pyenv] is a wonderful tool for managing multiple Python versions on your system. It uses shims to select a specific interpreter either globally, per-directory or per-shell. I recently learned that you can actually select both a Python 2 and a Python 3 interpreter in a…

Python 3 text file encoding is still system-dependent

Python 3 assumes a default encoding of UTF-8 in a variety of useful scenarios. For example, s: str = buf.decode() will decode the byte buffer as UTF-8. And similarly for buf = s.encode().  Python 3 also defaults to encoding filenames as UTF-8, and Python 3 source code itself is encoded…

Django migrations directories cannot be namespace packages

Django's migrate command locates migration files for an app by loading a subpackage of the app, named migrations, and then searching that subpackage for modules. Unfortunately, there's a check in the code [https://github.com/django/django/blob/371ddade1e4e28827fd45e041c9410f8b4f01067/django/db/migrations/loader.py#L89] that does not allow migrations…

Terraform boolean gotcha

Terraform coerces the literal booleans false and true (e.g., when used as variable values) to 0 and 1 respectively. As a result, this ternary expression: count = "${var.myboolean == true ? 1 : 0}" unexpectedly always evaluates to 0. You want to use count = "${var.myboolean ? 1 : 0}" Or even just count…

ALB Ingress controller gotcha

If you're running a Kubernetes cluster on AWS (via EKS [https://aws.amazon.com/eks/], kops [https://github.com/kubernetes/kops], or otherwise), you're probably using the AWS ALB Ingress controller [https://github.com/kubernetes-sigs/aws-alb-ingress-controller] to create Application Load Balancers (ALBs) that map to Kubernetes Ingress [https://kubernetes.io/…