Python Package: frontmatter
One of these days, I’m going to sit down and create a static website generator similar to Jekyll and Hugo. It’s not likely I’ll be able to make anything better than those two large projects, but I want to do it for the learning experience, and to eventually have my own blog powered by software that I wrote. I have decided to use Python 3 for this project, so in preparation for that, I wrote a simple YAML Front Matter parser package and uploaded it to the Python Package Index. It’s called frontmatter.
Since my blog posts are currently written in Markdown with YAML metadata at the top (aka “front matter”), one of the things I need is a way to separate this YAML metadata from the post content. Ideally, my published posts will be fully compatible with the new static site generator right out of the gate. I already went through one major blog migration earlier this year and migrating all of my posts was by far the most time-consuming and tedious part of that.
There are other Python packages with similar functionality to my frontmatter package, but I wanted something that is as simple as possible, and something that I can continue to maintain and add to over time. I could have forked another project, but since my static website generator will be a learning experience, I wanted to write this part as well (it was a fun little project anyway). My package does depend on the PyYAML for the actual YAML parsing, however.
I haven’t officially started the static site generator project yet, but writing the smaller dependencies that can be packaged up into separate libraries will only help get it off the ground when I am ready.