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

allow disabling SQLite history #2278

Merged
merged 3 commits into from Aug 10, 2012
Merged

allow disabling SQLite history #2278

merged 3 commits into from Aug 10, 2012

Conversation

minrk
Copy link
Member

@minrk minrk commented Aug 9, 2012

  • adds HistoryAccessor.disabled configurable for turning off the SQLite history
  • also provides connection_options configurable dict for relaying kwargs to sqlite3.connect. This is a just-in-case measure, but I think valuable if people have a reason to adjust the SQLite connection flags.

Mainly for use in situations where threading or filesystem issues can cause problems for sqlite, e.g. embedding in django.

closes #2276

* adds HistoryAccessor.disabled configurable for turning off the SQLite history
* also provides connection_options configurable dict for relaying kwargs to sqlite3.connect.  This is a just-in-case measure, but I think valuable if people have a reason to adjust the SQLite connection flags.

Mainly for use in situations where threading or filesystem issues can cause problems for sqlite, e.g. embedding in django.

closes ipython#2276
"""return an empty list in the absence of sqlite"""
if sqlite3 is None:
if sqlite3 is None or self.disabled:
Copy link
Member

Choose a reason for hiding this comment

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

I see that here you are using sqlite but below you still test against sqlite3. Are both defined? Are the right ones used in the right places?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope, just a typo and already fixed.

Copy link
Member

Choose a reason for hiding this comment

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

OK I would say this is merge ready. Great work!

On Thu, Aug 9, 2012 at 4:03 PM, Min RK notifications@github.com wrote:

In IPython/core/history.py:

 """return an empty list in the absence of sqlite"""
  • if sqlite3 is None:
  • if sqlite3 is None or self.disabled:

Nope, just a typo and already fixed.


Reply to this email directly or view it on GitHubhttps://github.com//pull/2278/files#r1347855.

Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu and ellisonbg@gmail.com

@minrk
Copy link
Member Author

minrk commented Aug 9, 2012

Test results for commit b4ee0c2 merged into master (75c66c8)
Platform: darwin

  • python2.6: OK (libraries not available: cython matplotlib oct2py pygments pymongo qt rpy2 tornado wx wx.aui)
  • python2.7: OK (libraries not available: oct2py rpy2 wx wx.aui zmq)
  • python3.2: OK (libraries not available: cython matplotlib oct2py pygments pymongo qt rpy2 wx wx.aui)

Not available for testing:

@ellisonbg
Copy link
Member

Other than the one comment above, the code looks solid. If that comment doesn't generate any changes, I would say this is merge ready.

@dimaqq
Copy link

dimaqq commented Aug 10, 2012

I'd like to see this implemented too!

@@ -81,12 +83,32 @@ class HistoryAccessor(Configurable):
ipython --HistoryManager.hist_file=/tmp/ipython_hist.sqlite

""")

disabled = Bool(False, config=True,
Copy link
Member

Choose a reason for hiding this comment

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

Just one issue that I see: I tend to prefer config variables that are positive, to avoid having to write code with double-negatives. if not disabled is harder to parse mentally than if enabled, and for the other case, if not enabled is just about the same mental load as if disabled. So I would vote for changing this one to have the config variable be enabled.

I know it will require flipping all the logic in the PR around, but it's easy work. Happy to discuss if you disagree, but let's go over it before merging...

Copy link
Member

Choose a reason for hiding this comment

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

I guess I am +1 on Fernando's comment about disabled->enabled.

On Fri, Aug 10, 2012 at 12:59 PM, Fernando Perez
notifications@github.comwrote:

In IPython/core/history.py:

@@ -81,12 +83,32 @@ class HistoryAccessor(Configurable):
ipython --HistoryManager.hist_file=/tmp/ipython_hist.sqlite

     """)
  • disabled = Bool(False, config=True,

Just one issue that I see: I tend to prefer config variables that are
positive, to avoid having to write code with effectively double-negatives. if
not disabled is harder to parse mentally than if enabled, and for the
other case, if not enabled is just about the same mental load as if
disabled. So I would vote for changing this one to have the config
variable be enabled.

I know it will require flipping all the logic in the PR around, but it's
easy work. Happy to discuss if you disagree, but let's go over it before
merging...


Reply to this email directly or view it on GitHubhttps://github.com//pull/2278/files#r1354995.

Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu and ellisonbg@gmail.com

Copy link
Member Author

Choose a reason for hiding this comment

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

I was 50-50 while writing, so I will make that change shortly.

The reason I went with disabled is that ~all people for whom this is relevant are looking for a way to 'disable' the history, so disable is the relevant active verb for users, even of 'enable' is cleaner for the object itself.

-MinRK

On Aug 10, 2012, at 13:25, "Brian E. Granger" notifications@github.com wrote:

In IPython/core/history.py:

@@ -81,12 +83,32 @@ class HistoryAccessor(Configurable):
ipython --HistoryManager.hist_file=/tmp/ipython_hist.sqlite

     """)
  • disabled = Bool(False, config=True,
    I guess I am +1 on Fernando's comment about disabled->enabled. On Fri, Aug 10, 2012 at 12:59 PM, Fernando Perez notifications@github.comwrote:


    Reply to this email directly or view it on GitHub.

@minrk
Copy link
Member Author

minrk commented Aug 10, 2012

Test results for commit 5ed8fae merged into master (2092555)
Platform: darwin

  • python2.6: OK (libraries not available: cython matplotlib oct2py pygments pymongo qt rpy2 tornado wx wx.aui)
  • python2.7: OK (libraries not available: oct2py rpy2 wx wx.aui)
  • python3.2: OK (libraries not available: cython matplotlib oct2py pygments pymongo qt rpy2 wx wx.aui)

Extra args: ['-x']
Not available for testing:

@minrk
Copy link
Member Author

minrk commented Aug 10, 2012

s/enabled/not disabled/ done

@fperez
Copy link
Member

fperez commented Aug 10, 2012

Great, thanks! Merging now, excellent job.

fperez added a commit that referenced this pull request Aug 10, 2012
allow disabling SQLite history

* adds HistoryAccessor.disabled configurable for turning off the SQLite history
* also provides connection_options configurable dict for relaying kwargs to sqlite3.connect.  This is a just-in-case measure, but I think valuable if people have a reason to adjust the SQLite connection flags.

Mainly for use in situations where threading or filesystem issues can cause problems for sqlite, e.g. embedding in django.

closes #2276
@fperez fperez merged commit b6697c0 into ipython:master Aug 10, 2012
@minrk minrk deleted the disable_history branch March 31, 2014 23:36
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
allow disabling SQLite history

* adds HistoryAccessor.disabled configurable for turning off the SQLite history
* also provides connection_options configurable dict for relaying kwargs to sqlite3.connect.  This is a just-in-case measure, but I think valuable if people have a reason to adjust the SQLite connection flags.

Mainly for use in situations where threading or filesystem issues can cause problems for sqlite, e.g. embedding in django.

closes ipython#2276
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.

config option for disabling history store
4 participants