Repository: pangeo-data/xESMF (language: python)

Issue:
Dependency refinement sparse, numba
Currently, xESMF simply depends on `sparse`, with no lower bound, and does not depend on `numba` explicitly.
In conda-forge/esmvaltool-suite-feedstock#5 we ran into a problem where that leads to `numba` missing because older `sparse` builds do not depend on it.

I suggest that xESMF depends on `numba` itself since it is used in `smm.py` and thus a direct dependency.
I also wonder if you want to place a lower bound on the `sparse` dependency?


Discussion / hints:
@zklaus that sounds like a good solution, what lower bound for `sparse` are you thinking of?
@raphaeldussin, I don't know about the lower bound on `sparse`. My thinking was that a lower bound on sparse might pull in numba automatically, but also, I know that sparse has undergone substantial development and I am not sure which version is the oldest that you have done your tests with.

If you add the numba dependency (as I think you should because you are using it directly), there is no technical need for a lower bound on sparse. But if you know or suspect that you need a certain maturity from sparse, you may still consider it.

Fix patch:
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 87c99fc0..ebb2dfd8 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,6 +1,6 @@
 repos:
   - repo: https://github.com/pre-commit/pre-commit-hooks
-    rev: v4.1.0
+    rev: v4.2.0
     hooks:
       - id: trailing-whitespace
       - id: end-of-file-fixer
@@ -10,7 +10,7 @@ repos:
       - id: double-quote-string-fixer
 
   - repo: https://github.com/psf/black
-    rev: 21.12b0
+    rev: 22.3.0
     hooks:
       - id: black
 
@@ -34,7 +34,7 @@ repos:
       - id: isort
 
   - repo: https://github.com/pre-commit/mirrors-prettier
-    rev: v2.5.1
+    rev: v2.6.2
     hooks:
       - id: prettier
 
diff --git a/ci/environment-upstream-dev.yml b/ci/environment-upstream-dev.yml
index 3796edf8..8f1aeabe 100644
--- a/ci/environment-upstream-dev.yml
+++ b/ci/environment-upstream-dev.yml
@@ -6,13 +6,14 @@ dependencies:
   - codecov
   - dask
   - esmpy
+  - numba
   - numpy
   - pip
   - pre-commit
   - pydap
   - pytest
   - pytest-cov
-  - sparse
+  - sparse>=0.8.0
   - pip:
       - git+https://github.com/pydata/xarray.git
       - git+https://github.com/xarray-contrib/cf-xarray.git
diff --git a/ci/environment.yml b/ci/environment.yml
index c19729aa..b596fcaa 100644
--- a/ci/environment.yml
+++ b/ci/environment.yml
@@ -7,6 +7,7 @@ dependencies:
   - codecov
   - dask
   - esmpy
+  - numba
   - numpy
   - pip
   - pre-commit
@@ -14,5 +15,5 @@ dependencies:
   - pytest
   - pytest-cov
   - shapely
-  - sparse
+  - sparse>=0.8.0
   - xarray>=0.17.0
diff --git a/setup.py b/setup.py
index 35aa7605..5701795a 100644
--- a/setup.py
+++ b/setup.py
@@ -26,7 +26,8 @@
         'numpy>=1.16',
         'shapely',
         'cf-xarray>=0.5.1',
-        'sparse',
+        'sparse>=0.8.0',
+        'numba',
     ]
 
 CLASSIFIERS = [


Test patch:
diff --git a/xesmf/tests/test_frontend.py b/xesmf/tests/test_frontend.py
index ed668cc2..47516e93 100644
--- a/xesmf/tests/test_frontend.py
+++ b/xesmf/tests/test_frontend.py
@@ -327,8 +327,8 @@ def test_regrid_with_1d_grid():
 
 
 def test_regrid_with_1d_grid_infer_bounds():
-    ds_in_1d = ds_2d_to_1d(ds_in).rename(x='lon', y='lat')
-    ds_out_1d = ds_2d_to_1d(ds_out).rename(x='lon', y='lat')
+    ds_in_1d = ds_2d_to_1d(ds_in).swap_dims(x='lon', y='lat')
+    ds_out_1d = ds_2d_to_1d(ds_out).swap_dims(x='lon', y='lat')
 
     regridder = xe.Regridder(ds_in_1d, ds_out_1d, 'conservative', periodic=True)