The Sample Programs Website Is Fully Automated

The Sample Programs Website Is Fully Automated Featured Image

Earlier this year, I had an idea to automate the Sample Programs website. Turns out, it wasn’t that hard to do. Now, the website is automatically built on every pull request. Let’s talk about it!

Table of Contents

What Is Website Automation?

Previously, the Sample Programs website was only partially automated. Basically, all articles were written by hand and had to be updated by hand. That said, the website itself was built automatically using GitHub pages.

One thing I wanted to do was loop in Subete, so we could generate a majority of the website by traversing the repo. In other words, we could build out all of the Sample Programs pages automatically. Not only that, but we could also build out the major index pages automatically.

As a result, we have a website where all of the articles are automated based on Subete. The majority of the documentation still needs to be written by hand, but the code itself exists as expected. In other words, here are pages that are fully automated:

In addition, all subpages are fully automated. For instance, the Python language pageOpens in a new tab. is built dynamically by pulling in existing docs. Likewise, the Fizz Buzz in PythonOpens in a new tab. page is generated in a similar capacity. In the next section, we’ll talk about how this was done.

How to Automate a Website?

As mentioned previously, a major driver of the automation was a tool I developed called SubeteOpens in a new tab.. In short, Subete is a library for exploring the Sample Programs repo. As a result, you’ll get Python objects that represent the repositories contents.

In addition, each page is automated using another library I wrote called SnakeMDOpens in a new tab.. SnakeMD is a tool for generating Markdown code using Python.

Together, the two libraries are used to iterate over the Sample Programs repo while simultaneously generating the appropriate Markdown for the website. The code itself is pretty messy, but it helped me flesh out some real world use cases for both of my libraries. As a result, they’re significantly more robust.

With all that said, the final task was to link in existing documentation, so I changed up the repo’s structure. Now, all sources can be found in the sources folder. If the sources exist at the time of website automation, they’re looped in. Otherwise, generic text is included.

Ultimately, everything is hooked into GitHub Actions which regularly generate the website on each push to main. How cool is that?

Future Plans

Looking at the website as it stands, there are definitely some issues I’d like to resolve. For example, the actual sample programs pages are a mess. They include the current solution but old documentation still sits around. Therefore, there’s a mismatch. Likewise, each sample program page includes a “how to run the solution” section which is fairly redundant at this point. It should be automated.

With that said, I’m not planning to work on the website for a while. I like where it’s at, and I’m busy otherwise. If anyone would like to take this project on, let me know!

While you’re here, why not check out some more cool stuff:

Likewise, if you’re interested, consider supporting the site in other ways. Otherwise, take care!

Sample Programs Repo News (18 Articles)—Series Navigation

Everyone once in awhile, I like to update y’all on what’s going on in the Sample Programs repo. At this point, I’ve written quite a few updates, so I figured it might be helpful to group them as a series.

Jeremy Grifski

Jeremy grew up in a small town where he enjoyed playing soccer and video games, practicing taekwondo, and trading Pokémon cards. Once out of the nest, he pursued a Bachelors in Computer Engineering with a minor in Game Design. After college, he spent about two years writing software for a major engineering company. Then, he earned a master's in Computer Science and Engineering. Today, he pursues a PhD in Engineering Education in order to ultimately land a teaching gig. In his spare time, Jeremy enjoys spending time with his wife, playing Overwatch and Phantasy Star Online 2, practicing trombone, watching Penguins hockey, and traveling the world.

Recent Meta Posts