enthought / envisage

Envisage is a Python-based framework for building applications whose functionalities can be extended by adding "plug-ins".
http://docs.enthought.com/envisage/
Other
82 stars 26 forks source link

Refresh layout pickles #472

Closed mdickinson closed 2 years ago

mdickinson commented 2 years ago

This PR refreshes the two layout pickle files, by simply reading and then writing them again with Traits 6.3.2. This has the effect of changing the module used for importing TraitListObject from traits.trait_handlers to traits.trait_list_object.

Should fix #471.

For the record, here's the transcript of the session used to re-create the pickles:

Pickle re-recreation ```python mdickinson@mirzakhani data % python Enthought Deployment Manager -- https://www.enthought.com Python 3.6.13 |Enthought, Inc. (x86_64)| (default, Apr 13 2021, 19:22:11) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import traits >>> traits.__version__ '6.3.2' >>> import os >>> os.listdir(".") ['application_memento_v3.pkl', 'application_memento_v2.pkl'] >>> pkls = os.listdir(".") >>> import pathlib, pickle >>> p = pathlib.Path(pkls[0]) >>> p.read_bytes() b'\x80\x03cenvisage.ui.tasks.tasks_application\nTasksApplicationState\nq\x00)\x81q\x01}q\x02(X\x17\x00\x00\x00previous_window_layoutsq\x03ctraits.trait_handlers\nTraitListObject\nq\x04)\x81q\x05cpyface.tasks.task_window_layout\nTaskWindowLayout\nq\x06)\x81q\x07}q\x08(X\x0b\x00\x00\x00active_taskq\tX\x00\x00\x00\x00q\nX\x05\x00\x00\x00itemsq\x0bh\x04)\x81q\x0c}q\r(X\x04\x00\x00\x00nameq\x0eh\x0bX\n\x00\x00\x00name_itemsq\x0fX\x0b\x00\x00\x00items_itemsq\x10ubX\x08\x00\x00\x00positionq\x11J\xff\xff\xff\xffJ\xff\xff\xff\xff\x86q\x12X\x04\x00\x00\x00sizeq\x13M\xec\x01M\xe7\x02\x86q\x14X\n\x00\x00\x00size_stateq\x15X\x06\x00\x00\x00normalq\x16X\x12\x00\x00\x00__traits_version__q\x17X\x05\x00\x00\x005.1.2q\x18uba}q\x19(h\x0eh\x03h\x0fX\x1d\x00\x00\x00previous_window_layouts_itemsq\x1aubX\x0e\x00\x00\x00window_layoutsq\x1bh\x04)\x81q\x1c}q\x1d(h\x0eh\x1bh\x0fX\x14\x00\x00\x00window_layouts_itemsq\x1eubX\x07\x00\x00\x00versionq\x1fK\x01h\x17h\x18ub.' >>> pickle.loads(p.read_bytes()) >>> pickle.dumps(pickle.loads(p.read_bytes())) b'\x80\x03cenvisage.ui.tasks.tasks_application\nTasksApplicationState\nq\x00)\x81q\x01}q\x02(X\x17\x00\x00\x00previous_window_layoutsq\x03ctraits.trait_list_object\nTraitListObject\nq\x04)\x81q\x05cpyface.tasks.task_window_layout\nTaskWindowLayout\nq\x06)\x81q\x07}q\x08(X\x0b\x00\x00\x00active_taskq\tX\x00\x00\x00\x00q\nX\x05\x00\x00\x00itemsq\x0bh\x04)\x81q\x0c}q\r(X\x0e\x00\x00\x00item_validatorq\x0ecbuiltins\ngetattr\nq\x0fh\x0cX\x0f\x00\x00\x00_item_validatorq\x10\x86q\x11Rq\x12X\x04\x00\x00\x00nameq\x13h\x0bX\n\x00\x00\x00name_itemsq\x14X\x0b\x00\x00\x00items_itemsq\x15ubX\x08\x00\x00\x00positionq\x16J\xff\xff\xff\xffJ\xff\xff\xff\xff\x86q\x17X\x04\x00\x00\x00sizeq\x18M\xec\x01M\xe7\x02\x86q\x19X\n\x00\x00\x00size_stateq\x1aX\x06\x00\x00\x00normalq\x1bX\x12\x00\x00\x00__traits_version__q\x1cX\x05\x00\x00\x006.3.2q\x1duba}q\x1e(h\x0eh\x0fh\x05h\x10\x86q\x1fRq h\x13h\x03h\x14X\x1d\x00\x00\x00previous_window_layouts_itemsq!ubX\x0e\x00\x00\x00window_layoutsq"h\x04)\x81q#}q$(h\x0eh\x0fh#h\x10\x86q%Rq&h\x13h"h\x14X\x14\x00\x00\x00window_layouts_itemsq\'ubX\x07\x00\x00\x00versionq(K\x01h\x1ch\x1dub.' >>> p.write_bytes(pickle.dumps(pickle.loads(p.read_bytes()))) 660 >>> p = pathlib.Path(pkls[1]) >>> p.read_bytes() b'\x80\x02cenvisage.ui.tasks.tasks_application\nTasksApplicationState\nq\x00)\x81q\x01}q\x02(X\x17\x00\x00\x00previous_window_layoutsq\x03ctraits.trait_handlers\nTraitListObject\nq\x04)\x81q\x05cpyface.tasks.task_window_layout\nTaskWindowLayout\nq\x06)\x81q\x07}q\x08(X\x0b\x00\x00\x00active_taskq\tX\x00\x00\x00\x00q\nX\x05\x00\x00\x00itemsq\x0bh\x04)\x81q\x0c}q\r(X\x04\x00\x00\x00nameq\x0eh\x0bX\n\x00\x00\x00name_itemsq\x0fX\x0b\x00\x00\x00items_itemsq\x10ubX\x08\x00\x00\x00positionq\x11J\xff\xff\xff\xffJ\xff\xff\xff\xff\x86q\x12X\x04\x00\x00\x00sizeq\x13M\xec\x01M\xe7\x02\x86q\x14X\n\x00\x00\x00size_stateq\x15X\x06\x00\x00\x00normalq\x16X\x12\x00\x00\x00__traits_version__q\x17X\x05\x00\x00\x005.1.2q\x18uba}q\x19(h\x0eh\x03h\x0fX\x1d\x00\x00\x00previous_window_layouts_itemsq\x1aubX\x0e\x00\x00\x00window_layoutsq\x1bh\x04)\x81q\x1c}q\x1d(h\x0eh\x1bh\x0fX\x14\x00\x00\x00window_layouts_itemsq\x1eubX\x07\x00\x00\x00versionq\x1fK\x01h\x17h\x18ub.' >>> p.write_bytes(pickle.dumps(pickle.loads(p.read_bytes()), protocol=2)) 663 >>> p.read_bytes() b'\x80\x02cenvisage.ui.tasks.tasks_application\nTasksApplicationState\nq\x00)\x81q\x01}q\x02(X\x17\x00\x00\x00previous_window_layoutsq\x03ctraits.trait_list_object\nTraitListObject\nq\x04)\x81q\x05cpyface.tasks.task_window_layout\nTaskWindowLayout\nq\x06)\x81q\x07}q\x08(X\x0b\x00\x00\x00active_taskq\tX\x00\x00\x00\x00q\nX\x05\x00\x00\x00itemsq\x0bh\x04)\x81q\x0c}q\r(X\x0e\x00\x00\x00item_validatorq\x0ec__builtin__\ngetattr\nq\x0fh\x0cX\x0f\x00\x00\x00_item_validatorq\x10\x86q\x11Rq\x12X\x04\x00\x00\x00nameq\x13h\x0bX\n\x00\x00\x00name_itemsq\x14X\x0b\x00\x00\x00items_itemsq\x15ubX\x08\x00\x00\x00positionq\x16J\xff\xff\xff\xffJ\xff\xff\xff\xff\x86q\x17X\x04\x00\x00\x00sizeq\x18M\xec\x01M\xe7\x02\x86q\x19X\n\x00\x00\x00size_stateq\x1aX\x06\x00\x00\x00normalq\x1bX\x12\x00\x00\x00__traits_version__q\x1cX\x05\x00\x00\x006.3.2q\x1duba}q\x1e(h\x0eh\x0fh\x05h\x10\x86q\x1fRq h\x13h\x03h\x14X\x1d\x00\x00\x00previous_window_layouts_itemsq!ubX\x0e\x00\x00\x00window_layoutsq"h\x04)\x81q#}q$(h\x0eh\x0fh#h\x10\x86q%Rq&h\x13h"h\x14X\x14\x00\x00\x00window_layouts_itemsq\'ubX\x07\x00\x00\x00versionq(K\x01h\x1ch\x1dub.' ```
mdickinson commented 2 years ago

Thanks, @rahulporuri. I've sneakily added to this PR after you approved it, adding (a) a script that regenerates the pickles (on my machine, the generated pickled are byte-for-byte identical with the existing .pkl files), and (b) a README.md for this directory.

Will merge when CI approves, and then retry the cron job.