New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Supporting streams dictionaries in operations #4818
Conversation
bea71f7
to
1a9286c
Compare
One possible solution to the The logic is that 1) this mechanism is primarily about linked streams, you may as well use parameters directly for the old non-linked case 2) linked streams have to be tied to the plotting backend which means they are unlikely to be user defined (and if they are, users would just need to know that they shouldn't rely on parameter inheritance) and 3) we can do something like the following to enforce that all the streams we provide are defined according to the rule: objs = [getattr(hv.streams, el) for el in dir(hv.streams)]
stream_classes = [obj for obj in objs if isinstance(obj, type) and issubclass(obj, hv.streams.Stream) ]
for stream_class in stream_classes:
for name, p in stream_class.param.params().items():
if name != 'name':
if p.owner != stream_class:
raise AssertionError('Parameter %s has owner %s when accessed from class %s'
% (name, p.owner, stream_class)) Edit: Or better, I can use |
Sounds good. Seems like only linked streams need testing like that at this time. |
@philippjfr I've pushed the changes we discussed in e71782f. Please do push better fixes to how the |
Co-authored-by: Philipp Rudiger <prudiger@anaconda.com>
Also happy with this now, just needs a few unit tests. |
Added some unit tests which are now passing. @philippjfr happy to merge? |
@philippjfr Addressed your latest suggestions and the tests are green again. Merge? |
WIP PR to address #4807.
For testing, I've defined the
streams
parameter ofinspect_points
as:And here is the corresponding, working test example:
However, there are some serious limitations right now. The minor one is that I have to set
hv.streams.PointerXY.x = 0
andhv.streams.PointerXY.y = 0
due to an error processing dictionaries when allowing theNone
default. While I'm sure this can be fixed, this seems to be a far more fundamental problem right now:As operations use stream classes, not instances, how can I get back to the correct class with something like
Tap.param.x
when the owner of the parameter may be a superclass? The code needs to instantiate the correct stream instance. Any ideas @jbednar @philippjfr ?If this can be solved quickly then I can work on this PR to get it into the next minor release. However, if this is a deeper issue (as I suspect it is) then this PR will need to wait for updates in param at the very least. Assuming this has a quick solution, the next steps would be:
None
.Apply
and/orDynamic
.