🦜 Adam Johnson
@adamj.eu@rss-parrot.net
I'm an automated parrot! I relay a website's RSS feed to the Fediverse. Every time a new post appears in the feed, I toot about it. Follow me to get all new posts in your Mastodon timeline!
Brought to you by the RSS Parrot.
---
Your feed and you don't want it here? Just
e-mail the birb.
Python: use re.prefixmatch() instead of re.match() from Python 3.15
https://adamj.eu/tech/2026/08/16/python-prefer-prefixmatch-to-match/
Published: August 15, 2026 23:00
Take this validation function:
import re
TRAIN_NUMBER_RE = re.compile(r"\d{6}") # six digits
def is_valid_train_number(value: str) -> bool:
return bool(TRAIN_NUMBER_RE.match(value))
It looks reasonable, and it works for the intended cases:
>>>…
Python: fix SyntaxWarning: invalid octal escape sequence
https://adamj.eu/tech/2026/08/14/why-does-python-log-a-warning-for-invalid-octal-escape-sequence/
Published: August 13, 2026 23:00
Take this code:
path = "C:\477_data"
If we run this with Python 3.11+ in development mode (to enable deprecation warnings), we will see:
$ python3.11 -X dev example.py
/.../example.py:1: DeprecationWarning: invalid octal escape sequence '\477'
path =…
Python: fix TypeError: NamedTuple() got an unexpected keyword argument
https://adamj.eu/tech/2026/08/13/python-fix-typeerror-namedtuple-got-an-unexpected-keyword-argument/
Published: August 12, 2026 23:00
Take this code, defining a small NamedTuple with a keyword argument per field:
from typing import NamedTuple
Point = NamedTuple("Point", x=int, y=int)
Run it on Python 3.13 or 3.14, and you’ll see:
$ python3.14 example.py
/.../example.py:3:…
Python: introducing emojet, a fast emoji lookup library
https://adamj.eu/tech/2026/08/12/python-introducing-emojet/
Published: August 11, 2026 23:00
New package just landed!
emojet is an emoji library for Python: it converts between emoji and their names, in both directions, plus the searching and lookup functions that go with that.
It covers the core API of the emoji package, a library that been…
Python: tprof 1.3.0: now with less overhead
https://adamj.eu/tech/2026/08/08/python-tprof-performance/
Published: August 7, 2026 23:00
Back in January, I introduced tprof, a targeting profiler for Python 3.12+ that measures the time spent in specific functions, rather than your whole program.
As a reminder, here’s the basic usage, specifying a target function with -t and a script to run:…
Django: introducing django-msgspec
https://adamj.eu/tech/2026/08/07/introducing-django-msgspec/
Published: August 7, 2026 21:24
It’s another day, another new package day here.
Say hello to django-msgspec, a package of drop-in replacements for Django and Django REST Framework (DRF) components backed by msgspec.
msgspec is a C-based serialization library covering JSON, MessagePack,…
Git: my git stash -p optimization in Git 2.55
https://adamj.eu/tech/2026/08/07/git-stash-p-optimization-story/
Published: August 7, 2026 20:05
I got another commit merged in Git 2.55 (2026-06-29), yay!
The release note reads:
"git stash -p" has been optimized by reusing cached index entries in its temporary index, avoiding unnecessary lstat() calls on unchanged files.
Here is the story of this…
Git: list files at a given commit with ls-tree
https://adamj.eu/tech/2026/08/07/git-list-files-at-commit/
Published: August 6, 2026 23:00
To list all files in your repository as they were at a given commit, use git ls-tree with its -r and --name-only options:
$ git ls-tree --name-only -r <commit>
Replace <commit> with any commit reference: a SHA, a branch name, a tag like above, a relative…
Git: exclude commits by an author in git log with --perl-regexp
https://adamj.eu/tech/2026/08/05/git-log-exclude-author/
Published: August 4, 2026 23:00
git log has an --author option to limit the output to commits from matching authors:
$ git log --author=<pattern>
But there’s no option to invert the filter and show commits from all authors except those matching a pattern.
Instead, you can build the…