Workaround for pydeck magic/array handling #97
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
By default Pydeck does special handling for prop inputs. This means that pydeck 0.4.0 can't pass an array of strings to the JS layer without them being considered a function.
This is a workaround "hack" that binds selected layer properties directly to the
Layer
instance instead of passing those properties askwargs
(keyword arguments) to thepydeck.Layer
constructor. This bypasses Pydeck's magic handling of prop inputs.It works because when Pydeck serializes the layer, it calls
vars(layer)
, which assembles the layer's attributes in a dict.Ref visgl/deck.gl#4897