Deep reactivity in pyscript #15711
Replies: 3 comments 2 replies
-
Some of those might not be implemented at all, others conditionally depending on compilation flags. Which can be different depending on which port/MCU is being used. So it's possible someone reports something as working whereas someone with another MCU doesn't have the feature by default but needs to enable it by building and passing flags like As such there's not a single go-to place in the docs or so where one can find out if a feature is supported. |
Beta Was this translation helpful? Give feedback.
-
Hello. To clarify a little bit what we trying to achieve with reactivity, and what our current main challenge is: We have taken some CPython proxying code and use it to wrap the "watched" data structure in order to detect all mutations, which then trigger UI changes. We have been able to work around the getattr differences. It would be nice if we could also enable Clarifications for any misunderstanding on my part or hints on how to work around this difference would be much appreciated. Even better, of course, if |
Beta Was this translation helpful? Give feedback.
-
In case this helps, PySheets (which uses PyScript with MicroPython for the UI) uses a Model-View architecture for the cells in a spreadsheet. I override setattr to inform listeners that something changed in the model. This works fine on "standard" PyScript releases for me. See https://github.com/PySheets/pysheets/blob/main/src/static/models.py#L184 |
Beta Was this translation helpful? Give feedback.
-
Some people are trying to implement deep reactivity in pyscript. This is so we can have a reactive UI layer in the browser (similar to say Vue3). They want the pyodide and micropython interpreters to work the same for obvious reasons. The pyodide side is working but the micropython side is having some problems.
The discussion on achieving this is happening primarily in this thread:
There seems to be some confusion about what is supported with conflicting references and support for/about such things as:
__get_attribute__
,__setitem__
,__setattr__
There is functioning code (interactive, clonable) here:
E.g. @ntoll has said:
"MicroPython does support those dunder methods (I've used them). Not sure what's going on. Perhaps ping MP folk with an example of the problem..?"
So I am posting here in the hopes someone can join our discussion and resolve our problem.
Cheers...
Beta Was this translation helpful? Give feedback.
All reactions