pythonjupyterqtconsole

Where does Jupyter QtConsole save its past commands


If I close an instance of Jupyter QtConsole, and open a new instance, hit the Up key. Then the previous command I last ran is loaded.

In which directory is the past command history saved?

I've looked through the source on Github but haven't managed to find this. Nor does it appear to be in any path in jupyter --paths.


Solution

  • Going through the source the call stack is like:

    HistoryConsoleWidget.history_previous()
    HistoryConsoleWidget._get_edited_history()
    HistoryConsoleWidget._set_history()
    JupyterWidget._handle_history_reply()
    

    Can't find anything further, so thought this might be a Jupyter thing. Googling this lead me to Where is the history file for ipython, and indeed it is stored at ~/.ipython/profile_default/history.sqlite.