Continuing from the last post, I also feel the same (ish) way about literally anything. I've even applied this to Gemini as I just can't bear writing excess boilerplate. From this issue, I have created Gemini Template Machine. It is incredibly basic so far but it can build a Gemini template using Jinja2 with no other notable features at the moment. Feel free to raise issues about whatever you would want in it however!

https://codeberg.org/amadaluzia/gtm

I'd love to hear your feedback!

#tech #programming #gemini_protocol #gemini #python #web #webdev

gtm

Gemini Template Machine

Codeberg.org

@amadaluzia os.mkdir in your build.py only works if the parent folder already exists.

I recommend using os.makedirs instead, which recursively creates the folder structure.

with ignore_errors=True, it also doesn't complain if the folder already exists.

@sesenion Looking at the docs now, though a bit pedantic, the most similar parameter to os.makedirs is exist_ok. It does essentially as you said. Good catch by the way! I'll get to it when I can.
@amadaluzia Right, the ignore_errors is with shutil.rmtree then. I frequently use both one after the other. Btw. pathlib also supports building recursive paths. There is a flag to create parents in Path.mkdir()