Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Load %autoreload magic at kernel startup #5987

Merged
merged 1 commit into from
Dec 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion spyder/utils/ipython/spyder_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ def _eval(self, text):
except:
return None, False

# --- Others
# --- For Matplotlib
def _set_mpl_backend(self, backend, pylab=False):
"""
Set a backend for Matplotlib.
Expand Down Expand Up @@ -522,3 +522,9 @@ def _show_mpl_backend_errors(self):
if self._mpl_backend_error is not None:
print(self._mpl_backend_error) # spyder: test-skip

# --- Others
def _load_autoreload_magic(self):
"""Load %autoreload magic."""
from IPython.core.getipython import get_ipython
get_ipython().run_line_magic('reload_ext', 'autoreload')
get_ipython().run_line_magic('autoreload', '2')
4 changes: 4 additions & 0 deletions spyder/utils/ipython/start_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ def kernel_config():
clear_argv = "import sys;sys.argv = [''];del sys"
spy_cfg.IPKernelApp.exec_lines.append(clear_argv)

# Load %autoreload magic
spy_cfg.IPKernelApp.exec_lines.append(
"get_ipython().kernel._load_autoreload_magic()")

# Default inline backend configuration
# This is useful to have when people doesn't
# use our config system to configure the
Expand Down