Suggestion: keyboard shortcut to reload a module

510 views
Skip to first unread message

Roland Lohner

unread,
Jul 27, 2011, 5:27:48 AM7/27/11
to spyder
Dear Developers,

I (and guess many developers) use Spyder in the following way:
I edit the module in the code editor, save the changes, than reload
the module in Python or Ipython console and call the modified function
in the console.

It would be nice to have a keyboard shortcut in code editor which
allows reloading of the module in the console. So hundreds of 'reload
(module)' commands could be saved in the console every day.

Thanks in advance and thanks for Spyder.
R.

Carlos Córdoba

unread,
Jul 27, 2011, 10:55:29 AM7/27/11
to spyd...@googlegroups.com
Hi Roland,

I don't think adding a shortcut to reload would be much of a problem.
Please open an issue in our issue tracker so can follow your petition
from there:

http://code.google.com/p/spyderlib/issues/list

Also, it would be great if you can come up with a patch for this. We are
quite short in developer resources right now but we can guide you to
accomplish this task more easily.

Cheers,
Carlos

El 27/07/11 04:27, Roland Lohner escribió:

Pierre Raybaut

unread,
Aug 6, 2011, 8:40:57 AM8/6/11
to spyd...@googlegroups.com
Hi Roland,

Spyder has an exclusive feature that might fit your needs. It is
called UMD, for User Module Deleter. It works in both Python and
IPython interpreters.

The idea is to run your script inside an existing console (an already
running Python or IPython interpreter), do your things (computing,
debugging... your working stuff). Then you may want modify your script
or one of the modules that your script is importing, and re-run your
script. UMD will reload completely the changes that you made to your
files (and default behavior is to notify the user by a warning message
that some modules were actually reloaded).

In other words, you don't need to reload anything manually. UMD will
do it for you.
I'm using this method very often, even with complex GUI-based
applications: it allows to debug faster because the GUI modules (Qt)
are imported only once.

I really think that this is one of the more efficient way to interact
with Python code, from the simplest script to the most complex
application.

HTH,
Pierre

PS: being in vacation right now, I'm sending this email from my phone,
so please forgive any weirdness that may be related to it.

> --
> You received this message because you are subscribed to the Google Groups "spyder" group.
> To post to this group, send email to spyd...@googlegroups.com.
> To unsubscribe from this group, send email to spyderlib+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/spyderlib?hl=en.
>

Roland Lohner

unread,
Aug 22, 2011, 6:43:26 AM8/22/11
to spyder
Hi Pierre,

Thanx for your point.
You are right, UMD really satisfies my claim.
I can create a blank script file, and use it to run commands instead
of running in console, so changed modules are reloaded.

However an 'import/reload module in console' function might be nice
for folks, who use console as REPL.

Regards, Roland

PS: Sorry for my late answer, I was on vacation, also.
Reply all
Reply to author
Forward
0 new messages