prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Feature request: make netcdf4 dependency optional
  Right now netcdf4 library is a non-optional dependency of datacube, but it's use within the library is actually fairly limited. With deprecation of ingestion step and move towards cloud, netcdf data sources are becoming less relevant in many deployments of the datacube. netcdf4 is a rather heavy dependency both in terms of "disk used" and complexity of installation. Having lean dependency set is particularly beneficial for things like cloud deployments (AWS lambda layer limit is 250Mb for example).
  
  I believe that in the case of netdcf4 making it optional is relatively low cost and the benefit is significant. Ideally of course this would require automated testing across different python environments and that can be tricky and complex to setup, but we can start with just a manual test.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `setup.py`
  Content:
  ```
  1 #!/usr/bin/env python
  2 
  3 from setuptools import setup, find_packages
  4 
  5 tests_require = [
  6     'hypothesis',
  7     'pycodestyle',
  8     'pylint',
  9     'pytest',
  10     'pytest-cov',
  11     'pytest-timeout',
  12     'pytest-httpserver',
  13     'moto',
  14 ]
  15 doc_require = [
  16     'Sphinx',
  17     'sphinx_autodoc_typehints',  # Propagate mypy info into docs
  18     'sphinx-click',
  19     'recommonmark',
  20     'autodocsumm',
  21     'beautifulsoup4',
  22     'nbsphinx',
  23     'pydata-sphinx-theme==0.9.0',
  24 ]
  25 
  26 extras_require = {
  27     'performance': ['ciso8601', 'bottleneck'],
  28     'distributed': ['distributed', 'dask[distributed]'],
  29     'doc': doc_require,
  30     's3': ['boto3', 'botocore'],
  31     'test': tests_require,
  32     'cf': ['compliance-checker>=4.0.0'],
  33 }
  34 
  35 extras_require['dev'] = sorted(set(sum([extras_require[k] for k in [
  36     'test',
  37     'doc',
  38     'performance',
  39     's3',
  40     'distributed',
  41 ]], [])))
  42 
  43 # An 'all' option, following ipython naming conventions.
  44 extras_require['all'] = sorted(set(sum(extras_require.values(), [])))
  45 
  46 extra_plugins = dict(read=[], write=[], index=[])
  47 
  48 setup(
  49     name='datacube',
  50     python_requires='>=3.8.0',
  51 
  52     url='https://github.com/opendatacube/datacube-core',
  53     author='Open Data Cube',
  54     maintainer='Open Data Cube',
  55     maintainer_email='',
  56     description='An analysis environment for satellite and other earth observation data',
  57     long_description=open('README.rst').read(),
  58     long_description_content_type='text/x-rst',
  59     license='Apache License 2.0',
  60     classifiers=[
  61         "Development Status :: 4 - Beta",
  62         "Intended Audience :: Developers",
  63         "Intended Audience :: Science/Research",
  64         "License :: OSI Approved :: Apache Software License",
  65         "Natural Language :: English",
  66         "Operating System :: MacOS :: MacOS X",
  67         "Operating System :: POSIX",
  68         "Operating System :: POSIX :: BSD",
  69         "Operating System :: POSIX :: Linux",
  70         "Operating System :: Microsoft :: Windows",
  71         "Programming Language :: Python",
  72         "Programming Language :: Python :: 3",
  73         "Programming Language :: Python :: 3.8",
  74         "Programming Language :: Python :: 3.9",
  75         "Programming Language :: Python :: 3.10",
  76         "Topic :: Scientific/Engineering :: GIS",
  77         "Topic :: Scientific/Engineering :: Information Analysis",
  78     ],
  79 
  80     packages=find_packages(
  81         exclude=('tests', 'tests.*',
  82                  'integration_tests', 'integration_tests.*')
  83     ),
  84     package_data={
  85         '': ['*.yaml', '*/*.yaml'],
  86         'datacube': ['py.typed'],
  87     },
  88     scripts=[],
  89     install_requires=[
  90         'affine',
  91         'attrs>=18.1',
  92         'pyproj>=2.5',
  93         'shapely>=2.0',
  94         'cachetools',
  95         'click>=5.0',
  96         'cloudpickle>=0.4',
  97         'dask[array]',
  98         'distributed',
  99         'jsonschema',
  100         'netcdf4',
  101         'numpy',
  102         'psycopg2',
  103         'lark',
  104         'pandas',
  105         'python-dateutil',
  106         'pyyaml',
  107         'rasterio>=1.3.2',  # Warping broken in 1.3.0 and 1.3.1
  108         'ruamel.yaml',
  109         'sqlalchemy>=2.0',  # GeoAlchemy2 requires >=1.4.  SqlAlchemy2 *may* work but has not been tested yet.
  110         'GeoAlchemy2',
  111         'toolz',
  112         'xarray>=0.9',  # >0.9 fixes most problems with `crs` attributes being lost
  113         'packaging',
  114         'odc-geo',
  115         'deprecat',
  116     ],
  117     extras_require=extras_require,
  118     tests_require=tests_require,
  119 
  120     entry_points={
  121         'console_scripts': [
  122             'datacube = datacube.scripts.cli_app:cli',
  123             'datacube-search = datacube.scripts.search_tool:cli',
  124             'datacube-worker = datacube.execution.worker:main',
  125         ],
  126         'datacube.plugins.io.read': [
  127             'netcdf = datacube.drivers.netcdf.driver:reader_driver_init',
  128             *extra_plugins['read'],
  129         ],
  130         'datacube.plugins.io.write': [
  131             'netcdf = datacube.drivers.netcdf.driver:writer_driver_init',
  132             *extra_plugins['write'],
  133         ],
  134         'datacube.plugins.index': [
  135             'default = datacube.index.postgres.index:index_driver_init',
  136             'null = datacube.index.null.index:index_driver_init',
  137             'memory = datacube.index.memory.index:index_driver_init',
  138             'postgis = datacube.index.postgis.index:index_driver_init',
  139             *extra_plugins['index'],
  140         ],
  141     },
  142 )
  143
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/setup.py b/setup.py
  --- a/setup.py
  +++ b/setup.py
  @@ -30,6 +30,7 @@
       's3': ['boto3', 'botocore'],
       'test': tests_require,
       'cf': ['compliance-checker>=4.0.0'],
  +    'netcdf': ['netcdf4'],
   }
   
   extras_require['dev'] = sorted(set(sum([extras_require[k] for k in [
  @@ -38,6 +39,7 @@
       'performance',
       's3',
       'distributed',
  +    'netcdf',
   ]], [])))
   
   # An 'all' option, following ipython naming conventions.
  @@ -97,7 +99,6 @@
           'dask[array]',
           'distributed',
           'jsonschema',
  -        'netcdf4',
           'numpy',
           'psycopg2',
           'lark',
  
verification_info: {"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -30,6 +30,7 @@\n     's3': ['boto3', 'botocore'],\n     'test': tests_require,\n     'cf': ['compliance-checker>=4.0.0'],\n+    'netcdf': ['netcdf4'],\n }\n \n extras_require['dev'] = sorted(set(sum([extras_require[k] for k in [\n@@ -38,6 +39,7 @@\n     'performance',\n     's3',\n     'distributed',\n+    'netcdf',\n ]], [])))\n \n # An 'all' option, following ipython naming conventions.\n@@ -97,7 +99,6 @@\n         'dask[array]',\n         'distributed',\n         'jsonschema',\n-        'netcdf4',\n         'numpy',\n         'psycopg2',\n         'lark',\n", "issue": "Feature request: make netcdf4 dependency optional\nRight now netcdf4 library is a non-optional dependency of datacube, but it's use within the library is actually fairly limited. With deprecation of ingestion step and move towards cloud, netcdf data sources are becoming less relevant in many deployments of the datacube. netcdf4 is a rather heavy dependency both in terms of \"disk used\" and complexity of installation. Having lean dependency set is particularly beneficial for things like cloud deployments (AWS lambda layer limit is 250Mb for example).\r\n\r\nI believe that in the case of netdcf4 making it optional is relatively low cost and the benefit is significant. Ideally of course this would require automated testing across different python environments and that can be tricky and complex to setup, but we can start with just a manual test.\n", "before_files": [{"content": "#!/usr/bin/env python\n\nfrom setuptools import setup, find_packages\n\ntests_require = [\n    'hypothesis',\n    'pycodestyle',\n    'pylint',\n    'pytest',\n    'pytest-cov',\n    'pytest-timeout',\n    'pytest-httpserver',\n    'moto',\n]\ndoc_require = [\n    'Sphinx',\n    'sphinx_autodoc_typehints',  # Propagate mypy info into docs\n    'sphinx-click',\n    'recommonmark',\n    'autodocsumm',\n    'beautifulsoup4',\n    'nbsphinx',\n    'pydata-sphinx-theme==0.9.0',\n]\n\nextras_require = {\n    'performance': ['ciso8601', 'bottleneck'],\n    'distributed': ['distributed', 'dask[distributed]'],\n    'doc': doc_require,\n    's3': ['boto3', 'botocore'],\n    'test': tests_require,\n    'cf': ['compliance-checker>=4.0.0'],\n}\n\nextras_require['dev'] = sorted(set(sum([extras_require[k] for k in [\n    'test',\n    'doc',\n    'performance',\n    's3',\n    'distributed',\n]], [])))\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\nsetup(\n    name='datacube',\n    python_requires='>=3.8.0',\n\n    url='https://github.com/opendatacube/datacube-core',\n    author='Open Data Cube',\n    maintainer='Open Data Cube',\n    maintainer_email='',\n    description='An analysis environment for satellite and other earth observation data',\n    long_description=open('README.rst').read(),\n    long_description_content_type='text/x-rst',\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.8\",\n        \"Programming Language :: Python :: 3.9\",\n        \"Programming Language :: Python :: 3.10\",\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        'datacube': ['py.typed'],\n    },\n    scripts=[],\n    install_requires=[\n        'affine',\n        'attrs>=18.1',\n        'pyproj>=2.5',\n        'shapely>=2.0',\n        'cachetools',\n        'click>=5.0',\n        'cloudpickle>=0.4',\n        'dask[array]',\n        'distributed',\n        'jsonschema',\n        'netcdf4',\n        'numpy',\n        'psycopg2',\n        'lark',\n        'pandas',\n        'python-dateutil',\n        'pyyaml',\n        'rasterio>=1.3.2',  # Warping broken in 1.3.0 and 1.3.1\n        'ruamel.yaml',\n        'sqlalchemy>=2.0',  # GeoAlchemy2 requires >=1.4.  SqlAlchemy2 *may* work but has not been tested yet.\n        'GeoAlchemy2',\n        'toolz',\n        'xarray>=0.9',  # >0.9 fixes most problems with `crs` attributes being lost\n        'packaging',\n        'odc-geo',\n        'deprecat',\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-worker = datacube.execution.worker:main',\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.postgres.index:index_driver_init',\n            'null = datacube.index.null.index:index_driver_init',\n            'memory = datacube.index.memory.index:index_driver_init',\n            'postgis = datacube.index.postgis.index:index_driver_init',\n            *extra_plugins['index'],\n        ],\n    },\n)\n", "path": "setup.py"}], "after_files": [{"content": "#!/usr/bin/env python\n\nfrom setuptools import setup, find_packages\n\ntests_require = [\n    'hypothesis',\n    'pycodestyle',\n    'pylint',\n    'pytest',\n    'pytest-cov',\n    'pytest-timeout',\n    'pytest-httpserver',\n    'moto',\n]\ndoc_require = [\n    'Sphinx',\n    'sphinx_autodoc_typehints',  # Propagate mypy info into docs\n    'sphinx-click',\n    'recommonmark',\n    'autodocsumm',\n    'beautifulsoup4',\n    'nbsphinx',\n    'pydata-sphinx-theme==0.9.0',\n]\n\nextras_require = {\n    'performance': ['ciso8601', 'bottleneck'],\n    'distributed': ['distributed', 'dask[distributed]'],\n    'doc': doc_require,\n    's3': ['boto3', 'botocore'],\n    'test': tests_require,\n    'cf': ['compliance-checker>=4.0.0'],\n    'netcdf': ['netcdf4'],\n}\n\nextras_require['dev'] = sorted(set(sum([extras_require[k] for k in [\n    'test',\n    'doc',\n    'performance',\n    's3',\n    'distributed',\n    'netcdf',\n]], [])))\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\nsetup(\n    name='datacube',\n    python_requires='>=3.8.0',\n\n    url='https://github.com/opendatacube/datacube-core',\n    author='Open Data Cube',\n    maintainer='Open Data Cube',\n    maintainer_email='',\n    description='An analysis environment for satellite and other earth observation data',\n    long_description=open('README.rst').read(),\n    long_description_content_type='text/x-rst',\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.8\",\n        \"Programming Language :: Python :: 3.9\",\n        \"Programming Language :: Python :: 3.10\",\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        'datacube': ['py.typed'],\n    },\n    scripts=[],\n    install_requires=[\n        'affine',\n        'attrs>=18.1',\n        'pyproj>=2.5',\n        'shapely>=2.0',\n        'cachetools',\n        'click>=5.0',\n        'cloudpickle>=0.4',\n        'dask[array]',\n        'distributed',\n        'jsonschema',\n        'numpy',\n        'psycopg2',\n        'lark',\n        'pandas',\n        'python-dateutil',\n        'pyyaml',\n        'rasterio>=1.3.2',  # Warping broken in 1.3.0 and 1.3.1\n        'ruamel.yaml',\n        'sqlalchemy>=2.0',  # GeoAlchemy2 requires >=1.4.  SqlAlchemy2 *may* work but has not been tested yet.\n        'GeoAlchemy2',\n        'toolz',\n        'xarray>=0.9',  # >0.9 fixes most problems with `crs` attributes being lost\n        'packaging',\n        'odc-geo',\n        'deprecat',\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-worker = datacube.execution.worker:main',\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.postgres.index:index_driver_init',\n            'null = datacube.index.null.index:index_driver_init',\n            'memory = datacube.index.memory.index:index_driver_init',\n            'postgis = datacube.index.postgis.index:index_driver_init',\n            *extra_plugins['index'],\n        ],\n    },\n)\n", "path": "setup.py"}]}