I have tried increasing IPython history length following this post :
Control ipython history length by changing c.TerminalInteractiveShell.history_length
in ~/.ipython/profile_default/ipython_config.py
.
The config file seems to be executed at startup (if I put print('test-startup')
in the file, it's printed when I start IPython)
But it does not seems to have any influence, is there anyway to check the history size from inside the ipython (kinda like how you can do echo $HISTSIZE; echo $HISTFILESIZE
in bash ?)
In attempting to answer the question myself, I stumbled upon this question as well this question and found snippets that really didn't provide the OP with the complete, TL;DR information.
So for my own records and to make the answers on SO here more complete, I provided a quick implementation and check to "Increase iPython History Length."
iPython
config file$ ipython profile create <profile name>
I just wanted this for my default config, so I ran:
$ ipython profile create
ipython_config.py
FileRunning the above command creates an ipython_config.py
file, which (on *.nix
is stored at ~/.ipython/profile_default/ipython_config.py
These are the two lines that I uncommented and changed the values for:
Fire up iPython and run the commands found in the accepted answer above to ensure our new history_length = 100,000
.
benjamingross (develop*)$ ipython
Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:14:23)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.3.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]: %config TerminalInteractiveShell.history_length
Out[1]: 100000
Using
In[3]: %config TerminalInteractiveShell.history_length
Out[3]: 10000
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With