Commits

Miha Stajdohar committed 18d29fd

Auto-load network and datasets. Added networkx requirement.

Comments (0)

Files changed (4)

_network/__init__.py

 
 """
 
-# Test if networkx is installed
-__have_networkx = False
-try:
-    import networkx as nx
+from pkg_resources import resource_filename
+def networks():
+    yield ('', resource_filename(__name__, 'networks'))
 
-    __have_networkx = True
-except ImportError:
-    import warnings
+import networkx as nx
 
-    warnings.warn(
-        "Warning: some features are disabled. Install networkx to use the 'Orange.network' module.")
-
-if __have_networkx:
-    from network import *
+from network import *
 
 import community
 import snap

_network/readwrite.py

 def _check_network_dir(p):
     if type(p) == str:
         if not os.path.isfile(p):
-            path = os.path.join(Orange.utils.environ.network_install_dir, \
-                                os.path.split(p)[1])
+            path = Orange.data.io.find_file(os.path.split(p)[1])
+            #path = os.path.join(Orange.utils.environ.network_install_dir, \
+            #                    os.path.split(p)[1])
 
             if os.path.isfile(path):
                 return path

rtd_requirements.txt

 mock
 numpydoc
+networkx
 -e hg+http://bitbucket.org/biolab/orange#egg=Orange
     'setuptools',
     'numpy',
     'scipy',      # Requires Fortran compiler
+    'networkx',
 ),
 
 EXTRAS_REQUIRE = {
+    # Dependencies which are problematic to install automatically
     'GUI': (
-        # Dependencies which are problematic to install automatically
         'PyQt4',
     ),
     'reST': (