This blog post is for you if you’ve heard of the model context protocol (MCP) and are curious how you could implement something in Python such that you can try it with your local models that are capable of tool use, e.g. via Ollama. Maybe you even looked at the documentation but felt there still was something missing for you to get started? At least that’s how I felt. The “easiest” / Stdio server verison worked immediately but when I wanted to use a HTTP server I was sort of stranded. It was unclear to me how to actually run the server and what the client needs where so it can successfully talk to the server. Don’t get me wrong, the MCP and PydanticAI documentation is pretty good, but things could always be easier, could they not? :-P Maybe I’ll save you some time with this post. ...
"hypermedia systems"'s Contact.app built up step by step
TL;DR htmx can be quite useful, especially for python devs with not enough time to learn javascript frameworks but who needs an alternative to tools like streamlit. The “hypermedia systems” book quite a good read, I recommend reading it. My code discussed in this blog post very closely resembles the code in the “hypermedia systems” book, but is built up progressively, to make it easier to follow along the book when stepping through the chapters. I only cover parts I found essential though. But maybe my template is helpful to follow if you want to add components important to you. ...
"hypermedia systems"'s Contact.app with fasthtml
TL;DR fasthtml is new, still seems to have some quirks, but is a great tool to use if you want to keep all your frontend logic in python. Hello again In my previous blog post I wrote about htmx used with flask and jinja2 as done by the authors of the book “hypermedia systems”. Having done that one could wonder what that code would look like using fasthtml. This is what this blog post is about :), I know, you are probably shocked beyond belief, if you’ve seen my two previous posts. ...
Writing an interactive dataframe editor with fasthtml
Ever wanted to edit a pandas dataframe object in python in some interactive way felt too limited by streamlit but also did not want to pick up html / css / javascript just for that? Then one solution could be fasthtml, or python-fasthtml as it is called on PyPI. With that package you can write your client facing web code as well as your server side code from the comfort of python. And, if you manage to wrap your head around it, you can also use htmx. Not quite sure I’m fully there yet myself :-P. ...
Orbiting billiard balls - How to not implement papers / books
Recently I found a beautiful, although unphysical behavior when I was implementing the dynamics of elastic billiard balls ( hard spheres in physics lingo). And the bug was not at all where I expected it to be. But since while debugging I did not find any resource helping me out with this, and I think there is a good general lesson to be learned, I thought I write it up. Pretty images Okay. Mindset we want to simulate balls flying around and bouncing off of things, with the total kinetic energy being conserved. There is nothing else acting on the balls. No gravity, no nada. ...
Adventures in Hard Sphere Dynamics
Prolog After I’ve recently been working on getting the dynamics simulation of hard spheres right, see my previous blog post, I was curious about color coding neighborhood symmetries. To see if my small simulations are already sufficient to see some sort of systematic change. Like can we see “melting” or “crystallization”? :-) Turns out yes, for a pretty animation see below. :-) You may think this is all settled and researchers have long moved on and everything is understood, spelled out in simple language, organized and filed away for easy grokking. But then you, as I was, would be mistaken. Study of hard spheres seems actually still a matter of ongoing research. There were even experiments done on the space shuttle in 2001, to study the transition between “liquid” and “solid” states (if you are interested in the general concept of “phases” and their transitions, I recommend this wiki page :-) ). And more definitive data on liquid-hexatic and hexatic-crystal transition was only collected in 2017. For what hexatic phases are see this wiki page. ...
nix home-manager is actually useful
This is for you if … You have some spare time and want to dive into nix and or try another way to configure your machine environment. And let me tell you, nix is a great way of remedying the problem of never having had all software admin problems at the same time! Jokes aside, there actually is a decent way of managing your home setup, i.e. aliases and command line tools using home-manager. ...
rust + nix home-manager + vscode
In a previous post I shared how I set up the nix home-manager on linux. Now I had the problem that I wanted to make the rust-analyzer work properly in VSCode. Yes, for some reason, just adding the packages to home.nix packages like { lib, pkgs, ... }: { ... nix = { package = pkgs.nix; settings.experimental-features = [ "nix-command" "flakes" ]; }; home = { packages = with pkgs; [ cargo rustc rustfmt ]; }; } as one may think reading the NixOS rust wiki page does not actually work. I mean, not that they have a home-manager flakes example, but that was my best guess based on what I’ve read there. So using this guess, you can successfully run home-manager switch ... and develop rust code, but then VSCode’s rust extension with rust-analyzer gives you a lovely ...
Stapling a GUI on an Arch VM
Introduction In this post I assume you have successfully set up an Arch VM, e.g. like in my last post. The following is based on “General Recommendations” and various forum threads … :-D In order to get a pretty GUI to interact with we will 1) set up the networking config for the VM and 2) select and install graphics drivers, display server, a desktop environment and a display manager. An outline of the second can also be found here with a range of options for common desktop environments and display managers to choose from. ...
Setting up a basic Arch Linux VM on Ubuntu 24.04
Introduction Let’s set up an Arch Linux VM on a Ubuntu 24.04 host system. There is great material out there, e.g. this guide on installing Arch Linux, but I was missing small pieces here and there. Hence this post. Install Virtualbox One tool to manage virtual machines is Virtualbox. To install it run sudo apt install virtualbox For a more detailed guide please see this page. Now if you enter virtualbox -h in your terminal you should see something like ...