Full support of the style system using DynamicMaps #368
This PR fixes a major issue with
The approach used here seems to work well but there are things I am not entirely happy with:
Hopefully, I can address these issue but I think this PR is very important for the 1.4.1 release. Styling
Just a thought regarding the excess custom ids.... maybe the custom id/tree could be removed when popped from the cache? Then again, someone could still have a handle on an element that is no longer on the cache.
Python does offer the ability to know how many references there are to an object:
import sys sys.getrefcount(object) #-- Returns the reference count of the object.
Maybe we could use this to implement a system to garbage collect the custom trees...
I'm just brainstorming here but there is another approach to clean-up the custom trees. This is probably very over-engineered but I'm just trying to come up with ideas!
This would solve the duplicate option trees but there is no reason the list of integer ids wouldn't be able to grow without limit. This could only be solved by sweeping the namespace for all HoloViews objects, and checking with ids actually are being used (then cleaning up the trees associated with the ones no longer in use).
Technically possible (using
Edit 1: This suggestion is really equivalent to storing the 'inverted' dictionary where the trees are keys (assuming they are hashable, which I think they are) with lists of ids as values which you keep updated. Then it is all about doing the lookup from id to tree...
Edit 2: Not quite. Even if a tree is hashable, the hash doesn't really map to its 'value'. You would want each tree to have a unique hash (so you can use them as dictionary keys without restriction) but then you would need to enforce 'uniqueness' of the keys explicitly (making sure the values of all the trees are unique).