Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

update tornado dependency to 2.1 #821

Merged
merged 2 commits into from

2 participants

@minrk
Owner

The notebook server will no longer try to launch with 2.0.

Test imports and install doc updated to match.

The only reason I didn't push directly to master is that 2.0 will technically still work with some browser versions.

But I don't think there's any need to support 2.0.

@minrk minrk update tornado dependency to 2.1
The notebook server will no longer try to launch with 2.0.

Test imports and install doc updated to match.
d3ee41f
@fperez

My only thought here is that I wonder if it wouldn't be nicer to keep using test_for(), just to keep the code in iptest more regular, and simply teach test_for how to check something other than __version__.

I leave it as a suggestion for you, but I don't feel super strongly about it, so I'll leave the final choice up to you.

Owner

__version__ is so common, that I think special casing the exceptions makes sense. We might want to make some changes, since string comparison is risky, given that the next version of zmq is most likely to be 2.1.10, which will fail our test for 2.1.4.

Owner

I guess I'm not sure what you mean by your reply: do you want to do the special-casing inside test_for or in the iptest file itself? We certainly need to handle the other-than-__version__ cases somewhere, I was just thinking we might be better off putting all that inside test_for, that's all.

Owner

I was simultaneously saying we don't need to change it to support tornado, but we do still need to change it to support two-digit sub-versions. I'll make a quick tweak so that check_for uses importstring.import_item, and make the zmq versioncheck fix as well.

Owner

sounds good, thanks!

@fperez
Owner

Other than the minor comment above, +1 from me. Merge away once you've decided what to do there.

Thanks!

@minrk minrk allow more processing in test_for
* test_for uses import_item, instead of __import__
* test_for now allows a callback, for processing the result of import_item prior to comparison with min_zmq
* callback is only called when min_zmq is defined
* callback's default is to just return mod.__version__
* use this to check tornado version, and zmq as a version tuple
* fix pexpect check to use external.pexpect
e7616f6
@minrk
Owner

test_for updated with a callback for processing, so it can do more sophisticated things. the zmq check has been updated to use it, and the pexpect check was also wrong (checked for pexpect instead of external.pexpect).

@fperez
Owner

great, thanks! Merging now.

@fperez fperez merged commit 2ecf55e into ipython:master
@fperez fperez referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 23, 2011
  1. @minrk

    update tornado dependency to 2.1

    minrk authored
    The notebook server will no longer try to launch with 2.0.
    
    Test imports and install doc updated to match.
  2. @minrk

    allow more processing in test_for

    minrk authored
    * test_for uses import_item, instead of __import__
    * test_for now allows a callback, for processing the result of import_item prior to comparison with min_zmq
    * callback is only called when min_zmq is defined
    * callback's default is to just return mod.__version__
    * use this to check tornado version, and zmq as a version tuple
    * fix pexpect check to use external.pexpect
This page is out of date. Refresh to see the latest.
View
12 IPython/frontend/html/notebook/__init__.py
@@ -0,0 +1,12 @@
+"""The IPython HTML Notebook"""
+
+# check for tornado 2.1.0
+msg = "The IPython Notebook requires tornado >= 2.1.0"
+try:
+ import tornado
+except ImportError:
+ raise ImportError(msg)
+else:
+ if tornado.version_info < (2,1,0):
+ raise ImportError(msg+", but you have %s"%tornado.version)
+del msg
View
52 IPython/testing/iptest.py
@@ -45,6 +45,7 @@
from nose.core import TestProgram
# Our own imports
+from IPython.utils.importstring import import_item
from IPython.utils.path import get_ipython_module_path
from IPython.utils.process import find_cmd, pycmd2argv
from IPython.utils.sysinfo import sys_info
@@ -81,18 +82,38 @@
#-----------------------------------------------------------------------------
# Logic for skipping doctests
#-----------------------------------------------------------------------------
+def extract_version(mod):
+ return mod.__version__
-def test_for(mod, min_version=None):
- """Test to see if mod is importable."""
+def test_for(item, min_version=None, callback=extract_version):
+ """Test to see if item is importable, and optionally check against a minimum
+ version.
+
+ If min_version is given, the default behavior is to check against the
+ `__version__` attribute of the item, but specifying `callback` allows you to
+ extract the value you are interested in. e.g::
+
+ In [1]: import sys
+
+ In [2]: from IPython.testing.iptest import test_for
+
+ In [3]: test_for('sys', (2,6), callback=lambda sys: sys.version_info)
+ Out[3]: True
+
+ """
try:
- __import__(mod)
+ check = import_item(item)
except (ImportError, RuntimeError):
- # GTK reports Runtime error if it can't be initialized even if it's
+ # GTK reports Runtime error if it can't be initialized even if it's
# importable.
return False
else:
if min_version:
- return sys.modules[mod].__version__ >= min_version
+ if callback:
+ # extra processing step to get version to compare
+ check = callback(check)
+
+ return check >= min_version
else:
return True
@@ -102,16 +123,27 @@ def test_for(mod, min_version=None):
have['curses'] = test_for('_curses')
have['matplotlib'] = test_for('matplotlib')
-have['pexpect'] = test_for('pexpect')
+have['pexpect'] = test_for('IPython.external.pexpect')
have['pymongo'] = test_for('pymongo')
have['wx'] = test_for('wx')
have['wx.aui'] = test_for('wx.aui')
+have['qt'] = test_for('IPython.external.qt')
+
+have['tornado'] = test_for('tornado.version_info', (2,1,0), callback=None)
+
if os.name == 'nt':
- have['zmq'] = test_for('zmq', '2.1.7')
+ min_zmq = (2,1,7)
else:
- have['zmq'] = test_for('zmq', '2.1.4')
-have['qt'] = test_for('IPython.external.qt')
-have['tornado'] = test_for('tornado')
+ min_zmq = (2,1,4)
+
+def version_tuple(mod):
+ "turn '2.1.9' into (2,1,9), and '2.1dev' into (2,1,999)"
+ # turn 'dev' into 999, because Python3 rejects str-int comparisons
+ vs = mod.__version__.replace('dev', '.999')
+ tup = tuple([int(v) for v in vs.split('.') ])
+ return tup
+
+have['zmq'] = test_for('zmq', min_zmq, version_tuple)
#-----------------------------------------------------------------------------
# Functions and classes
View
10 docs/source/install/install.txt
@@ -336,6 +336,7 @@ pygments
The syntax-highlighting in ``ipython qtconsole`` is done with the pygments_
project, which is easy_install-able.
+.. _installnotebook:
Dependencies for the IPython HTML notebook
==========================================
@@ -352,14 +353,11 @@ the HTML notebook requires ZeroMQ and PyZMQ.
Tornado
-------
-The IPython notebook uses the Tornado_ project for its HTTP server. As of this
-writing, we require a development version from github, as version 2.0 is *not
-sufficient*. You can either clone their git repository yourself and install it
-manually, or install directly from github with::
+The IPython notebook uses the Tornado_ project for its HTTP server. Tornado 2.1
+is required, in order to support current versions of browsers, due to an update
+to the websocket protocol.
- easy_install https://github.com/facebook/tornado/tarball/master
-
MathJax
-------
View
4 docs/source/interactive/htmlnotebook.txt
@@ -4,6 +4,10 @@
An HTML Notebook IPython
=========================
+.. seealso::
+
+ :ref:`Installation requirements <installnotebook>` for the Notebook.
+
The IPython Notebook consists of two related components:
* An JSON based Notebook document format for recording and distributing
Something went wrong with that request. Please try again.