[IPython-dev] disabling history

Jason Grout jason-sage at creativetrax.com
Fri Jul 20 23:45:39 EDT 2012


In our Sage Cell server [1], we'd like to disable the IPython history 
(since it arguably doesn't make much sense there anyway; only a single 
cell is executing, after all, so we don't want the extra disk writes or 
time it takes to deal with a history).  However, we need commands 
executed with silent=False because we need to see output, etc.

I can see several ways of doing this (below).  Can I get some comments 
about which way is the most IPythonic?

1. applying a small patch which decouples the silent and store_history 
attributes [2], and then in every kernel execute message set 
store_history to False and silent to False.  I don't like this because 
it leaves the history storing in the (potentially untrusted) user's 
hands, and it takes up bandwidth where it really should be a server-wide 
configuration.

2. Set the history file to ':memory:', like in 
parallel/engine/engine.py.  I suppose this doesn't actually eliminate 
the history, but it does eliminate the disk writes, and makes the 
history go away as soon as the process is done, right?

3. It would be great if I could, instead of (2), just set the history db 
to the DummyDB class in the core/history file.  But since sqlite3 exists 
in Sage's python, that looks like it would take a patch somewhere.

Comments?

Thanks,

Jason

[1] We just announced our beta of the new cell server, version 2, this 
time fully based on IPython 0.13 (plus some very small patches, like 
part of gh-2051).  You can test it out here: aleph2.sagemath.org.  We 
use SockJS to do the websocket/fallback connections, and it seems to 
work quite well.  We hope to clean up and contribute back our 
ForkingKernelManager and various other classes that you may want 
sometime before the end of the year.

[2] https://gist.github.com/3154504



More information about the IPython-dev mailing list