attrs supports frozen classes. Frozen classes are cool for a multitude of reasons, but they're a tiny bit slower to instantiate compared to non-frozen classes. But there's a way to avoid this overhead and make frozen classes be the exact same speed as ordinary classes.| The Three of Wands
Say you're writing a Python program, of any kind but maybe a network service. You're likely to err (you're human, after all) and produce errors (bugs, defects) during this process. We can't control whether we make mistakes or not but there are steps we can take to control what kinds| The Three of Wands
Instead of my usual Twitter and Fediverse threads, for this release of cattrs I figured I'd try something different. A blog post lets me describe the additions in more detail, provide context and usage examples, and produces a permanent record that can be linked to from the relevant places, like| The Three of Wands
Everyone doing Python nowadays is aware Python supports optional type hints, and has for some time now. This has created a small schism in the community, with some people being completely uninterested in type hinting and a little defensive about the language partially going into a new direction, some people| The Three of Wands
Performing I/O concurrently is one of asyncio's superpowers (if not its main superpower). This is accomplished, directly or indirectly (through helpers like asyncio.gather), by the creation and use of asyncio tasks. Even if you've never created an asyncio task yourself or called gather, you've used them because every| The Three of Wands
Over the years, I've put a lot of effort into making cattrs fast. Let's take a look at how the cattrs structuring code evolved during this time.| The Three of Wands
This post is an account of why I prefer using the attrs library over Pydantic. I'm writing it since I am often asked this question and I want to have something concrete to link to.| The Three of Wands
If you've ever gone through the Mypy docs, you might have seen the section on TypedDict. The section goes on to introduce the feature by stating: Python programs often use dictionaries with string keys to represent objects. [...] you can use a TypedDict to give a precise type for objects like| The Three of Wands
Arq is a job library for Python's asyncio. This article is up-to-date with Arq v0.19 The Point of Job Libraries The main point of (what I colloquially call) a job library is, essentially, to execute a function (i.e. job) somewhere else, and potentially at a different time. When| The Three of Wands
This is the third article in the Pyrseia series. The others are: Building Pyrseia I: The Idea Building Pyrseia II: Fleshing out Clients and Servers If you want to follow along with the code, this article refers to commit 5abf2eda9be06b7417395a50ef676454bbd8f667. Server Middleware I've added the concept of server middleware to| The Three of Wands
This is the second article in the Pyrseia series. The others are: Building Pyrseia I: The Idea Building Pyrseia III: Server Middleware, Client Senders, CLI and InApp Validators If you want to follow along with the code, this article refers to commit 2db40614bd926d1ef2854669a634fcfa3ba25502. Decoupling the API from the Client The| The Three of Wands
Over at Highrise, we're looking to replace our internal Python RPC library. The in-house solution we're using now isn't particularly bad, but it doesn't integrate well with Mypy, which is a Python typechecker that might be useful to us. It's also somewhat boilerplate-y, and very coupled to our particular set| The Three of Wands
This is the third post in my series on the inner workings of attrs. Here are the others: attrs I: The Basics attrs II: Slots What are Frozen Classes Frozen, in this context, is a synonym for immutable. The term frozen was chosen because there's precedent in the standard library| The Three of Wands
This is the second post in my series on the inner workings of attrs. The series starts here. Out of the box, attrs can customize your classes in two different, orthogonal ways - make your class a slot class (instead of a normal Python class, which for simplicity's sake we'll| The Three of Wands
This is the first article in my series on the inner workings of attrs. Attrs is a Python library for defining classes a different (much better) way. The docs can be found at attrs.readthedocs.org and are pretty good; they explain how and why you should use attrs. And| The Three of Wands
By properly utilizing Algebraic Data Types (ADTs, not to be confused with abstract data types), you can transform certain types of invalid states from runtime errors into type-checking errors, making them an excellent method for representing data and managing state. Although ADTs may sound complex, they represent a fairly straightforward| The Three of Wands