We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
No index driver found for 'default'
Greetings!

Using the latest Datacube version and libraries, indexing and ingestion runs well except when I try to access the database on Jupyter I get the "No index driver found for 'default': 0 available: " error.

> RuntimeError                              Traceback (most recent call last)
> ipython-input-2-f074b535470c> in <module>()
>       1 
>       2 import datacube
> ----> 3 dc = datacube.Datacube(config='E:\Datacubes\datacube-core-develop\datacube.conf')
>       4 dc
> 
> E:\Datacubes\datacube-core-develop\datacube\api\core.py in __init__(self, index, config, app, env, validate_connection)
>     116             index = index_connect(normalise_config(config),
>     117                                   application_name=app,
> --> 118                                   validate_connection=validate_connection)
>     119 
>     120         self.index = index
> 
> E:\Datacubes\datacube-core-develop\datacube\index\_api.py in index_connect(local_config, application_name, validate_connection)
>      37         raise RuntimeError(
>      38             "No index driver found for %r. %s available: %s" % (
> ---> 39                 driver_name, len(index_drivers()), ', '.join(index_drivers())
>      40             )
>      41         )
> 
> RuntimeError: No index driver found for 'default'. 0 available: 

I've reinstalled PostgreSQL and all libraries, to no avail.
All suggestions are welcome.

**edit:** While ingestion I get this warning

>  datacube.drivers.driver_cache WARNING Failed to resolve driver datacube.plugins.io.write::s3aio
>  datacube.drivers.driver_cache WARNING Failed to resolve driver datacube.plugins.io.write::s3aio_test

where do I update the driver from? Is it because of this plugin?

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `datacube/drivers/driver_cache.py`
Content:
```
1 from __future__ import absolute_import, print_function
2 
3 import logging
4 
5 from pkg_resources import iter_entry_points
6 
7 _LOG = logging.getLogger(__name__)
8 
9 
10 def load_drivers(group):
11     """
12     Load available drivers for a given group name.
13 
14     Gracefully handles:
15 
16      - Driver module not able to be imported
17      - Driver init function throwing an exception or returning None
18 
19      By having driver entry_points pointing to a function, we defer loading the driver
20      module or running any code until required.
21 
22     :param str group: Name of the entry point group e.g. "datacube.plugins.io.read"
23 
24     :returns: Dictionary String -> Driver Object
25     """
26 
27     def safe_load(ep):
28         # pylint: disable=bare-except
29         try:
30             driver_init = ep.resolve()
31         except:
32             _LOG.warning('Failed to resolve driver %s::%s', group, ep.name)
33             return None
34 
35         try:
36             driver = driver_init()
37         except:
38             _LOG.warning('Exception during driver init, driver name: %s::%s', group, ep.name)
39             return None
40 
41         if driver is None:
42             _LOG.warning('Driver init returned None, driver name: %s::%s', group, ep.name)
43 
44         return driver
45 
46     def resolve_all(group):
47         for ep in iter_entry_points(group=group, name=None):
48             driver = safe_load(ep)
49             if driver is not None:
50                 yield (ep.name, driver)
51 
52     return dict((name, driver) for name, driver in resolve_all(group))
53
```

Path: `datacube/drivers/indexes.py`
Content:
```
1 from __future__ import absolute_import
2 
3 from .driver_cache import load_drivers
4 
5 
6 class IndexDriverCache(object):
7     def __init__(self, group):
8         self._drivers = load_drivers(group)
9 
10         for driver in list(self._drivers.values()):
11             if hasattr(driver, 'aliases'):
12                 for alias in driver.aliases:
13                     self._drivers[alias] = driver
14 
15     def __call__(self, name):
16         """
17         :returns: None if driver with a given name is not found
18 
19         :param str name: Driver name
20         :param str fmt: Dataset format
21         :return: Returns WriterDriver
22         """
23         return self._drivers.get(name, None)
24 
25     def drivers(self):
26         """ Returns list of driver names
27         """
28         return list(self._drivers.keys())
29 
30 
31 def index_cache():
32     """ Singleton for WriterDriverCache
33     """
34     # pylint: disable=protected-access
35     if not hasattr(index_cache, '_instance'):
36         index_cache._instance = IndexDriverCache('datacube.plugins.index')
37     return index_cache._instance
38 
39 
40 def index_drivers():
41     """ Returns list driver names
42     """
43     return index_cache().drivers()
44 
45 
46 def index_driver_by_name(name):
47     """ Lookup writer driver by name
48 
49     :returns: Initialised writer driver instance
50     :returns: None if driver with this name doesn't exist
51     """
52     return index_cache()(name)
53
```

