Skip to content

Instantly share code, notes, and snippets.

@nnathan
Created August 11, 2015 06:30
Show Gist options
  • Save nnathan/309e078c43131718b56b to your computer and use it in GitHub Desktop.
Save nnathan/309e078c43131718b56b to your computer and use it in GitHub Desktop.
Per-virtualenv history for IPython
import sys
import os
c = get_config()
# per-virtualenv history (for Python 2.x)
if hasattr(sys, 'real_prefix'):
venv_name = os.path.basename(sys.prefix)
c.HistoryManager.hist_file = os.path.join(
os.path.dirname(__file__), 'history-{}.sqlite'.format(venv_name)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment