-
Notifications
You must be signed in to change notification settings - Fork 382
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
ReadOnlyDict/List pickle compatibility and serialization tests #737
ReadOnlyDict/List pickle compatibility and serialization tests #737
Conversation
CI is outputting |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
And an item open for discussion that I already mentioned in #770: Should we make the pickled type a read-only container or |
The configuration for checks on OSX was updated on the master branch. They should pass after you merge the master into your PR. |
As far as I know, are the read only types introduced to prevent accidental modifications of the config
should work, because it is obvious that the user took care to not change the global config. |
Yes, that's right. The question is if we want to allow config = pickle.loads(pickle.dumps(config))
config[...] = ... In most cases that I can imagine, we want to lose the read-only properties when pickling (e.g., when saving to disk), but in some scenarios (e.g., multiprocessing, ray-tune) it might be safer to keep the read-only status. |
Having ReadOnlyDict pickled as As @thequilo alluded to in this comment, I think it's better to have the user make a copy first to |
@shwang Thank you! |
Makes ReadOnly{Dict,List} picklable. Also adds tests for pickle, json serialization.
The main changes to the read-only custom types were adding a
__reduce__
method and simplifying the various__init__
calls a bit by using using explicitclass.__init__
calls rather thansuper().__init__
(h/t @Qwlouse #508 (comment) ).Closes #499. Closes #738.