warn when notebook is started in pylab mode

because it is always a bad idea
This commit is contained in:
MinRK 2014-01-12 11:02:52 -08:00
parent 736172febe
commit db4c814812

View File

@ -499,7 +499,7 @@ class NotebookApp(BaseIPythonApplication):
trust_xheaders = Bool(False, config=True,
help=("Whether to trust or not X-Scheme/X-Forwarded-Proto and X-Real-Ip/X-Forwarded-For headers"
"sent by the upstream reverse proxy. Neccesary if the proxy handles SSL")
"sent by the upstream reverse proxy. Necessary if the proxy handles SSL")
)
def parse_command_line(self, argv=None):
@ -521,6 +521,13 @@ class NotebookApp(BaseIPythonApplication):
"""construct the kernel arguments"""
# Scrub frontend-specific flags
self.kernel_argv = swallow_argv(self.argv, notebook_aliases, notebook_flags)
if any(arg.startswith(u'--pylab') for arg in self.kernel_argv):
self.log.warn('\n '.join([
"Starting all kernels in pylab mode is not recommended.",
"Please use the %matplotlib magic to enable matplotlib instead.",
"pylab implies many imports, which can have confusing side effects",
"and harm the reproducibility of your notebooks.",
]))
# Kernel should inherit default config file from frontend
self.kernel_argv.append("--IPKernelApp.parent_appname='%s'" % self.name)
# Kernel should get *absolute* path to profile directory