News for hackers. Stuff that matters.
Re:Django and Postgres for the Busy Rails Developer by davepeck on Wednesday December 11, 2024 @02:48PM (#42392000)
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/

[2] https://htpy.dev

Re:Django and Postgres for the Busy Rails Developer by va1a on Wednesday December 11, 2024 @06:38PM (#42394350)
Didn'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.
Re:Django and Postgres for the Busy Rails Developer by giancarlostoro on Thursday December 12, 2024 @08:00AM (#42398774)
> 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.

Re:Django and Postgres for the Busy Rails Developer by globular-toast on Thursday December 12, 2024 @05:04AM (#42397856)
I 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/

Re:Django and Postgres for the Busy Rails Developer by davepeck on Thursday December 12, 2024 @12:14PM (#42401054)
PEP 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 to get them integrated with key tools (colorizers, formatters, linters, type checkers, etc). After that: let a thousand JSX-likes bloom.

[0] https://github.com/gvanrossum/pyxl3

Re:Django and Postgres for the Busy Rails Developer by globular-toast on Friday December 13, 2024 @01:46PM (#42411151)
Wow, had no idea about pyxl. Thanks for the background!