[IPython-dev] question about command line options

Kyle Rawlins rawlins at gmail.com
Wed Mar 18 18:10:30 EDT 2015


On Mar 13, 2015, at 1:00 PM, ipython-dev-request at scipy.org wrote:
> Date: Thu, 12 Mar 2015 15:51:30 -0700
> From: Thomas Kluyver <takowl at gmail.com>
> Subject: Re: [IPython-dev] question about command line options
> To: IPython developers list <ipython-dev at scipy.org>
> Message-ID:
> 	<CAOvn4qjXoCWfn+SURkCM2cMiK1BFVcfNazxyZ8cXoN8iBpzJpw at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
> 
> On 12 March 2015 at 14:35, Kyle Rawlins <rawlins at gmail.com> wrote:
> 
>> Also, perhaps if this is the answer, you should consider not letting it
>> ever work.  Right now setting IPKernelApp.exec_lines via command line
>> mostly does do something, so the command line is still getting to
>> IPKernelApp somehow, and it fails only in these complicated circumstances
>> apparently relating to the automatic insertion of quotes.  I think
>> sometimes it is pretty hard for those of us who haven't been steeped in the
>> internals to understand exactly what can and should be configured when and
>> how, because configuration is so flexible in IPython...
> 
> 
> The only thing to remember is that the notebook config (command line
> options and the ipython_notebook_config.py file) don't affect kernels.

Just to double check, part of what was throwing me is that the following _does_ cause something to be printed in IPython 3:
	ipython notebook --'IPKernelApp.exec_lines=[print(23)]’
Not sure why this would work given this discussion, and it doesn’t get printed exactly when I’d expect (but that is also true for IPython 2, where the effects of this trait set via the command line or an initial config on the app do percolate down to kernels).

> You
> can workaround this by creating a kernelspec with extra command line
> arguments for the kernel, but there isn't a way to do it purely at the
> command line.

Thanks, this was the hint that I needed.  The command line issue was just a distillation of how I was starting a very lightly branded version of the notebook app via a script in IPython 2 (based originally on a recipe from several versions ago).  I ended up dynamically generating a kernel spec and installing it on the fly using the kernel spec API — as overkill(/crazy) as this might seem, it is fairly easy to do this and it seems to work well for my purposes.
-kyle

-- 
Kyle Rawlins
http://sites.krieger.jhu.edu/rawlins/
Department of Cognitive Science
Johns Hopkins University




More information about the IPython-dev mailing list