holoviz / holoviews

With Holoviews, your data visualizes itself.
https://holoviews.org
BSD 3-Clause "New" or "Revised" License
2.69k stars 402 forks source link

Fix pickling state #6245

Closed ahuang11 closed 3 months ago

ahuang11 commented 4 months ago

Closes https://github.com/holoviz/holoviews/issues/6244

Not sure why it previously sets to an empty dict, but this makes pickling restore to its original state.

import pickle
import holoviews as hv
hv.extension("bokeh")

curve = hv.Curve([0, 1, 2], kdims=["XAXIS"])
pickle.loads(pickle.dumps(curve))
image

First introduced: https://github.com/holoviz/holoviews/blame/849cd07779be75ff4e4366b3f3f13252afaa43d1/holoviews/core/dimension.py#L764

Prior to that (10 years ago xD): https://github.com/holoviz/holoviews/blame/7c73cefe76c55d10323edcfcd14874cfdbcfc7a9/holoviews/core/dimension.py#L906

I think it might have been an oversight since AttrTree uses d https://github.com/holoviz/holoviews/blob/main/holoviews/core/dimension.py#L1353

codecov[bot] commented 4 months ago

Codecov Report

Attention: Patch coverage is 92.30769% with 2 lines in your changes missing coverage. Please review.

Project coverage is 88.53%. Comparing base (dd0e4d5) to head (f47ffea). Report is 1 commits behind head on main.

Files Patch % Lines
holoviews/core/dimension.py 88.88% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #6245 +/- ## ======================================= Coverage 88.53% 88.53% ======================================= Files 323 323 Lines 67797 67797 ======================================= + Hits 60021 60024 +3 + Misses 7776 7773 -3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.