Conversation
Current state: nodes.py contains only data types. processor.py contains all resolution logic. Current separation is clean — nodes.py is "output types" and processor.py is "template resolution." Moving Node processing logic into nodes.py would blur this(eventually if not immediate) |
|
Why change API signature, html -> to_html ? i would not mind html -> H atleast terse name collisions? but, then one can always do import html as to_html |
this breaks {condition and template} or {condition and some_func() } which pretty common used in templating. |
…d some missing annotations.
|
@davepeck @pauleveritt Can you guys take another look at this when you get a chance? It is a very large conceptual change RE: the component signature and the default processor. I walked back the more ambitious pre-compiled template concept and now both processors are using The interpolation value options are more strict because I was trying to makes the rules more well defined. |
|
Thanks for all the work @ianjosephwilson I'll see if @davepeck has time this week to go through it together. (Dave: Any afternoon/evening my time is fine.) |
|
@ianjosephwilson Thank you for this -- I think I have time this week to re-focus energies and read over in more detail. How does this PR relate to the other open and draft PRs we currently have? (@AhnafCodes -- thank you for hopping in here, and nice to have you on board! I agree that |
@davepeck At this point it might be easier to just browse the processor.py and processor_test.py files instead of diffs to get a feel for what changed. I think these are the major things:
|
|
@davepeck Would it be easier if I broke some of the smaller less related pieces out of this and we merged those first? |
davepeck
left a comment
There was a problem hiding this comment.
@davepeck Would it be easier if I broke some of the smaller less related pieces out of this and we merged those first?
I'm sort of working through it in one fell swoop right now. Thanks for all the guide posts here. I do think there are some separable pieces we could consider teasing apart into separate PRs, but I dunno... that may be more work than it's worth.
|
I put some smaller changes in #109 to reduce the size of this PR. I can rebase it if those go in. |
The SVG work required some rewrites in the merged version, but are fairly straightforward. The dependency updates introduce much newer versions of `ruff` and `ty`, which both had new and interesting things to complain about. So there's a bunch of frobnication from that; sorry. -Dave Merge branch 'main' into pr/ianjosephwilson/105
|
I just merged in the |
|
@davepeck Okay, I didn't have great luck with I would probably put the Do you think you're still thinking about merging this? Or did you have questions about it? |
|
The Stepping back: I've had lots of conversations in the past ~6 weeks with developers about what they actually want. Here are my takeaways:
Your PR addresses (1) and says "we can do better" for (2). Which... good! I'm still sitting on this PR. Directionally, it's where we want to go. But: to merge it is to commit to maintaining it; I'm not ready yet. I'm still exploring variations on this PR's theme. |
Okay, I'm just going to take
Performance is definitely on the back burner now but these changes do remove the recursion because that was traditionally a big memory problem in Python but maybe it is not anymore? I think it is easy to remove and would guarantee some level of stability so I think it is worth it. I would be open to new information though.
I was pushing for more well defined behavior for this reason which is a big part of these changes: #106
The documentation will need to be adjusted but that is blocked by carving out well defined behavior.
This seems like this could be an addition or extension but it shouldn't block current progress. It would be nice to be able to use tdom without further dependencies if possible.
I'm going to draft this and try to put out a better draft. Let me know if you think meeting again could help sort out some of the issues. |
Yeah, that's the right answer, I think.
Yeah, and to be clear I'm in favor of removing recursion if there's a low-complexity way to do so. I don't quite feel we've gotten there yet. It's also probably worth calling out that: what the real-world benefits are is... harder to say at the moment. Comes back to having actual users. |
|
Anything I can do to try and keep a tdom-node package alongside? I can read from a rendered template, but perhaps I can learn more about the template internals and do something smarter? About tracking component location and static paths, I guess I need to give up on this and come up with a workaround, make people do it manually. |
nodes/nodes/processor.pynodes.pyintonodes/nodes.pyTemplateso the actual contents are not processed until after the component is invoked.to_html(t'<div>{(lambda: "dynamic")}</div>') != '<div>dynamic</div>'callbackcan be used which then interpolates the return valueto_html(t'<div>{(lambda: "dynamic"):callback}</div>') == '<div>dynamic</div>'to_html(t'<div>{False}</div>') == "<div>False</div>"Noneis still ignored:to_html(t'<div>{None}</div>') == "<div></div>"