This is part one in my series on Generative Classes.
A Python Generative Class is defined as
a class that returns or clones, i.e. generates, itself when accessed by certain means
This type of class can be used to implement method chaining or to mutate an object's state without modifying the original class instance.
An example of a generative class would be one that supports method chaining:
It seems that one of the biggest questions around Flask-SQLAlchemy is how to use SQLAlchemy models outside of a Flask application. Several questions have been posted on sites like Stackoverflow and Reddit. There is an open issue on Github asking to document how to use your own declarative base class. As of this writing, there are even several pull requests to make Flask-SQLAlchemy easier to work with in this regard. However, none of the answers or discussions really take the time to parse through what Flask-SQLAlchemy does internally and how you can effectively decouple SQLAlchemy model integration from Flask-SQLAlchemy.
One of the challenges when deploying a static blog site to Github Pages is having a good workflow for accomplishing the task easily. By default Github Pages will use Jekyll to build your site for you, but if you're using something else besides Jekyll, then you're on your own.
- Have two repositories: (1) for the source code and (2) for the deployed site.
- Only maintain version history in the source code repository (1) while deploying a snapshot with no history to (2).
- Have a single command for deployment.
This is my obligatory first post where I describe the foundations of this blog and why I started it.
My main motivation for creating this blog was to put my thoughts down in digital format. I wanted an outlet to expand upon my experiences in software engineering and the open source Python community.
Choosing a Static Site Generator
I always thought that my first blog would be backed by something like Wordpress, but that was years ago. Now that I've actually built one, I've chosen a static site generator instead. Before implementing this site, I researched several static blog engines to find one that best met my needs. Along the way, I researched Pelican, Tinkerer, and Nikola.
My main requirements for a static blogging platform were:
- Easy to use
- Supports reStructuredText
- Uses Jinja for templating
- Sufficient features
- Not overly complicated