Any reason for pickle over dill for caching?

Hi, is there any reason to prefer pickle over dill when caching using the dash_extensions functionalities? I’m using ServersideOutputs in my project and I needed to cache some lambda objects. The app stoped because in the dash_extensions the caching is done with pickle, which is not able to handle lamba objects.

A quick fix is to import dill as pickle in filesystemcache.py, and doing so the app works perfectly now.
Of course the proper way to fix it would be to import dill and substitute all the pickle.dumps and pickle.loads with dill.dumps and dill.loads, but this does the tricks in my case.

It has to be said that using dill fixes my specific needs and I don’t know if I’m actually losing some other functionalities in return. Hence my question.

I don’t think so. I didn’t face any issues with pickle for my use cases, so I didn’t look at dill at the time. But I don’t see any issues switching to dill; as I read, it is even backwards compatible with pickle. You can make a PR if you like, or create a bug (then I’ll probably get around to it some time).

Sounds good! Thanks a lot for replying and thanks for the great work!

1 Like