Persistent watch expressions (continuation of #150)
UPDATE
There was a problem with determinism in the watch pane, caused by there being two containers for WatchExpressions: FrameVarInfo.watches (watches specific to one stack frame), and the file (~/.config/pudb/saved-watches-*) maintained by save_watches() -a list of global watches. This combination would occasionally cause all watches to be deleted from the file, because the prior rev sometimes read the watches from the FrameVarInfo.watches which almost never contained the same set of expressions as the file.
This behavior prompted me to consolidate all WatchExpression related code into one class (Watches in var_view.py) to provide a central manager of Watches, rather that behavior being dispersed to various points in the UI code. Easier to maintain, and control the behavior regardless of what code is invoking it.
Summary
Persistence of watch expressions. This pull incorporates and continues with #150's fine work. Mentioned in discussion #660 - Plugins (and persistent Watch expressions)
Details
- merged lechat:save_load_watches into inducer:main, and it works almost perfectly
- ~~one tiny mod to var_view.py: to import pudb.debugger.CONFIG into local scope, to fix bug discovered after the merge~~
- ~~another tiny mod to debugger.py: call save_watches() after a watch expression is deleted by the user, making that item become de-persisted from disk. This fixes an issue where the delete key tends to do nothing in the variables Watch expression subpane, following merge of lechat:save_load_watches into inducer:main~~
- ~~the issue occurs because load_watches() is called every time make_var_view() is invoked by update_var_view(), which itself is invoked frequently -whenever the UI needs redrawing. So, the removal of an expression by the delete key lasts for only approximately two shakes of a lamb's tail~~
- consolidated previous watch expression code from DebuggerUI, and save_watches & load_watches, into class Watches, centralizing pretty much all watches behavior into one API. Simplifies watch code, eliminated redundancies, cures the non-deterministic behavior caused by attaching WatcheExpressions to stack frames, making it easier to maintain
- added tests for new code
- changed config option "persist_watches" to default to True, because why not
Tests
- added WatchExpressionTests and WatchesTests to pudb/test/test_var_view.py, to cover new watch expression code
- I would like to add tests for pudb that exercise it through urwid's interfaces, so that the watches pane can be tested from top-to-bottom; I am learning how to do this and will likely submit it in a future pull
Given that the checks have been in an "expected - waiting" state for two weeks, It seems like the CI is hung.
No, sorry, that was me. I needed to click "Approve".
(But I've been a bit preoccupied with the whole thing being quite broken on 3.13: #664)
@inducer I have fixed the ruff and pylint issues within my PR branch, ready for another go
What can I do to help move this to acceptance, @inducer ? I think the workflow needs approval, for one