spyder icon indicating copy to clipboard operation
spyder copied to clipboard

Add ability to refresh/update existing Variable Explorer windows to reflect current variable state

Open Murmele opened this issue 8 years ago • 10 comments

Hello, when you click on a variable in the variable explorer you get a new window from the variable and it's content (see pic1.png). At the moment these small windows will not be updated when the variable changes. In some cases it is really usefull to compare values, but sometimes it would be nice when the windows will be updated. For this i propose if there is a checkbox which is by default unchecked, but when you check the checkbox, the content of the window will be updated. Is something like that possible to make?

pic1

pic2

Murmele avatar Jan 29 '18 12:01 Murmele

Thanks for the suggestion. We'll try to implement this in a future release.

ccordoba12 avatar Jan 29 '18 12:01 ccordoba12

Thank you!

Murmele avatar Jan 29 '18 17:01 Murmele

Agreed, this would definitely be a very useful feature and something I've thought about as well, though would take at least some backend work to implement. Also, from a UI perspective, It would probably be easiest and most straightforward to stick the button bottom left.

CAM-Gerlach avatar Jan 30 '18 00:01 CAM-Gerlach

Absolutely loved this in the old Linux build I used

Heuristicmystic avatar Aug 14 '18 15:08 Heuristicmystic

Adding my support for this feature to be added in the future! Thanks

Btw a huge thanks to the entire team that updates and maintains Spyder!

rpinto73 avatar May 26 '21 15:05 rpinto73

Thanks for your kind words @rpinto73!

ccordoba12 avatar May 26 '21 15:05 ccordoba12

Yes!! This would be super useful

a4bears avatar Jul 22 '21 11:07 a4bears

Would love to see this.

wwhoward avatar Jul 25 '21 18:07 wwhoward

Still doesn't exist, right? That would be quite useful for me.

ajauskas avatar Nov 22 '21 11:11 ajauskas

Will add my upvote. Adding this functionality would be great. Thank you for maintaining Spyder.

BerezhnoyD avatar Jul 22 '22 16:07 BerezhnoyD

Will add my upvote too for such a feature. Coming from a Stata background, autorefreshing is key for understanding the data. Given the comment of a user here, users switch to other programs like Sublime due to such an issue. Perhaps implementation could start with smaller dataframes, if a concern is the processing power an autorefresh function would use up?

EdSaiedi avatar Oct 13 '22 14:10 EdSaiedi

This would be incredibly helpful

anton2qr4q avatar Oct 27 '22 11:10 anton2qr4q

Will add my upvote too for such a feature. Coming from a Stata background, autorefreshing is key for understanding the data. Given the comment of a user here, users switch to other programs like Sublime due to such an issue. Perhaps implementation could start with smaller dataframes, if a concern is the processing power an autorefresh function would use up?

@EdSaiedi I don't think Sublime can do it, think he is just saying he will stick with Sublime and print to console.

Have you had any luck finding an alternative? Thanks

anton2qr4q avatar Oct 27 '22 11:10 anton2qr4q

I would also like the global setting for all these windows. Most of the time I would like them to be autorefreshed but sometimes I need to compare values for different runs.

Artyom-K avatar Nov 17 '22 11:11 Artyom-K

Unfortunately, we can't make this work automatically because it'd consume a lot of memory. Every operation that shows a variable in one of our specialized viewers involves making a copy of it. That copy is cleared once users close the viewer.

But if viewers are maintained opened and they're being updated after every code execution, the memory consumed by Spyder can skyrocket quite quickly, especially for large variables.

So, I think the best we can do is to add a refresh button to our viewers, so users can update them on demand. We'll try to do that in the future.

ccordoba12 avatar Mar 16 '23 17:03 ccordoba12

Understood Carlos, the refresh button would be a fantastic addition, thank you

anton2qr4q avatar Mar 16 '23 17:03 anton2qr4q

This would be a very useful feature, i.e. allowing only one open view per variable and updating that variable as code gets executed rather than pressing refresh.

bajhuman avatar Mar 21 '23 15:03 bajhuman

@bajhuman, please read my previous comment: that can't be done because it'll increase the memory consumed by Spyder without limit.

ccordoba12 avatar Mar 21 '23 16:03 ccordoba12

I made a prototype in order to get an idea of what is involved. In the video, I define an array arr, open an array editor, give the command arr = numpy.flipud(arr) (which flips the array upside down) and then refresh the array editor.

https://github.com/spyder-ide/spyder/assets/7941918/6076c735-01c2-4234-bd61-77320719deaa

Feel free to comment on the UI/UX. Note that the command arr = numpy.flipud(arr) does not mutate the array but it assigns the variable to a new array. I think that users will expect the array editor to show the new array, but let me know if you disagree.

My code does work, but it is easy to break (this is a MVP for a very low value of V). This is going to be more work than I had thought. These situations are currently not handled (and probably more):

  • collection, object or dataframe editors
  • arrays nested in other objects
  • changing the type of the variable or deleting it
  • changing a normal array to a record, masked, or 3d or vice versa
  • changing the number of rows or columns
  • changing the maximum or minimum value in the array
  • editing the array in the editor and then refreshing it

jitseniesen avatar Aug 31 '23 14:08 jitseniesen