Skip to content

Exclude custom variables from variable explorer #16398

@battaglia01

Description

@battaglia01

Issue Report Checklist

  • [:)] Searched the issues page for similar reports
  • [:)] Read the relevant sections of the Spyder Troubleshooting Guide and followed its advice
  • [:)] Reproduced the issue after updating with conda update spyder (or pip, if not using Anaconda)
  • [:)] Could not reproduce inside jupyter qtconsole (if console-related)
  • [:)] Tried basic troubleshooting (if a bug/error)
    • [:)] Restarted Spyder
    • [:)] Reset preferences with spyder --reset
    • [:)] Reinstalled the latest version of Anaconda
    • [:)] Tried the other applicable steps from the Troubleshooting Guide
  • [:)] Completed the Problem Description, Steps to Reproduce and Version sections below

Problem Description

Sometimes one ends up with variables in the variable explorer that are not really relevant to the current session. The current settings make it easy to hide these in some cases: for instance, if the variables are in all uppercase, or if they're private, or callable. But there always seem to be a few which are left over, for which there is no useful way to get rid of them.

Rather than go into every possible category of thing we may want to hide, could we add the ability to just hide some user-created list of custom variables? I don't even care about GUI integration; something as simple as a global variable called __hide_var_in_spyder__ would be great, as long as Spyder adjusts the variable explorer every time this is updated. This would be a simple list of variables which Spyder knows to hide from the variable explorer. One step better would be if this can take default values as well, and only put it in the variable explorer if the current value is different from the hidden default value.

This is a silly example, but just to show how the behavior should work: suppose you have a global variable called myvar which is set to the int 123. So you set

__hide_var_in_spyder__ = [{"name": "myvar", "value": 123}]

where "myvar" is a string representing the name and 123 is the actual value (e.g. not a string). Now this is hidden in the variable explorer. On the other hand, if I then type myvar = 1234567890, it then shows in the explorer, because it doesn't match the value.

Is something like this already possible to do somehow, or if not, could this be easily added? I'd be willing to devote some time to implementing this if so.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions