cybrkyd

Papy - about the design

 Thu, 18 Sep 2025 15:51 UTC

I need to pause for a minute and get this out there.

I need to explain to myself why I have chosen to go with {% for %} loops. They are entirely unorthodox for this task, yet I have persisted.

There is one reason and one reason only: simplicity and elegance. I’ve come to believe that there is no such thing as a universal “best practice”. There only exists best practice for a specific context, and in this context, what works best is simplicity.

Let me take a comparative look at Papy versus Hugo/Jinja2/Django et al. Their approach is to give the developer everything they need and let them figure out what to do. So we end up with all the tools and a lot of very confused looks from us non-developers, especially when it comes to theming and wanting to make enhancements. There are too many if, else, elif, for, macro, filter, etc. to work with and that has always grated my nerves.

Papy just uses {% for %} loops. Only {% for %} loops. Plain, simple and elegant. It is easier to understand how to fit themes and enhancements into it. There is no conditional logic and there is not much to wrap your head around; it’s either 1 or 0, yes or no. It’s primitive and it is binary, like computer code. The Python handles the what (to show) and the theme handles the how (to show it).

I write this as I have frequently questioned why I am boxing in everything to either one of an “on” or “off” state. That is the answer. It has to be this simple because I want to spend no time at all in it trying to figure out how to change the front-end to comply with the back-end code.

Papy’s design totally goes against the grain, but that is deliberate.

»
Tagged in: #Python #PaPy

Visitors: Loading...