Debating the idom.html.*
interface
#916
Replies: 3 comments 8 replies
-
I think I'm in favor of keeping the old interface as well. In addition to the cons mentioned above, many of the proposed interfaces will be more complex to implement than the old one which incurs extra maintenance and performance costs. |
Beta Was this translation helpful? Give feedback.
-
@rmorshea I think the one change we should make for v1.0.0 is the location where Right now, it is a It would be more proper to declare html.div(
{"key": 123, "class_name": "example"},
html.button(),
) Given we've had a lot of type hint issues surrounding Maybe a @component
def my_component(arg1: str):
return arg1
html.div(
{"key": 123, "class_name": "example"},
my_component(
{"key": 666},
"demo",
),
html.button(),
) |
Beta Was this translation helpful? Give feedback.
-
I am seeing some movement towards context manager interfaces for defining UIs - textual just released their own version of this and reacton the jupyter widget based react-like solution is doing the same. At this point, I'm not sure I want to rewrite everything again, but I'd be open to creating an additional way to do this. Wouldn't be too difficult to make something like this possible: v = View()
with v.div(class_name="this”):
with v(my_component, some_kwarg=“that”):
v.button(on_click=...)
return v There is the problem of multiple context managers |
Beta Was this translation helpful? Give feedback.
-
With the release of IDOM
v3.0.0a1
, there has been a lengthy discussion onidom.html.*
interface change?I had proposed some guidelines on what could be considered a good interface and have been frequently updating a demonstration gist containing feasible design choices.
The guidelines comment also contains some details on which interfaces are in violation.
Given the new constraints/goals/guidelines, my personal rankings are:
dict
directly has some added convenience and efficiency due to the pipe operatordict
often times adds additional indentation.black
, additional vertical space is also added as a whole LOC is taken up by opening/closing bracketsTypeDict
keys isn't robust in some editorsdict
then unpacking it. This is inefficient.children
keyword could be additional noisecc: @rmorshea @numpde
Beta Was this translation helpful? Give feedback.
All reactions