Is your feature request related to a problem? Please describe.
I recently came across this library and really liked the rx() example shown in README.md. I do not like having to invoke e.g. val1.rx.value to query and set the value of this node. I thought perhaps an (optional extra) context manager could be used to help separate defining each node / graph to reduce the amount of boilerplate needed when these values would be used.
Describe the solution you'd like
Here is an example showing what I am talking about here (naming TBD, not adapted to the existing param ecosystem).
from param import rx
from xxx import BuildParameters
with BuildParameters() as p:
p.r = rx(1.5)
# Inside the block, p.r is the rx node, so this creates a reactive link
p.diameter = p.r * 2
# --- OUTSIDE THE BLOCK ---
# We can update it purely (without .rx.value)
p.r = 2.0
# The graph updated silently, and we can read the pure result
print(f"New Diameter: {p.diameter}")
# Output: New Diameter: 4.0
Additional context
I have a working implementation of this, not sharing yet as I wanted to gauge interest in the overall idea first.
Is your feature request related to a problem? Please describe.
I recently came across this library and really liked the
rx()example shown in README.md. I do not like having to invoke e.g.val1.rx.valueto query and set the value of this node. I thought perhaps an (optional extra) context manager could be used to help separate defining each node / graph to reduce the amount of boilerplate needed when these values would be used.Describe the solution you'd like
Here is an example showing what I am talking about here (naming TBD, not adapted to the existing
paramecosystem).Additional context
I have a working implementation of this, not sharing yet as I wanted to gauge interest in the overall idea first.