3 ms·
Funny you mention templating, its one key thing I'd change about Django, that... and maybe scaffolding, I'd crank it up drastically more. My ideal enhancement
by giancarlostoro 2y ago
Funny you mention templating, its one key thing I'd change about Django, that... and maybe scaffolding, I'd crank it up drastically more.
My ideal enhancement to Django would be something like how Microsoft made Razor into Blazor... A template engine that can run purely on the back-end or purely on the front-end, replacing any need to ever use JavaScript, you stick to your native programming tongue if you will.
- davepeck 2y agoI 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!
- silviogutierrez 2y agoNothing on the python side for templating will ever come close to React or things like that. I built https://www.reactivated.io https://www.reactivated.io specifically to let python do what it does best (business logic / backend) and render using React. But all still server side without the downsides of a SPA.
- giancarlostoro 2y agoIt can, just needs to be built. I'm thinking of something that can both compile to WASM AND be somewhat like Phoenix Liveview. Looks like there's some attempts for Phoenix Liveview for Python. https://github.com/liveviews/liveviews?tab=readme-ov-file#python https://github.com/liveviews/liveviews?tab=readme-ov-file#py...
- silviogutierrez 2y agoI think the foundation, sure. But the ecosystem of React, including UI libraries, charting, forms, and so forth, is enormous.
- giancarlostoro 2y agoEvery developer I know who has adopted Blazor never wants to go back and touch JavaScript. If you do it right, it will sell itself, your market isn't people who use React exclusively, but people using Python and possibly react, but also any other web framework. IMHO the key thing would be a standard similar to WSGI for this system, so it can be implemented and supported by any web framework. ... the more I think about it, the more I am going to have to look at writing a draft PEP...