Repository: intake/intake

Issue:
'auth' attribute and __init__ parameter removed from Catalog
@martindurant Can you comment on the intent behind removing the `auth` attribute and `__init__` parameter from `Catalog`?

https://github.com/intake/intake/commit/bf5fb33d87914e004b29c792791ce208aee78313#diff-4e371ca3c37982987024b768df161ca8c8da696ff4a3459035c122e6cfb9bd15L52-L104

That backward-compatible change broke databroker in several places where we access it and pass it through to new instances, as in for example:

https://github.com/bluesky/databroker/blob/41700e7f04f5dcbd88eec17d4f21ab2a4e2b3c57/databroker/_drivers/mongo_normalized.py#L345

Discussion:

Patch:
diff --git a/docs/source/api_other.rst b/docs/source/api_other.rst
index 28fa692..e0d578e 100644
--- a/docs/source/api_other.rst
+++ b/docs/source/api_other.rst
@@ -86,60 +86,60 @@ GUI
 
 .. autosummary::
 
-   intake.gui.base.Base
-   intake.gui.base.BaseSelector
-   intake.gui.base.BaseView
-   intake.gui.catalog.add.FileSelector
-   intake.gui.catalog.add.URLSelector
-   intake.gui.catalog.add.CatAdder
-   intake.gui.catalog.gui.CatGUI
-   intake.gui.catalog.search.Search
-   intake.gui.catalog.search.SearchInputs
-   intake.gui.catalog.select.CatSelector
-   intake.gui.source.defined_plots.Plots
-   intake.gui.source.gui.SourceGUI
-   intake.gui.source.description.Description
-   intake.gui.source.select.SourceSelector
+   intake.interface.base.Base
+   intake.interface.base.BaseSelector
+   intake.interface.base.BaseView
+   intake.interface.catalog.add.FileSelector
+   intake.interface.catalog.add.URLSelector
+   intake.interface.catalog.add.CatAdder
+   intake.interface.catalog.gui.CatGUI
+   intake.interface.catalog.search.Search
+   intake.interface.catalog.search.SearchInputs
+   intake.interface.catalog.select.CatSelector
+   intake.interface.source.defined_plots.Plots
+   intake.interface.source.gui.SourceGUI
+   intake.interface.source.description.Description
+   intake.interface.source.select.SourceSelector
 
-.. autoclass:: intake.gui.base.Base
+.. autoclass:: intake.interface.base.Base
    :members:
 
-.. autoclass:: intake.gui.base.BaseSelector
+.. autoclass:: intake.interface.base.BaseSelector
    :members:
 
-.. autoclass:: intake.gui.base.BaseView
+.. autoclass:: intake.interface.base.BaseView
    :members:
 
-.. autoclass:: intake.gui.catalog.add.FileSelector
+.. autoclass:: intake.interface.catalog.add.FileSelector
    :members:
 
-.. autoclass:: intake.gui.catalog.add.URLSelector
+.. autoclass:: intake.interface.catalog.add.URLSelector
    :members:
 
-.. autoclass:: intake.gui.catalog.add.CatAdder
+.. autoclass:: intake.interface.catalog.add.CatAdder
    :members:
 
-.. autoclass:: intake.gui.catalog.gui.CatGUI
+.. autoclass:: intake.interface.catalog.gui.CatGUI
    :members:
 
-.. autoclass:: intake.gui.catalog.search.Search
+.. autoclass:: intake.interface.catalog.search.Search
    :members:
 
-.. autoclass:: intake.gui.catalog.search.SearchInputs
+.. autoclass:: intake.interface.catalog.search.SearchInputs
    :members:
 
-.. autoclass:: intake.gui.catalog.select.CatSelector
+.. autoclass:: intake.interface.catalog.select.CatSelector
    :members:
 
-.. autoclass:: intake.gui.source.defined_plots.Plots
+.. autoclass:: intake.interface.source.defined_plots.Plots
    :members:
 
-.. autoclass:: intake.gui.source.gui.SourceGUI
+.. autoclass:: intake.interface.source.gui.SourceGUI
    :members:
 
-.. autoclass:: intake.gui.source.description.Description
+.. autoclass:: intake.interface.source.description.Description
    :members:
 
-.. autoclass:: intake.gui.source.select.SourceSelector
+.. autoclass:: intake.interface.source.select.SourceSelector
    :members:
 
diff --git a/docs/source/api_user.rst b/docs/source/api_user.rst
index 515da56..1b93ae1 100644
--- a/docs/source/api_user.rst
+++ b/docs/source/api_user.rst
@@ -17,7 +17,7 @@ These are reference class and function definitions likely to be useful to everyo
    intake.catalog.local.YAMLFileCatalog
    intake.catalog.local.YAMLFilesCatalog
    intake.catalog.zarr.ZarrGroupCatalog
-   intake.gui.gui.GUI
+   intake.interface.gui.GUI
 
 .. autofunction::
    intake.open_catalog
@@ -36,7 +36,7 @@ These are reference class and function definitions likely to be useful to everyo
 .. autofunction::
    intake.upload
 
-.. autoclass:: intake.gui.gui.GUI
+.. autoclass:: intake.interface.gui.GUI
    :members:
 
 Source classes
diff --git a/docs/source/gui.rst b/docs/source/gui.rst
index 1cc79a9..e905aa2 100644
--- a/docs/source/gui.rst
+++ b/docs/source/gui.rst
@@ -13,7 +13,7 @@ automatically display the last object in a code cell).
 
 .. image:: _static/images/gui_builtin.png
 
-New instances of the GUI are also available by instantiating ``intake.GUI``,
+New instances of the GUI are also available by instantiating ``intake.interface.gui.GUI``,
 where you can specify a list of catalogs to initially include.
 
 The GUI contains three main areas:
@@ -116,7 +116,7 @@ checking the box next to "show yaml".
 
 .. image:: _static/images/gui_plot_yaml.png
 
-The holoviews object can be retrieved from the gui using ``intake.gui.source.plot.pane.object``,
+The holoviews object can be retrieved from the gui using ``intake.interface.source.plot.pane.object``,
 and you can then use it in Python or export it to a file.
 
 Interactive Visualization
diff --git a/intake/__init__.py b/intake/__init__.py
index a526757..799ad3e 100644
--- a/intake/__init__.py
+++ b/intake/__init__.py
@@ -15,6 +15,7 @@ __version__ = get_versions()['version']
 del get_versions
 
 from .source import register_driver, registry
+from .catalog.base import Catalog
 
 imports = {
     "DataSource": "intake.source.base:DataSource",
@@ -38,12 +39,7 @@ def __getattr__(attr):
     contents of the ``imports`` and ``openers`` dicts
     """
     gl = globals()
-    if attr == 'Catalog':
-        from .catalog.base import Catalog
-        warnings.warn('deprecation: intake.Catalog now references the base class intake.catalog.base.Catalog\n '
-                      'If you want to open a generic URL, you should use intake.open_catalog')
-        return Catalog
-    elif attr in openers:
+    if attr in openers:
         driver = openers[attr].load()
         gl[attr] = driver
     else:
diff --git a/intake/catalog/base.py b/intake/catalog/base.py
index 5b2c2b4..3680bf6 100644
--- a/intake/catalog/base.py
+++ b/intake/catalog/base.py
@@ -37,15 +37,16 @@ class Catalog(DataSource):
     # emulate a DataSource
     container = 'catalog'
     name = 'catalog'
+    auth = None
 
-    def __init__(self, *args, name=None, description=None, metadata=None,
+    def __init__(self, entries=None, name=None, description=None, metadata=None,
                  ttl=60, getenv=True, getshell=True,
                  persist_mode='default', storage_options=None):
         """
         Parameters
         ----------
-        args : str or list(str)
-            A single URI or list of URIs.
+        entries : dict, optional
+            Mapping of {name: entry}
         name : str, optional
             Unique identifier for catalog. This takes precedence over whatever
             is stated in the cat file itself. Defaults to None.
@@ -86,13 +87,16 @@ class Catalog(DataSource):
             raise ValueError('Persist mode (%s) not understood' % persist_mode)
         self.pmode = persist_mode
 
-        if all(isinstance(a, (tuple, list)) for a in args):
-            args = list(flatten(args))
-        if len(args) == 1:
-            args = args[0]
-        self.args = args
+        if entries and isinstance(entries, str):
+            raise ValueError(
+                "The class intake.Catalog does not accept a string for "
+                "`entries`\n"
+                "Did you mean to use `intake.open_catalog`? Note that in "
+                "versions of intake <=0.5.4 `intake.Catalog` was an "
+                "alias for `intake.open_catalog`. It is now the intake base "
+                "Catalog class.")
         self.updated = time.time()
-        self._entries = self._make_entries_container()
+        self._entries = entries if entries is not None else self._make_entries_container()
         self.force_reload()
 
     @classmethod


Test patch:
diff --git a/intake/catalog/tests/test_core.py b/intake/catalog/tests/test_core.py
index e340bff..fefec67 100644
--- a/intake/catalog/tests/test_core.py
+++ b/intake/catalog/tests/test_core.py
@@ -1,3 +1,4 @@
+import pytest
 from intake.catalog.base import Catalog
 
 
@@ -5,3 +6,10 @@ def test_no_entry():
     cat = Catalog()
     cat2 = cat.configure_new()
     assert isinstance(cat2, Catalog)
+    assert cat.auth is None
+    assert cat2.auth is None
+
+
+def test_regression():
+    with pytest.raises(ValueError):
+        Catalog("URI")
diff --git a/intake/tests/test_top_level.py b/intake/tests/test_top_level.py
index 6ff4216..22abc0d 100644
--- a/intake/tests/test_top_level.py
+++ b/intake/tests/test_top_level.py
@@ -113,8 +113,8 @@ def test_output_notebook():
 
 
 def test_old_usage():
-    with pytest.warns(UserWarning):
-        intake.Catalog()
+    assert isinstance(intake.Catalog(), intake.Catalog)
+    assert intake.Catalog is intake.catalog.base.Catalog
 
 
 def test_no_imports():