Week Notes: New Year, Fresh Start

The week of return: back to blogging, programming in Python and with Django again, and starting a few cool projects at work.

This blog has been quite silent since the end of November last year. The end of last year and the beginning of this year have been rather stressful. My job and some private hurdle have kept me so busy, that I didn’t find the mood and the time to write something on this blog. And by switching from WordPress to 11ty last year, I added an extra level of complexity to the process that completely killed my motivation.

But this was last year. Spring is coming. Motivation returns. And I find my focus again.

More Python, more Django

End of last year, I spent a lot of time playing around with SwiftUI and Elixir. Both are great technologies, but after reflecting on what lies ahead of me this year, I decided to focus on Python and Django again. Earlier this year, we took the decision to continue to maintain and extend a large Django application I started in 2008. To help the team, I needed to dive deeper into modern Python, its tooling and Django again. I instantly felt at home again.

While building some MVPs for research projects at work and refreshing two of the home automation apps we use at home, I created a modern starter template for Django 4.1.

I also learned about ruff – an extremely fast Python linter written in Rust. I was able to replace Flake8, a bunch of Flake8 plugins, pyupgrade and isort with it. And being able to configure ruff inside a pyproject.toml is a plus. Flake8 still relies on older config files.

Here is the configuration I use in my Python and Django projects at the moment. But I am still refining my selection of rules and rule sets. Ruff also has a great VSCode extension.

[tool.ruff]
select = ["A", "B", "C4", "E", "F", "I", "DJ", "INP", "TID", "UP", "YTT"]
ignore = []

# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["A", "B", "C4", "E", "F", "I", "TID", "UP"]
unfixable = []

# Exclude a variety of commonly ignored directories.
exclude = [
    ".bzr",
    ".direnv",
    ".eggs",
    ".git",
    ".github",
    ".hg",
    ".ruff_cache",
    ".svn",
    ".tox",
    ".venv",
    "__pypackages__",
    "_build",
    "build",
    "dist",
    "migrations",
    "node_modules",
    "static",
]

# Same as Black.
line-length = 100

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

# Assume Python 3.10.
target-version = "py311"

[tool.ruff.mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 10
TOML

AI for journalists

At work, we are building solutions for media companies and journalists. The uprise of AI for text and image generation, GPT 3, ChatGPT, and so on, are of course topics we have to research. Especially the release of the APIs for ChatGPT and Whisper are intriguing. With these tools, a lot of standard work can be done much quicker, leaving more time for the creative parts of journalism. We are also extending our product range with tools for AI-based layout automation.

It is a great time to be alive while such a disruptive change is happening. Let’s use all this technology for good.

Goodbye, 11ty!

Yes, this blog is running on WordPress again and I dropped 11ty. This is not 11ty’s fault. It is a fine toolkit to build a blog. But it complicated my workflow to a degree that I didn’t enjoy writing any more. Allow me to explain this a bit.

I am not a native English speaker, so I need a tool like LanguageTool to correct my spelling, check my grammar and also assure that I am not mixing American and British English. LanguageTool has a wonderful browser plugin that works like a charm in the Gutenberg editor. But with 11ty I had to write Markdown in VSCode, copy it to the LanguageTool desktop client, copy the corrections back to VSCode, run the built command and publish the results. Very nerdy, but far complicated for my taste.

With WordPress, it is more like: write, correct, publish and being done. All within a single tool.

That’s all for today and for the week.