Archive

All published posts

Underground Bases with Wyatt

Playing minecraft with Wyatt today he started a server all on his own and had me join. All vanilla, only one rule, underground bases.

I spawned into the server and it was already night time. I gathered up some wood on my way down a tree, and was attacked by zombies before I could get any tools, so I ran up another tree and crafted a crafting table.

Now to follow the rules, it’s time to head underground to build my base.

...

I took a break

Life comes in waves, and sometimes you need to set down some of your projects to focus on others. For the first part of 2023 I’ve really had a lot of family stuff to focus on, we also are pretty new homeowners and are still trying to get our new to us house cleaned up and modernized.

You can see in my growing list of repos that I have poked around on quite a few side projects over the past few months. This has been quite relaxng to me, mostly things that I use to learn from, but also a lot that are tools and things I use that bring me joy.

I haven’t wrote about it at all yet, but I have really been starting to lean into pydantic on all of these side projects. I have really been enjoying the type system. A good friend @pypeaday got me hooked and we have been throwing around this phrase that he learned from a math professor “Make it So”. The idea boils down to leveraging pydantic to make all the values you want to exist up front, or fail validation, then have no more checks scattered all over your code.

...

Pydantic and singledispatch

I was reading about pydantic-singledispatch from Giddeon’s blog and found it very intersting. I’m getting ready to implement pydantic on my static site generator markata, and I think there are so uses for this idea, so I want to try it out.

Let’s set up some pydantic settings. We will need separate Models for each environment that we want to support for this to work. The whole idea is to use functools.singledispatch and type hints to provide unique execution for each environment. We might want something like a path_prefix in prod for environments like GithubPages that deploy to /<name-of-repo> while keeping the root at / in dev.

Here is our model for our settings. We will create a CommonSettings model that will be used by all environments. We will also create a DevSettings model that will be used in dev and ProdSettings that will be used in prod. We will use env as the discriminator so pydantic knows which model to use.

...

2 min read