This is a simple example to show how Asyncio works without using Asyncio itself, instead using a basic and poorly written event loop. This is only meant to give a flavor of what Asyncio does behind the curtains. I’m avoiding most details of the library design, like callbacks, just to keep this simple. Since this is written as an illustration, rather than real code, I’m going to dispense with trying to keep it 2.7 compatible.
[Read More]My favorite posts and series
C++11 C++14 C++17 C++20 C++23 2→3 3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 3.15 macOS setup AS setup Windows setup SSH
My classes and books
Modern CMake CompClass se-for-sci
My workshops
CMake Workshop CPU GPU Compiled Level Up Your Python Packaging
My Python libraries
packaging cibuildwheel build pipx dependency-groups pyproject-metadata scikit-build (classic, core, cmake, ninja, moderncmakedomain, sample-projects) pybind11 (python_example scikit_build_example) meson-python boost-histogram Hist UHI Vector GooFit Particle DecayLanguage Conda-Forge ROOT uproot-browser nox Scientific-Python/cookie repo-review validate-pyproject(-schema-store) flake8-errmsg flake8-lazy check-sdist pytest GHA annotate-failures Plumbum
My other projects
CLI11 beautifulhugo Jekyll-Indico POVM hypernewsviewer AoC 2023 AoC 2024 AoC 2025
My sites
Scientific-Python Development Guide IRIS-HEP Scikit-HEP Scikit-Build CLARIPHY
Feynman Diagrams in Tikz
There is a package for making Feynman diagrams in LaTeX. Unfortunately, it is
old and dvi latex only. If you are using pdflatex or lualatex, as you should
be, it does not work. Even in regular LaTeX, it’s a bit of a pain. Why is there
not a new package for pdflatex? Turns out, you don’t need one. Due to the
powerful drawing library Tikz, you can create any diagram easily, and can
customize it completely. For example:

Including CRY cosmic ray generator in CMake
I realized that CRY did not have a CMake based install option, so including it in a GEANT4 cmake project might not be obvious. This is how you would do it in your CMakeLists.txt:
[Read More]GTest Submodule
Note: There is a better way to do this described here.
If you’ve ever tried apt-get or brew to try to install gtest, you are
probably familiar with the fact that gtest is not “recommended” for global
install on your system. As an alternative, the recommendation is that you make
it part of your project. The process for making gtest part of your project,
however, is not well documented, at least for modern git projects. What follows
is the procedure I used to do so.
Slots in Python
Slots seem to be poorly documented. What they do is simple, but whether they are used is tricky. This is a little mini-post on slots.
[Read More]Basics of metaclasses
This is a quick tutorial over the basics of what metaclasses do.
The Metaclass
Metaclasses, while seemingly a complex topic, really just do something very simple. They control what happens when you have code that turns into a class object. The normal place they are executed is right after the class statement. Let’s see that in action by using print as our metaclass.
[Read More]Factory classmethods in Python
I haven’t seen a great deal of practical documentation about using classmethods as factories in Python (which is arguably the most important use of a classmethod, IMO). This post hopes to fill in that gap.
[Read More]Making an autoload extension for IPython
I recently decided to try my hand at making an auto-load extension for Python and Plumbum. I was planning to suggest it as a new feature, then I thought it might be an experimental feature, and now it’s just a blog post. But it was an interesting idea and didn’t seem to be well documented process on the web. So, here it is.
The plan was to make commands like this:
[Read More]