Repository: pydata/sparse

Issue:
Update Numba Imports
After Numba's internal refactoring, many modules have changed location. This triggers many DeprecationWarnings in sparse (even when not running it, since there's a registration hook), and it will fail in v0.50

**System**
 - OS and version: linux
 - `sparse` version 0.9.1
 - NumPy version 1.18.1
 - Numba version 0.49




Discussion:

Patch:
diff --git a/.gitignore b/.gitignore
index c498256..e34c16a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -69,6 +69,7 @@ target/
 # IDE
 .idea/
 .vscode/
+default.profraw
 
 # Sandbox
 sandbox.py
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 46b7295..1f94a33 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -1,32 +1,32 @@
 jobs:
 - job: Linux
   variables:
-    python_version: '3.5'
+    python_version: '3.6'
   pool:
     vmImage: 'ubuntu-16.04'
   steps:
     - template: ci/azure-steps.yml
   strategy:
     matrix:
+        Python38:
+          python_version: '3.8'
         Python37:
           python_version: '3.7'
         Python36:
           python_version: '3.6'
-        Python35:
-          python_version: '3.5'
         ArrayFunction:
           NUMPY_EXPERIMENTAL_ARRAY_FUNCTION: '1'
           NUMPY_VERSION: '==1.16.2'
 - job: MacOS
   variables:
-    python_version: '3.5'
+    python_version: '3.6'
   pool:
     vmImage: 'macos-10.14'
   steps:
     - template: ci/azure-steps.yml
 - job: Windows
   variables:
-    python_version: '3.5'
+    python_version: '3.6'
   pool:
     vmImage: 'vs2017-win2016'
   steps:
diff --git a/ci/azure-steps.yml b/ci/azure-steps.yml
index bae51f7..7ca8074 100644
--- a/ci/azure-steps.yml
+++ b/ci/azure-steps.yml
@@ -26,3 +26,4 @@ steps:
     inputs:
       codeCoverageTool: Cobertura
       summaryFileLocation: "$(System.DefaultWorkingDirectory)/**/coverage.xml"
+      reportDirectory: "$(System.DefaultWorkingDirectory)/**/htmlcov"
diff --git a/ci/environment-3.8.yml b/ci/environment-3.8.yml
new file mode 100644
index 0000000..5a28cf9
--- /dev/null
+++ b/ci/environment-3.8.yml
@@ -0,0 +1,16 @@
+name: py38-sparse-test
+channels:
+  - conda-forge
+dependencies:
+  - python=3.8
+  - pip
+  - pytest
+  - numpy
+  - scipy
+  - pytest-cov
+  - nomkl
+  - numba
+  - black
+  - codecov
+  - pip:
+    - pytest-black
diff --git a/docs/conf.py b/docs/conf.py
index 7e636ef..8889706 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -95,6 +95,7 @@ pygments_style = "sphinx"
 todo_include_todos = False
 
 autosummary_generate = True
+autosummary_generate_overwrite = False
 
 # -- Options for HTML output ----------------------------------------------
 
diff --git a/requirements.txt b/requirements.txt
index 79e2f39..4679d2f 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,3 +1,3 @@
 numpy
 scipy>=0.19
-numba>=0.45
+numba>=0.49
diff --git a/setup.py b/setup.py
index 5b02446..f177cef 100755
--- a/setup.py
+++ b/setup.py
@@ -59,9 +59,9 @@ setup(
         "License :: OSI Approved :: BSD License",
         "Programming Language :: Python",
         "Programming Language :: Python :: 3",
-        "Programming Language :: Python :: 3.5",
         "Programming Language :: Python :: 3.6",
         "Programming Language :: Python :: 3.7",
+        "Programming Language :: Python :: 3.8",
         "Programming Language :: Python :: 3 :: Only",
         "Intended Audience :: Developers",
         "Intended Audience :: Science/Research",
@@ -74,5 +74,5 @@ setup(
     entry_points={
         "numba_extensions": ["init = sparse._numba_extension:_init_extension"]
     },
-    python_requires=">=3.5, <4",
+    python_requires=">=3.6, <4",
 )
diff --git a/sparse/_coo/common.py b/sparse/_coo/common.py
index 3dee087..88ae5d4 100644
--- a/sparse/_coo/common.py
+++ b/sparse/_coo/common.py
@@ -124,9 +124,6 @@ def tensordot(a, b, axes=2):
     bs = b.shape
     ndb = b.ndim
     equal = True
-    if nda == 0 or ndb == 0:
-        pos = int(nda != 0)
-        raise ValueError("Input {} operand does not have enough dimensions".format(pos))
     if na != nb:
         equal = False
     else:
@@ -1148,7 +1145,7 @@ def _dot_coo_coo_type(dt1, dt2):
     @numba.jit(
         nopython=True,
         nogil=True,
-        locals={"data_curr": numba.numpy_support.from_dtype(dtr)},
+        locals={"data_curr": numba.np.numpy_support.from_dtype(dtr)},
     )
     def _dot_coo_coo(coords1, data1, coords2, data2):  # pragma: no cover
         """
diff --git a/sparse/_coo/numba_extension.py b/sparse/_coo/numba_extension.py
index 5153edd..48f0af0 100644
--- a/sparse/_coo/numba_extension.py
+++ b/sparse/_coo/numba_extension.py
@@ -14,9 +14,9 @@ from numba.extending import (
     make_attribute_wrapper,
     type_callable,
 )
-from numba.targets.imputils import impl_ret_borrowed, lower_constant, lower_builtin
-from numba.typing.typeof import typeof_impl
-from numba import cgutils, types
+from numba.core.imputils import impl_ret_borrowed, lower_constant, lower_builtin
+from numba.core.typing.typeof import typeof_impl
+from numba.core import cgutils, types
 from sparse._utils import _zero_of_dtype
 import contextlib
 
@@ -83,8 +83,8 @@ def type_COO(context):
     # TODO: accept a fill_value kwarg
     def typer(coords, data, shape):
         return COOType(
-            coords_dtype=numba.numpy_support.as_dtype(coords.dtype),
-            data_dtype=numba.numpy_support.as_dtype(data.dtype),
+            coords_dtype=numba.np.numpy_support.as_dtype(coords.dtype),
+            data_dtype=numba.np.numpy_support.as_dtype(data.dtype),
             ndim=len(shape),
         )
 


Test patch:
diff --git a/sparse/tests/test_coo.py b/sparse/tests/test_coo.py
index 48f8f52..c8c50f4 100644
--- a/sparse/tests/test_coo.py
+++ b/sparse/tests/test_coo.py
@@ -343,14 +343,6 @@ def test_tensordot_empty():
     assert_eq(np.tensordot(x1, x2), sparse.tensordot(s1, s2))
 
 
-def test_tensordot_valueerror():
-    x1 = sparse.COO(np.array(1))
-    x2 = sparse.COO(np.array(1))
-
-    with pytest.raises(ValueError):
-        x1 @ x2
-
-
 @pytest.mark.parametrize(
     "a_shape, b_shape",
     [