Path: `setup.py`
Content:
```
1 #!/usr/bin/env python
2 
3 import versioneer
4 from setuptools import setup, find_packages
5 
6 tests_require = [
7     'compliance-checker',
8     'hypothesis',
9     'mock',
10     'objgraph',
11     'pycodestyle',
12     'pylint',
13     'pytest',
14     'pytest-cov',
15     'pytest-timeout',
16 ]
17 
18 extras_require = {
19     'performance': ['ciso8601', 'bottleneck'],
20     'interactive': ['matplotlib', 'fiona'],
21     'distributed': ['distributed', 'dask[distributed]'],
22     'analytics': ['scipy', 'pyparsing', 'numexpr'],
23     'doc': ['Sphinx', 'setuptools'],
24     'replicas': ['paramiko', 'sshtunnel', 'tqdm'],
25     'celery': ['celery>=4', 'redis'],
26     's3': ['boto3==1.4.3', 'SharedArray', 'pathos', 'zstandard'],
27     'test': tests_require,
28 }
29 # An 'all' option, following ipython naming conventions.
30 extras_require['all'] = sorted(set(sum(extras_require.values(), [])))
31 
32 setup(
33     name='datacube',
34     version=versioneer.get_version(),
35     cmdclass=versioneer.get_cmdclass(),
36     python_requires='>=3.5.2',
37 
38     url='https://github.com/opendatacube/datacube-core',
39     author='AGDC Collaboration',
40     maintainer='AGDC Collaboration',
41     maintainer_email='',
42     description='An analysis environment for satellite and other earth observation data',
43     long_description=open('README.rst').read(),
44     license='Apache License 2.0',
45     classifiers=[
46         "Development Status :: 4 - Beta",
47         "Intended Audience :: Developers",
48         "Intended Audience :: Science/Research",
49         "License :: OSI Approved :: Apache Software License",
50         "Natural Language :: English",
51         "Operating System :: MacOS :: MacOS X",
52         "Operating System :: POSIX",
53         "Operating System :: POSIX :: BSD",
54         "Operating System :: POSIX :: Linux",
55         "Operating System :: Microsoft :: Windows",
56         "Programming Language :: Python",
57         "Programming Language :: Python :: 3",
58         "Programming Language :: Python :: 3.5",
59         "Programming Language :: Python :: 3.6",
60         "Topic :: Scientific/Engineering :: GIS",
61         "Topic :: Scientific/Engineering :: Information Analysis",
62     ],
63 
64     packages=find_packages(
65         exclude=('tests', 'tests.*',
66                  'integration_tests', 'integration_tests.*')
67     ),
68     package_data={
69         '': ['*.yaml', '*/*.yaml'],
70     },
71     scripts=[
72         'datacube_apps/scripts/pbs_helpers.sh'
73     ],
74     setup_requires=[
75         'pytest-runner'
76     ],
77     install_requires=[
78         'affine',
79         'cachetools',
80         'click>=5.0',
81         'cloudpickle>=0.4',
82         'dask[array]',
83         'gdal>=1.9',
84         'jsonschema',
85         'netcdf4',
86         'numpy',
87         'psycopg2',
88         'pypeg2',
89         'python-dateutil',
90         'pyyaml',
91         'rasterio>=0.9a10',  # required for zip reading, 0.9 gets around 1.0a ordering problems
92         'singledispatch',
93         'sqlalchemy',
94         'xarray>=0.9',  # >0.9 fixes most problems with `crs` attributes being lost
95     ],
96     extras_require=extras_require,
97     tests_require=tests_require,
98 
99     entry_points={
100         'console_scripts': [
101             'datacube = datacube.scripts.cli_app:cli',
102             'datacube-search = datacube.scripts.search_tool:cli',
103             'datacube-stacker = datacube_apps.stacker:main',
104             'datacube-worker = datacube.execution.worker:main',
105             'datacube-fixer = datacube_apps.stacker:fixer_main',
106             'datacube-ncml = datacube_apps.ncml:ncml_app',
107             'pixeldrill = datacube_apps.pixeldrill:main [interactive]',
108             'movie_generator = datacube_apps.movie_generator:main',
109             'datacube-simple-replica = datacube_apps.simple_replica:replicate [replicas]'
110         ],
111         'datacube.plugins.io.read': [
112             'netcdf = datacube.drivers.netcdf.driver:reader_driver_init',
113             's3aio = datacube.drivers.s3.driver:reader_driver_init',
114             's3aio_test = datacube.drivers.s3.driver:reader_test_driver_init'
115         ],
116         'datacube.plugins.io.write': [
117             'netcdf = datacube.drivers.netcdf.driver:writer_driver_init',
118             's3aio = datacube.drivers.s3.driver:writer_driver_init',
119             's3aio_test = datacube.drivers.s3.driver:writer_test_driver_init',
120         ],
121         'datacube.plugins.index': [
122             'default = datacube.index.index:index_driver_init',
123             's3aio_index = datacube.drivers.s3aio_index:index_driver_init',
124         ],
125     },
126 )
127
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/datacube/drivers/driver_cache.py b/datacube/drivers/driver_cache.py
--- a/datacube/drivers/driver_cache.py
+++ b/datacube/drivers/driver_cache.py
@@ -2,7 +2,7 @@
 
 import logging
 
-from pkg_resources import iter_entry_points
+from pkg_resources import iter_entry_points, DistributionNotFound
 
 _LOG = logging.getLogger(__name__)
 
@@ -27,7 +27,11 @@
     def safe_load(ep):
         # pylint: disable=bare-except
         try:
-            driver_init = ep.resolve()
+            driver_init = ep.load()
+        except DistributionNotFound:
+            # This happens when entry points were marked with extra features,
+            # but extra feature were not requested for installation
+            return None
         except:
             _LOG.warning('Failed to resolve driver %s::%s', group, ep.name)
             return None
diff --git a/datacube/drivers/indexes.py b/datacube/drivers/indexes.py
--- a/datacube/drivers/indexes.py
+++ b/datacube/drivers/indexes.py
@@ -7,6 +7,10 @@
     def __init__(self, group):
         self._drivers = load_drivers(group)
 
+        if len(self._drivers) == 0:
+            from datacube.index.index import index_driver_init
+            self._drivers = dict(default=index_driver_init())
+
         for driver in list(self._drivers.values()):
             if hasattr(driver, 'aliases'):
                 for alias in driver.aliases:
@@ -17,8 +21,7 @@
         :returns: None if driver with a given name is not found
 
         :param str name: Driver name
-        :param str fmt: Dataset format
-        :return: Returns WriterDriver
+        :return: Returns IndexDriver
         """
         return self._drivers.get(name, None)
 
@@ -29,7 +32,7 @@
 
 
 def index_cache():
-    """ Singleton for WriterDriverCache
+    """ Singleton for IndexDriverCache
     """
     # pylint: disable=protected-access
     if not hasattr(index_cache, '_instance'):
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -2,6 +2,7 @@
 
 import versioneer
 from setuptools import setup, find_packages
+import os
 
 tests_require = [
     'compliance-checker',
@@ -29,6 +30,22 @@
 # An 'all' option, following ipython naming conventions.
 extras_require['all'] = sorted(set(sum(extras_require.values(), [])))
 
+extra_plugins = dict(read=[], write=[], index=[])
+
+if os.name != 'nt':
+    extra_plugins['read'].extend([
+        's3aio = datacube.drivers.s3.driver:reader_driver_init [s3]',
+        's3aio_test = datacube.drivers.s3.driver:reader_test_driver_init [s3]',
+    ])
+    extra_plugins['write'].extend([
+        's3aio = datacube.drivers.s3.driver:writer_driver_init [s3]',
+        's3aio_test = datacube.drivers.s3.driver:writer_test_driver_init [s3]',
+    ])
+
+    extra_plugins['index'].extend([
+        's3aio_index = datacube.drivers.s3aio_index:index_driver_init [s3]',
+    ])
+
 setup(
     name='datacube',
     version=versioneer.get_version(),
@@ -110,17 +127,15 @@
         ],
         'datacube.plugins.io.read': [
             'netcdf = datacube.drivers.netcdf.driver:reader_driver_init',
-            's3aio = datacube.drivers.s3.driver:reader_driver_init',
-            's3aio_test = datacube.drivers.s3.driver:reader_test_driver_init'
+            *extra_plugins['read'],
         ],
         'datacube.plugins.io.write': [
             'netcdf = datacube.drivers.netcdf.driver:writer_driver_init',
-            's3aio = datacube.drivers.s3.driver:writer_driver_init',
-            's3aio_test = datacube.drivers.s3.driver:writer_test_driver_init',
+            *extra_plugins['write'],
         ],
         'datacube.plugins.index': [
             'default = datacube.index.index:index_driver_init',
-            's3aio_index = datacube.drivers.s3aio_index:index_driver_init',
+            *extra_plugins['index'],
         ],
     },
 )

{"golden_diff": "diff --git a/datacube/drivers/driver_cache.py b/datacube/drivers/driver_cache.py\n--- a/datacube/drivers/driver_cache.py\n+++ b/datacube/drivers/driver_cache.py\n@@ -2,7 +2,7 @@\n \n import logging\n \n-from pkg_resources import iter_entry_points\n+from pkg_resources import iter_entry_points, DistributionNotFound\n \n _LOG = logging.getLogger(__name__)\n \n@@ -27,7 +27,11 @@\n     def safe_load(ep):\n         # pylint: disable=bare-except\n         try:\n-            driver_init = ep.resolve()\n+            driver_init = ep.load()\n+        except DistributionNotFound:\n+            # This happens when entry points were marked with extra features,\n+            # but extra feature were not requested for installation\n+            return None\n         except:\n             _LOG.warning('Failed to resolve driver %s::%s', group, ep.name)\n             return None\ndiff --git a/datacube/drivers/indexes.py b/datacube/drivers/indexes.py\n--- a/datacube/drivers/indexes.py\n+++ b/datacube/drivers/indexes.py\n@@ -7,6 +7,10 @@\n     def __init__(self, group):\n         self._drivers = load_drivers(group)\n \n+        if len(self._drivers) == 0:\n+            from datacube.index.index import index_driver_init\n+            self._drivers = dict(default=index_driver_init())\n+\n         for driver in list(self._drivers.values()):\n             if hasattr(driver, 'aliases'):\n                 for alias in driver.aliases:\n@@ -17,8 +21,7 @@\n         :returns: None if driver with a given name is not found\n \n         :param str name: Driver name\n-        :param str fmt: Dataset format\n-        :return: Returns WriterDriver\n+        :return: Returns IndexDriver\n         \"\"\"\n         return self._drivers.get(name, None)\n \n@@ -29,7 +32,7 @@\n \n \n def index_cache():\n-    \"\"\" Singleton for WriterDriverCache\n+    \"\"\" Singleton for IndexDriverCache\n     \"\"\"\n     # pylint: disable=protected-access\n     if not hasattr(index_cache, '_instance'):\ndiff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -2,6 +2,7 @@\n \n import versioneer\n from setuptools import setup, find_packages\n+import os\n \n tests_require = [\n     'compliance-checker',\n@@ -29,6 +30,22 @@\n # An 'all' option, following ipython naming conventions.\n extras_require['all'] = sorted(set(sum(extras_require.values(), [])))\n \n+extra_plugins = dict(read=[], write=[], index=[])\n+\n+if os.name != 'nt':\n+    extra_plugins['read'].extend([\n+        's3aio = datacube.drivers.s3.driver:reader_driver_init [s3]',\n+        's3aio_test = datacube.drivers.s3.driver:reader_test_driver_init [s3]',\n+    ])\n+    extra_plugins['write'].extend([\n+        's3aio = datacube.drivers.s3.driver:writer_driver_init [s3]',\n+        's3aio_test = datacube.drivers.s3.driver:writer_test_driver_init [s3]',\n+    ])\n+\n+    extra_plugins['index'].extend([\n+        's3aio_index = datacube.drivers.s3aio_index:index_driver_init [s3]',\n+    ])\n+\n setup(\n     name='datacube',\n     version=versioneer.get_version(),\n@@ -110,17 +127,15 @@\n         ],\n         'datacube.plugins.io.read': [\n             'netcdf = datacube.drivers.netcdf.driver:reader_driver_init',\n-            's3aio = datacube.drivers.s3.driver:reader_driver_init',\n-            's3aio_test = datacube.drivers.s3.driver:reader_test_driver_init'\n+            *extra_plugins['read'],\n         ],\n         'datacube.plugins.io.write': [\n             'netcdf = datacube.drivers.netcdf.driver:writer_driver_init',\n-            's3aio = datacube.drivers.s3.driver:writer_driver_init',\n-            's3aio_test = datacube.drivers.s3.driver:writer_test_driver_init',\n+            *extra_plugins['write'],\n         ],\n         'datacube.plugins.index': [\n             'default = datacube.index.index:index_driver_init',\n-            's3aio_index = datacube.drivers.s3aio_index:index_driver_init',\n+            *extra_plugins['index'],\n         ],\n     },\n )\n", "issue": "No index driver found for 'default'\nGreetings!\r\n\r\nUsing the latest Datacube version and libraries, indexing and ingestion runs well except when I try to access the database on Jupyter I get the \"No index driver found for 'default': 0 available: \" error.\r\n\r\n> RuntimeError                              Traceback (most recent call last)\r\n> ipython-input-2-f074b535470c> in <module>()\r\n>       1 \r\n>       2 import datacube\r\n> ----> 3 dc = datacube.Datacube(config='E:\\Datacubes\\datacube-core-develop\\datacube.conf')\r\n>       4 dc\r\n> \r\n> E:\\Datacubes\\datacube-core-develop\\datacube\\api\\core.py in __init__(self, index, config, app, env, validate_connection)\r\n>     116             index = index_connect(normalise_config(config),\r\n>     117                                   application_name=app,\r\n> --> 118                                   validate_connection=validate_connection)\r\n>     119 \r\n>     120         self.index = index\r\n> \r\n> E:\\Datacubes\\datacube-core-develop\\datacube\\index\\_api.py in index_connect(local_config, application_name, validate_connection)\r\n>      37         raise RuntimeError(\r\n>      38             \"No index driver found for %r. %s available: %s\" % (\r\n> ---> 39                 driver_name, len(index_drivers()), ', '.join(index_drivers())\r\n>      40             )\r\n>      41         )\r\n> \r\n> RuntimeError: No index driver found for 'default'. 0 available: \r\n\r\nI've reinstalled PostgreSQL and all libraries, to no avail.\r\nAll suggestions are welcome.\r\n\r\n**edit:** While ingestion I get this warning\r\n\r\n>  datacube.drivers.driver_cache WARNING Failed to resolve driver datacube.plugins.io.write::s3aio\r\n>  datacube.drivers.driver_cache WARNING Failed to resolve driver datacube.plugins.io.write::s3aio_test\r\n\r\nwhere do I update the driver from? Is it because of this plugin?\n", "before_files": [{"content": "from __future__ import absolute_import, print_function\n\nimport logging\n\nfrom pkg_resources import iter_entry_points\n\n_LOG = logging.getLogger(__name__)\n\n\ndef load_drivers(group):\n    \"\"\"\n    Load available drivers for a given group name.\n\n    Gracefully handles:\n\n     - Driver module not able to be imported\n     - Driver init function throwing an exception or returning None\n\n     By having driver entry_points pointing to a function, we defer loading the driver\n     module or running any code until required.\n\n    :param str group: Name of the entry point group e.g. \"datacube.plugins.io.read\"\n\n    :returns: Dictionary String -> Driver Object\n    \"\"\"\n\n    def safe_load(ep):\n        # pylint: disable=bare-except\n        try:\n            driver_init = ep.resolve()\n        except:\n            _LOG.warning('Failed to resolve driver %s::%s', group, ep.name)\n            return None\n\n        try:\n            driver = driver_init()\n        except:\n            _LOG.warning('Exception during driver init, driver name: %s::%s', group, ep.name)\n            return None\n\n        if driver is None:\n            _LOG.warning('Driver init returned None, driver name: %s::%s', group, ep.name)\n\n        return driver\n\n    def resolve_all(group):\n        for ep in iter_entry_points(group=group, name=None):\n            driver = safe_load(ep)\n            if driver is not None:\n                yield (ep.name, driver)\n\n    return dict((name, driver) for name, driver in resolve_all(group))\n", "path": "datacube/drivers/driver_cache.py"}, {"content": "from __future__ import absolute_import\n\nfrom .driver_cache import load_drivers\n\n\nclass IndexDriverCache(object):\n    def __init__(self, group):\n        self._drivers = load_drivers(group)\n\n        for driver in list(self._drivers.values()):\n            if hasattr(driver, 'aliases'):\n                for alias in driver.aliases:\n                    self._drivers[alias] = driver\n\n    def __call__(self, name):\n        \"\"\"\n        :returns: None if driver with a given name is not found\n\n        :param str name: Driver name\n        :param str fmt: Dataset format\n        :return: Returns WriterDriver\n        \"\"\"\n        return self._drivers.get(name, None)\n\n    def drivers(self):\n        \"\"\" Returns list of driver names\n        \"\"\"\n        return list(self._drivers.keys())\n\n\ndef index_cache():\n    \"\"\" Singleton for WriterDriverCache\n    \"\"\"\n    # pylint: disable=protected-access\n    if not hasattr(index_cache, '_instance'):\n        index_cache._instance = IndexDriverCache('datacube.plugins.index')\n    return index_cache._instance\n\n\ndef index_drivers():\n    \"\"\" Returns list driver names\n    \"\"\"\n    return index_cache().drivers()\n\n\ndef index_driver_by_name(name):\n    \"\"\" Lookup writer driver by name\n\n    :returns: Initialised writer driver instance\n    :returns: None if driver with this name doesn't exist\n    \"\"\"\n    return index_cache()(name)\n", "path": "datacube/drivers/indexes.py"}, {"content": "#!/usr/bin/env python\n\nimport versioneer\nfrom setuptools import setup, find_packages\n\ntests_require = [\n    'compliance-checker',\n    'hypothesis',\n    'mock',\n    'objgraph',\n    'pycodestyle',\n    'pylint',\n    'pytest',\n    'pytest-cov',\n    'pytest-timeout',\n]\n\nextras_require = {\n    'performance': ['ciso8601', 'bottleneck'],\n    'interactive': ['matplotlib', 'fiona'],\n    'distributed': ['distributed', 'dask[distributed]'],\n    'analytics': ['scipy', 'pyparsing', 'numexpr'],\n    'doc': ['Sphinx', 'setuptools'],\n    'replicas': ['paramiko', 'sshtunnel', 'tqdm'],\n    'celery': ['celery>=4', 'redis'],\n    's3': ['boto3==1.4.3', 'SharedArray', 'pathos', 'zstandard'],\n    'test': tests_require,\n}\n# An 'all' option, following ipython naming conventions.\nextras_require['all'] = sorted(set(sum(extras_require.values(), [])))\n\nsetup(\n    name='datacube',\n    version=versioneer.get_version(),\n    cmdclass=versioneer.get_cmdclass(),\n    python_requires='>=3.5.2',\n\n    url='https://github.com/opendatacube/datacube-core',\n    author='AGDC Collaboration',\n    maintainer='AGDC Collaboration',\n    maintainer_email='',\n    description='An analysis environment for satellite and other earth observation data',\n    long_description=open('README.rst').read(),\n    license='Apache License 2.0',\n    classifiers=[\n        \"Development Status :: 4 - Beta\",\n        \"Intended Audience :: Developers\",\n        \"Intended Audience :: Science/Research\",\n        \"License :: OSI Approved :: Apache Software License\",\n        \"Natural Language :: English\",\n        \"Operating System :: MacOS :: MacOS X\",\n        \"Operating System :: POSIX\",\n        \"Operating System :: POSIX :: BSD\",\n        \"Operating System :: POSIX :: Linux\",\n        \"Operating System :: Microsoft :: Windows\",\n        \"Programming Language :: Python\",\n        \"Programming Language :: Python :: 3\",\n        \"Programming Language :: Python :: 3.5\",\n        \"Programming Language :: Python :: 3.6\",\n        \"Topic :: Scientific/Engineering :: GIS\",\n        \"Topic :: Scientific/Engineering :: Information Analysis\",\n    ],\n\n    packages=find_packages(\n        exclude=('tests', 'tests.*',\n                 'integration_tests', 'integration_tests.*')\n    ),\n    package_data={\n        '': ['*.yaml', '*/*.yaml'],\n    },\n    scripts=[\n        'datacube_apps/scripts/pbs_helpers.sh'\n    ],\n    setup_requires=[\n        'pytest-runner'\n    ],\n    install_requires=[\n        'affine',\n        'cachetools',\n        'click>=5.0',\n        'cloudpickle>=0.4',\n        'dask[array]',\n        'gdal>=1.9',\n        'jsonschema',\n        'netcdf4',\n        'numpy',\n        'psycopg2',\n        'pypeg2',\n        'python-dateutil',\n        'pyyaml',\n        'rasterio>=0.9a10',  # required for zip reading, 0.9 gets around 1.0a ordering problems\n        'singledispatch',\n        'sqlalchemy',\n        'xarray>=0.9',  # >0.9 fixes most problems with `crs` attributes being lost\n    ],\n    extras_require=extras_require,\n    tests_require=tests_require,\n\n    entry_points={\n        'console_scripts': [\n            'datacube = datacube.scripts.cli_app:cli',\n            'datacube-search = datacube.scripts.search_tool:cli',\n            'datacube-stacker = datacube_apps.stacker:main',\n            'datacube-worker = datacube.execution.worker:main',\n            'datacube-fixer = datacube_apps.stacker:fixer_main',\n            'datacube-ncml = datacube_apps.ncml:ncml_app',\n            'pixeldrill = datacube_apps.pixeldrill:main [interactive]',\n            'movie_generator = datacube_apps.movie_generator:main',\n            'datacube-simple-replica = datacube_apps.simple_replica:replicate [replicas]'\n        ],\n        'datacube.plugins.io.read': [\n            'netcdf = datacube.drivers.netcdf.driver:reader_driver_init',\n            's3aio = datacube.drivers.s3.driver:reader_driver_init',\n            's3aio_test = datacube.drivers.s3.driver:reader_test_driver_init'\n        ],\n        'datacube.plugins.io.write': [\n            'netcdf = datacube.drivers.netcdf.driver:writer_driver_init',\n            's3aio = datacube.drivers.s3.driver:writer_driver_init',\n            's3aio_test = datacube.drivers.s3.driver:writer_test_driver_init',\n        ],\n        'datacube.plugins.index': [\n            'default = datacube.index.index:index_driver_init',\n            's3aio_index = datacube.drivers.s3aio_index:index_driver_init',\n        ],\n    },\n)\n", "path": "setup.py"}], "after_files": [{"content": "from __future__ import absolute_import, print_function\n\nimport logging\n\nfrom pkg_resources import iter_entry_points, DistributionNotFound\n\n_LOG = logging.getLogger(__name__)\n\n\ndef load_drivers(group):\n    \"\"\"\n    Load available drivers for a given group name.\n\n    Gracefully handles:\n\n     - Driver module not able to be imported\n     - Driver init function throwing an exception or returning None\n\n     By having driver entry_points pointing to a function, we defer loading the driver\n     module or running any code until required.\n\n    :param str group: Name of the entry point group e.g. \"datacube.plugins.io.read\"\n\n    :returns: Dictionary String -> Driver Object\n    \"\"\"\n\n    def safe_load(ep):\n        # pylint: disable=bare-except\n        try:\n            driver_init = ep.load()\n        except DistributionNotFound:\n            # This happens when entry points were marked with extra features,\n            # but extra feature were not requested for installation\n            return None\n        except:\n            _LOG.warning('Failed to resolve driver %s::%s', group, ep.name)\n            return None\n\n        try:\n            driver = driver_init()\n        except:\n            _LOG.warning('Exception during driver init, driver name: %s::%s', group, ep.name)\n            return None\n\n        if driver is None:\n            _LOG.warning('Driver init returned None, driver name: %s::%s', group, ep.name)\n\n        return driver\n\n    def resolve_all(group):\n        for ep in iter_entry_points(group=group, name=None):\n            driver = safe_load(ep)\n            if driver is not None:\n                yield (ep.name, driver)\n\n    return dict((name, driver) for name, driver in resolve_all(group))\n", "path": "datacube/drivers/driver_cache.py"}, {"content": "from __future__ import absolute_import\n\nfrom .driver_cache import load_drivers\n\n\nclass IndexDriverCache(object):\n    def __init__(self, group):\n        self._drivers = load_drivers(group)\n\n        if len(self._drivers) == 0:\n            from datacube.index.index import index_driver_init\n            self._drivers = dict(default=index_driver_init())\n\n        for driver in list(self._drivers.values()):\n            if hasattr(driver, 'aliases'):\n                for alias in driver.aliases:\n                    self._drivers[alias] = driver\n\n    def __call__(self, name):\n        \"\"\"\n        :returns: None if driver with a given name is not found\n\n        :param str name: Driver name\n        :return: Returns IndexDriver\n        \"\"\"\n        return self._drivers.get(name, None)\n\n    def drivers(self):\n        \"\"\" Returns list of driver names\n        \"\"\"\n        return list(self._drivers.keys())\n\n\ndef index_cache():\n    \"\"\" Singleton for IndexDriverCache\n    \"\"\"\n    # pylint: disable=protected-access\n    if not hasattr(index_cache, '_instance'):\n        index_cache._instance = IndexDriverCache('datacube.plugins.index')\n    return index_cache._instance\n\n\ndef index_drivers():\n    \"\"\" Returns list driver names\n    \"\"\"\n    return index_cache().drivers()\n\n\ndef index_driver_by_name(name):\n    \"\"\" Lookup writer driver by name\n\n    :returns: Initialised writer driver instance\n    :returns: None if driver with this name doesn't exist\n    \"\"\"\n    return index_cache()(name)\n", "path": "datacube/drivers/indexes.py"}, {"content": "#!/usr/bin/env python\n\nimport versioneer\nfrom setuptools import setup, find_packages\nimport os\n\ntests_require = [\n    'compliance-checker',\n    'hypothesis',\n    'mock',\n    'objgraph',\n    'pycodestyle',\n    'pylint',\n    'pytest',\n    'pytest-cov',\n    'pytest-timeout',\n]\n\nextras_require = {\n    'performance': ['ciso8601', 'bottleneck'],\n    'interactive': ['matplotlib', 'fiona'],\n    'distributed': ['distributed', 'dask[distributed]'],\n    'analytics': ['scipy', 'pyparsing', 'numexpr'],\n    'doc': ['Sphinx', 'setuptools'],\n    'replicas': ['paramiko', 'sshtunnel', 'tqdm'],\n    'celery': ['celery>=4', 'redis'],\n    's3': ['boto3==1.4.3', 'SharedArray', 'pathos', 'zstandard'],\n    'test': tests_require,\n}\n# An 'all' option, following ipython naming conventions.\nextras_require['all'] = sorted(set(sum(extras_require.values(), [])))\n\nextra_plugins = dict(read=[], write=[], index=[])\n\nif os.name != 'nt':\n    extra_plugins['read'].extend([\n        's3aio = datacube.drivers.s3.driver:reader_driver_init [s3]',\n        's3aio_test = datacube.drivers.s3.driver:reader_test_driver_init [s3]',\n    ])\n    extra_plugins['write'].extend([\n        's3aio = datacube.drivers.s3.driver:writer_driver_init [s3]',\n        's3aio_test = datacube.drivers.s3.driver:writer_test_driver_init [s3]',\n    ])\n\n    extra_plugins['index'].extend([\n        's3aio_index = datacube.drivers.s3aio_index:index_driver_init [s3]',\n    ])\n\nsetup(\n    name='datacube',\n    version=versioneer.get_version(),\n    cmdclass=versioneer.get_cmdclass(),\n    python_requires='>=3.5.2',\n\n    url='https://github.com/opendatacube/datacube-core',\n    author='AGDC Collaboration',\n    maintainer='AGDC Collaboration',\n    maintainer_email='',\n    description='An analysis environment for satellite and other earth observation data',\n    long_description=open('README.rst').read(),\n    license='Apache License 2.0',\n    classifiers=[\n        \"Development Status :: 4 - Beta\",\n        \"Intended Audience :: Developers\",\n        \"Intended Audience :: Science/Research\",\n        \"License :: OSI Approved :: Apache Software License\",\n        \"Natural Language :: English\",\n        \"Operating System :: MacOS :: MacOS X\",\n        \"Operating System :: POSIX\",\n        \"Operating System :: POSIX :: BSD\",\n        \"Operating System :: POSIX :: Linux\",\n        \"Operating System :: Microsoft :: Windows\",\n        \"Programming Language :: Python\",\n        \"Programming Language :: Python :: 3\",\n        \"Programming Language :: Python :: 3.5\",\n        \"Programming Language :: Python :: 3.6\",\n        \"Topic :: Scientific/Engineering :: GIS\",\n        \"Topic :: Scientific/Engineering :: Information Analysis\",\n    ],\n\n    packages=find_packages(\n        exclude=('tests', 'tests.*',\n                 'integration_tests', 'integration_tests.*')\n    ),\n    package_data={\n        '': ['*.yaml', '*/*.yaml'],\n    },\n    scripts=[\n        'datacube_apps/scripts/pbs_helpers.sh'\n    ],\n    setup_requires=[\n        'pytest-runner'\n    ],\n    install_requires=[\n        'affine',\n        'cachetools',\n        'click>=5.0',\n        'cloudpickle>=0.4',\n        'dask[array]',\n        'gdal>=1.9',\n        'jsonschema',\n        'netcdf4',\n        'numpy',\n        'psycopg2',\n        'pypeg2',\n        'python-dateutil',\n        'pyyaml',\n        'rasterio>=0.9a10',  # required for zip reading, 0.9 gets around 1.0a ordering problems\n        'singledispatch',\n        'sqlalchemy',\n        'xarray>=0.9',  # >0.9 fixes most problems with `crs` attributes being lost\n    ],\n    extras_require=extras_require,\n    tests_require=tests_require,\n\n    entry_points={\n        'console_scripts': [\n            'datacube = datacube.scripts.cli_app:cli',\n            'datacube-search = datacube.scripts.search_tool:cli',\n            'datacube-stacker = datacube_apps.stacker:main',\n            'datacube-worker = datacube.execution.worker:main',\n            'datacube-fixer = datacube_apps.stacker:fixer_main',\n            'datacube-ncml = datacube_apps.ncml:ncml_app',\n            'pixeldrill = datacube_apps.pixeldrill:main [interactive]',\n            'movie_generator = datacube_apps.movie_generator:main',\n            'datacube-simple-replica = datacube_apps.simple_replica:replicate [replicas]'\n        ],\n        'datacube.plugins.io.read': [\n            'netcdf = datacube.drivers.netcdf.driver:reader_driver_init',\n            *extra_plugins['read'],\n        ],\n        'datacube.plugins.io.write': [\n            'netcdf = datacube.drivers.netcdf.driver:writer_driver_init',\n            *extra_plugins['write'],\n        ],\n        'datacube.plugins.index': [\n            'default = datacube.index.index:index_driver_init',\n            *extra_plugins['index'],\n        ],\n    },\n)\n", "path": "setup.py"}]}