More forgiving version detection, doc update

Be more forgiving in detecting version; this change is mostly so EIN
works with recently released Jupyter/IPython 4.0.

Adding some additional comments to documentation to note that EIN seems
to work with Jupyter.
This commit is contained in:
John Miller 2015-08-12 15:17:46 -05:00
parent 0bbe7ad204
commit d1eb867cab
3 changed files with 25 additions and 7 deletions

View file

@ -4,16 +4,27 @@
--- or **E**\ IN **I**\ s not only for **N**\ otebooks.
EIN works with IPython 2.x_, 3.x_, and Juptyer_! Note that remote and password
protected logins are working with IPython 3.x, but have not been tested with
Jupyter.
.. note:: The code has been stable enough for my day to day work, but there are
no guarantees for the safety for your notebook data. Please make sure
that you backup and backup often!
that you back-up and back-up often!
.. note:: The code for testing EIN is horribly broken, but I regularly hand
check the code running against IPython's suite of sample
notebooks. It's a worse-is-better solution to problem requiring a
time-consuming solution.
.. |build-status|
image:: https://secure.travis-ci.org/millejoh/emacs-ipython-notebook.png?branch=master
:target: http://travis-ci.org/millejoh/emacs-ipython-notebook
:alt: Build Status
.. _2.x: http://ipython.org/ipython-doc/2/index.html
.. _3.x: http://ipython.org/ipython-doc/3/index.html
.. _Jupyter: http://jupyter.org
Screenshot
==========

View file

@ -129,12 +129,13 @@ the source is in git repository."
(defvar *running-ipython-version* (make-hash-table))
# TODO: Use symbols instead of numbers for ipython version ('jupyter and 'legacy)?
(defun ein:query-ipython-version (&optional url-or-port force)
(ein:aif (and (not force) (gethash (or url-or-port (ein:default-url-or-port)) *running-ipython-version*))
it
(let ((resp (request (ein:url (or url-or-port
(ein:default-url-or-port))
"api")
"api/contents")
:parser #'(lambda ()
(ignore-errors
(ein:json-read)))
@ -144,8 +145,7 @@ the source is in git repository."
(progn
(ein:log 'blather "Version api not implemented, assuming we are working with IPython 2.x")
(setf (gethash url-or-port *running-ipython-version*) 2))
(setf (gethash url-or-port *running-ipython-version*)
(string-to-number (first (split-string (plist-get (request-response-data resp) :version) "[\\.]"))))))))
(setf (gethash url-or-port *running-ipython-version*) 3)))))
(defun ein:force-ipython-version-check ()
(interactive)

View file

@ -31,11 +31,18 @@
;; --- or **E**\ IN **I**\ s not only for **N**\ otebooks.
;; EIN works with IPython 2.x_, 3.x_, and Juptyer_! Note that remote and
;; password protected logins are working with IPython 3.x, but have not been
;; tested with Jupyter.
;; .. note:: The code has been stable enough for my day to day work, but there are
;; no guarantees for the safety for your notebook data. Please make sure
;; that you backup and backup often!
;; .. _2.x: http://ipython.org/ipython-doc/2/index.html
;; .. _3.x: http://ipython.org/ipython-doc/3/index.html
;; .. _Jupyter: http://jupyter.org
;; Features
;; ========