Spyder: %loadfav

Created on 28 Oct 2020  路  4Comments  路  Source: spyder-ide/spyder

Tired of redefining functions in debugger, or hoping they can still be found in history? %loadfav - executes script to load definitions, imports, or whatever. Script path set in Preferences.

Maybe it's already a thing, or it's hard to implement, but it'd indeed be a major QOL - bonus if we can specify which script to run, e.g. %loadfav(2).

Discussion Feature

Most helpful comment

There is an option to run a line for pdb. you can use ';' to separate line. I use:
import matplotlib.pyplot as plt; from matplotlib.pyplot import plot, imshow
If you always use the same definitions, I would:

  • create a package with all the definition you want
  • install it
  • run from my_pdb_package_1 import * / add from my_pdb_package_1 import * in the pdb preferences

All 4 comments

Hi @OverLordGoldDragon , if I understand correctly, your idea is to add a custom magic that enables users to run some sort of bookmarked file (which could contain some sort of code snippet with imports or definitions - constants, functions, variables, etc), right?

What do you think @spyder-ide/core-developers ?

@dalthviz Correct.

There is an option to run a line for pdb. you can use ';' to separate line. I use:
import matplotlib.pyplot as plt; from matplotlib.pyplot import plot, imshow
If you always use the same definitions, I would:

  • create a package with all the definition you want
  • install it
  • run from my_pdb_package_1 import * / add from my_pdb_package_1 import * in the pdb preferences

@impact27 ... why of course, _imports_.

Was this page helpful?
0 / 5 - 0 ratings