Python - Singleton
I saw some interesting Python singleton code in the wild today. It was used for a Redis connection pool.
It looked like this.
I saw some interesting Python singleton code in the wild today. It was used for a Redis connection pool.
It looked like this.
I’ve started learning about GraphQL.
The best summary I’ve seen so far is the graphene-python “Getting Started” guide.
This post also talks about the dataloader pattern to helps solve n+1 query issues.
Apollo Codegen also looks like a good way to share GraphQL types with the front-end.
I came across an interesting article that talks about speeding up the processing of fast running celery tasks by tuning worker_prefetch_multiplier: https://www.lorenzogil.com/blog/2020/03/01/celery-tasks/
The default scheduling strategy in Celery is now “fair”, so part of the article doesn’t apply anymore.
The v1.6 update for the Raspberry Pi Imager added a new shortcut (CTRL + Shift + X) that allows enabling SSH, configuring WiFi, setting hostname, and more.
Hackaday posted an article about my Raspberry Pi 1U Server project.
I’ve been manually removing the line from .known_hosts when I saw this message:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:<key>.
Please contact your system administrator.
Add correct host key in /Users/<user>/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/<user>/.ssh/known_hosts:85
ECDSA host key for <ip> has changed and you have requested strict checking.
Host key verification failed.
Today I found out about this command to remove entries from known_hosts: ssh-keygen -R hostname
I’ve been working on a power efficient 1U server made with Raspberry Pi’s to take advantage of cheap server colocation options: 


More details: Github
I’ve been poking around with adding type hints to Python code automatically. Here’s my process so far:
I saw the attrs project has a link to their changelog on pypi: 
It turns out that’s controlled by the project_urls section of the setup.py.
More details: Python Docs
Updated 2026-10-02: reworked for PEP 668, which changes the answer.
I recently saw a Dockerfile based on the official docker Debian image that was installing dependencies into a virtualenv.
At first I figured it didn’t need one, because the image has no system Python to isolate from:
$ docker run -it debian /bin/bash
root@21ca17310079:/# python
bash: python: command not found
A Dockerfile that needs Python has to apt-get install python3, though, and since Debian 12 that Python is marked externally managed (PEP 668), so pip refuses to install into it outside a virtualenv (error: externally-managed-environment). The virtualenv was the right call:
FROM debian
RUN apt-get update && apt-get install -y python3-venv
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
COPY requirements.txt .
RUN pip install -r requirements.txt
The official python image doesn’t need this, since it builds its own Python under /usr/local without the marker.