3 ms·
I think of Django's templating system as a great tool for a previous era. I'm hopeful that PEP 750 [1] gets accepted and a modern ecosystem of template engines
by davepeck 2y ago
I think of Django's templating system as a great tool for a previous era. I'm hopeful that PEP 750 [1] gets accepted and a modern ecosystem of template engines emerges in Python-land. For the moment, I tend to use in-python builders like htpy [2] when I want back-end Python code to generate some HTML.
[1] https://pep-previews--4124.org.readthedocs.build/pep-0750/ https://pep-previews--4124.org.readthedocs.build/pep-0750/
[2] https://htpy.dev https://htpy.dev
- va1a 2y agoDidn't know about pep 750, that's really cool that there's a push for native templating. I just hope we see a gradual stepping away of "everything clientside" and the JS framework hell that exists today. I've tried and I've tried but I just can't take javascript seriously. It's so ugly and overbuilt. It should never have been brought to the server, Node was a horrible mistake. In my ideal future, the web returns to servers doing their jobs, and JS being used for minor interactivity features when necessary.
- giancarlostoro 2y ago> I just hope we see a gradual stepping away of "everything clientside" and the JS framework hell that exists today. The nice thing about Blazor is you can either have your templates as WASM, or have them be back-end driven, and Blazor does a bit of the gluing for you so your site updates as things happen and need to be updated, like Phoenix LiveView.
- globular-toast 2y agoI use htpy and it's great. There are others like htmy[0] too. The problem with templates in general is you can write malformed HTML in them. The nice thing about htpy et al is you simply can't do that. I feel like what we really want is JSX in Python, where you can write XML-like syntax and it's converted into Python at import time. [0] https://volfpeter.github.io/htmy/ https://volfpeter.github.io/htmy/
- davepeck 2y agoPEP 750 started its life in part as a result of learnings from pyxl [0], which used some clever hacks to add a JSX-like syntax to Python. In the end, my instinct is that t-strings are the better more generic feature to add to the language itself today. That said, I'd love to see the Python ecosystem get to the point where it's relatively easy to implement transpilers and get new grammars integrated with key tools (colorizers, formatters, linters, type checkers, etc). After that: let a thousand JSX-likes bloom. [0] https://github.com/gvanrossum/pyxl3 https://github.com/gvanrossum/pyxl3
- globular-toast 2y agoWow, had no idea about pyxl. Thanks for the background!