Repository: blaze/blaze

Issue:
Issue running blaze-server in 0.9.0 release
```
$ python --version
Python 3.4.4 :: Continuum Analytics, Inc.

$ python -c 'import blaze; print(blaze.__version__)'
0.9.0

$ blaze-server ./foo.yaml
Traceback (most recent call last):
  File "/Users/ksmith/anaconda/envs/test-blaze-0.9.0/bin/blaze-server", line 6, in <module>
    sys.exit(blaze.server.spider._main())
AttributeError: 'function' object has no attribute '_main'
```

The best I can tell, this issue is related to the `import blaze.server.spider` line, and an ambiguity in this `import`.  There's both a `blaze/server/spider.py` module, and inside `blaze/server/__init__.py` is a `from .spider import spider`, which imports the spider _function_ in the `blaze.server` namespace.

The strange thing is that this particular logic is unchanged since Blaze 0.8.3, and `blaze-server` worked fine then.

In any case, dealiasing the `spider` name in `blaze.server` is a good idea anyway to rule out this issue once and for all.  Fix forthcoming.



Discussion:

Resolving patch:
diff --git a/blaze/server/__init__.py b/blaze/server/__init__.py
--- a/blaze/server/__init__.py
+++ b/blaze/server/__init__.py
@@ -1,7 +1,7 @@
 from __future__ import absolute_import, division, print_function
 
 from .server import Server, to_tree, from_tree, api
-from .spider import spider, from_yaml
+from .spider import data_spider, from_yaml
 from .client import Client
 from .serialization import (
     SerializationFormat,
@@ -16,7 +16,7 @@
     'Client',
     'SerializationFormat',
     'Server',
-    'spider',
+    'data_spider',
     'from_yaml',
     'all_formats',
     'api',
diff --git a/blaze/server/spider.py b/blaze/server/spider.py
--- a/blaze/server/spider.py
+++ b/blaze/server/spider.py
@@ -19,7 +19,7 @@
     import builtins
 
 
-__all__ = 'spider', 'from_yaml'
+__all__ = 'data_spider', 'from_yaml'
 
 
 def _spider(resource_path, ignore, followlinks, hidden):
@@ -41,9 +41,11 @@ def _spider(resource_path, ignore, followlinks, hidden):
     return resources
 
 
-def spider(path, ignore=(ValueError, NotImplementedError), followlinks=True,
-           hidden=False):
-    """Traverse a directory and call ``odo.resource`` on its contentso
+def data_spider(path,
+                ignore=(ValueError, NotImplementedError),
+                followlinks=True,
+                hidden=False):
+    """Traverse a directory and call ``odo.resource`` on its contents.
 
     Parameters
     ----------
@@ -61,6 +63,8 @@ def spider(path, ignore=(ValueError, NotImplementedError), followlinks=True,
     dict
         Possibly nested dictionary of containing basenames mapping to resources
     """
+    # NOTE: this is named `data_spider` rather than just `spider` to
+    # disambiguate this function from the `blaze.server.spider` module.
     return {
         os.path.basename(path): _spider(path, ignore=ignore,
                                         followlinks=followlinks,
@@ -90,7 +94,7 @@ def from_yaml(path, ignore=(ValueError, NotImplementedError), followlinks=True,
 
     See Also
     --------
-    spider : Traverse a directory tree for resources
+    data_spider : Traverse a directory tree for resources
     """
     resources = {}
     for name, info in yaml.load(path.read()).items():
@@ -99,10 +103,10 @@ def from_yaml(path, ignore=(ValueError, NotImplementedError), followlinks=True,
                              name)
         source = info['source']
         if os.path.isdir(source):
-            resources[name] = spider(os.path.expanduser(source),
-                                     ignore=ignore,
-                                     followlinks=followlinks,
-                                     hidden=hidden)
+            resources[name] = data_spider(os.path.expanduser(source),
+                                          ignore=ignore,
+                                          followlinks=followlinks,
+                                          hidden=hidden)
         else:
             resources[name] = resource(source, dshape=info.get('dshape'))
     return resources


Test patch:
diff --git a/blaze/server/tests/test_spider.py b/blaze/server/tests/test_spider.py
--- a/blaze/server/tests/test_spider.py
+++ b/blaze/server/tests/test_spider.py
@@ -10,7 +10,7 @@
 
 from datashape import dshape
 
-from blaze import spider, discover
+from blaze import data_spider, discover
 
 
 @pytest.fixture
@@ -39,8 +39,8 @@ def data_with_cycle(data):
     return data
 
 
-def test_spider(data):
-    result = spider(str(data))
+def test_data_spider(data):
+    result = data_spider(str(data))
     ss = """{
     %r: {
         'foo.csv': var * {a: int64, b: int64},
@@ -53,8 +53,8 @@ def test_spider(data):
 
 @pytest.mark.skipif(sys.platform == 'win32',
                     reason='Windows does not have symlinks')
-def test_spider_cycle(data_with_cycle):
-    result = spider(str(data_with_cycle), followlinks=True)
+def test_data_spider_cycle(data_with_cycle):
+    result = data_spider(str(data_with_cycle), followlinks=True)
     ss = """{
     %r: {
         'foo.csv': var * {a: int64, b: int64},