I just finished* writing the static site generator for this blog. And I'm actually kind of excited about it! Though creating yet another static site engine is probablyβ€”no definitelyβ€”overkill, none of generators I looked at and played with met my exact needs...

I knew that I wanted something super lightweight. Something that could seamlessly handle markdown files and Jupyter notebooks. And something that was built in Python. So I built my own thing.

Right now, the main chunk of code that powers this website is sitting at about 100 lines. Where, importantly, most of the heavy lifting within that file is delegated to jinja2, markdown2, and nbconvert. Beyond these wonderful packages, I'm using Bootstrap, Pygments and GitHub Pages to pull everything together.

And it really does all pull together. For example, this page is generated by this notebook. All I had to do to publish was type make publish into a terminal.

With my new bespoke static site generator (which, I guess I should just call yass at this point?) I can handle DataFrames:

import pandas as pd

df = pd.DataFrame({
    'artist': ['Tame Impala', 'Childish Gambino', 'The Knocks'],
    'listens': [8_456_831, 18_185_245, 2_556_448]


artist listens
0 Tame Impala 8456831
1 Childish Gambino 18185245
2 The Knocks 2556448

Print statements and flashy outputs (shameless chart plug):

from chart import bar

print('\nGood shit...\n')
bar(df.listens, df.artist, width=20, mark='πŸ”Š')

Good shit...

     Tame Impala: πŸ”ŠπŸ”ŠπŸ”ŠπŸ”ŠπŸ”ŠπŸ”ŠπŸ”ŠπŸ”ŠπŸ”Š           
Childish Gambino: πŸ”ŠπŸ”ŠπŸ”ŠπŸ”ŠπŸ”ŠπŸ”ŠπŸ”ŠπŸ”ŠπŸ”ŠπŸ”ŠπŸ”ŠπŸ”ŠπŸ”ŠπŸ”ŠπŸ”ŠπŸ”ŠπŸ”ŠπŸ”ŠπŸ”ŠπŸ”Š
      The Knocks: πŸ”ŠπŸ”ŠπŸ”Š                 

Matplotlib graphs (harder than it looks, but that's the point):

import numpy as np
from matplotlib import pyplot as plt
%matplotlib inline

N = 500
x = np.random.normal(10, 5, size=N)
y = 2 * x + np.random.normal(0, 5, size=N)

plt.figure(figsize=(6, 4))
plt.scatter(x, y, c='r', alpha=1/5);


And embedded images:

I've ostensibly removed all of the barriers that historically prevented me from updating my blog regularly over the past couple of years. So expect me to write more? Hopefully? We'll see...

*nothing is ever finished