Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HistoryManager.get_session_info() #679

Merged
merged 3 commits into from Aug 17, 2011
Merged

HistoryManager.get_session_info() #679

merged 3 commits into from Aug 17, 2011

Conversation

minrk
Copy link
Member

@minrk minrk commented Aug 4, 2011

add simple get_session_info method to HistoryManager for fetching session timestamps, etc.

Also sets detect_types flags on the db connection, so timestamps are retrieved as datetime objects.

The test history file has been moved to a tempdir, so that we don't get test_hist.sqlite files all over the filesystem when running the test suite.

Also set detect_types flags on the connection, so timestamps are
retrieved as datetime objects.

Associated type checking test included.
@takluyver
Copy link
Member

This seems sensible. I'm planning, when I have time, to pull out the methods for reading history into a HistoryAccessor class which can be instantiated without an InteractiveShell, so it can be used by tools for browsing or dumping history. HistoryManager will then subclass that, and add the methods for storing history from the shell.

@@ -170,7 +171,7 @@ def default_config():
config.TerminalInteractiveShell.colors = 'NoColor'
config.TerminalTerminalInteractiveShell.term_title = False,
config.TerminalInteractiveShell.autocall = 0
config.HistoryManager.hist_file = u'test_hist.sqlite'
config.HistoryManager.hist_file = os.path.join(tempfile.mkdtemp(), u'test_hist.sqlite')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be added to the list of files we delete on exit, so that we clean up after ourselves. But instead of making a temp directory, let's simply make a temp file with the suffix 'test_hist.sqlite'. Then the cleanup is simply a matter of removing the file on exit, which can be done by registering it with the ipython instance's .tempfiles attribute, that all get deleted at interpeter shutdown time.

* end_history_session moved before tempfile cleanup in shell.atexit_operations,
  to prevent access to file after deletion
fperez added a commit that referenced this pull request Aug 17, 2011
Add method to HistoryManager for fetching session timestamps, etc.

The method is: HistoryManager.get_session_info()

Also sets detect_types flags on the db connection, so timestamps are retrieved as datetime objects.

The test history file has been moved to a tempdir, so that we don't get test_hist.sqlite files all over the filesystem when running the test suite.
@fperez fperez merged commit 9dfe802 into ipython:master Aug 17, 2011
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
Add method to HistoryManager for fetching session timestamps, etc.

The method is: HistoryManager.get_session_info()

Also sets detect_types flags on the db connection, so timestamps are retrieved as datetime objects.

The test history file has been moved to a tempdir, so that we don't get test_hist.sqlite files all over the filesystem when running the test suite.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants