Repository: yt-project/unyt

Issue:
BUG: (NEP 19) future incompatibility with numpy
### Description

Recently added implementations for `numpy.histogram*` functions are not compatible with the dev branch of numpy, as can be seen e.g. in https://github.com/yt-project/unyt/actions/runs/3357642144/jobs/5563592123

```
E       TypeError: histogram() got an unexpected keyword argument 'normed'
```

It seems to me that we could (should ?) make our NEP 19 implementations more stable to these upstream API changes by only capturing arguments we need to, and use catch-all signatures `(..., *args, **kwargs)` for everything else.

Discussion:

Patch:
diff --git a/pyproject.toml b/pyproject.toml
index 4bfc158..782ae94 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -33,7 +33,7 @@ write_to = "unyt/_version.py"
 version_scheme = "post-release"
 
 [tool.pytest.ini_options]
-addopts = "--ignore=benchmarks --ignore=paper --ignore=unyt/_mpl_array_converter"
+addopts = "--ignore=benchmarks --ignore=paper --ignore=unyt/_mpl_array_converter --color=yes"
 filterwarnings = [
     "error",
     "ignore:Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.:UserWarning",
diff --git a/unyt/_array_functions.py b/unyt/_array_functions.py
index 2e6e18b..8f15cf3 100644
--- a/unyt/_array_functions.py
+++ b/unyt/_array_functions.py
@@ -106,63 +106,31 @@ def histogram(
     a,
     bins=10,
     range=None,
-    normed=None,
-    weights=None,
-    density=None,
+    *args,
+    **kwargs,
 ):
     range = _sanitize_range(range, units=[a.units])
     counts, bins = np.histogram._implementation(
-        a.view(np.ndarray),
-        bins=bins,
-        range=range,
-        normed=normed,
-        weights=weights,
-        density=density,
+        a.view(np.ndarray), bins, range, *args, **kwargs
     )
     return counts, bins * a.units
 
 
 @implements(np.histogram2d)
-def histogram2d(
-    x,
-    y,
-    bins=10,
-    range=None,
-    normed=None,
-    weights=None,
-    density=None,
-):
+def histogram2d(x, y, bins=10, range=None, *args, **kwargs):
     range = _sanitize_range(range, units=[x.units, y.units])
     counts, xbins, ybins = np.histogram2d._implementation(
-        x.view(np.ndarray),
-        y.view(np.ndarray),
-        bins=bins,
-        range=range,
-        normed=normed,
-        weights=weights,
-        density=density,
+        x.view(np.ndarray), y.view(np.ndarray), bins, range, *args, **kwargs
     )
     return counts, xbins * x.units, ybins * y.units
 
 
 @implements(np.histogramdd)
-def histogramdd(
-    sample,
-    bins=10,
-    range=None,
-    normed=None,
-    weights=None,
-    density=None,
-):
+def histogramdd(sample, bins=10, range=None, *args, **kwargs):
     units = [_.units for _ in sample]
     range = _sanitize_range(range, units=units)
     counts, bins = np.histogramdd._implementation(
-        [_.view(np.ndarray) for _ in sample],
-        bins=bins,
-        range=range,
-        normed=normed,
-        weights=weights,
-        density=density,
+        [_.view(np.ndarray) for _ in sample], bins, range, *args, **kwargs
     )
     return counts, tuple(_bin * u for _bin, u in zip(bins, units))
 


Test patch:
diff --git a/unyt/tests/test_array_functions.py b/unyt/tests/test_array_functions.py
index 2c66fb9..de1c135 100644
--- a/unyt/tests/test_array_functions.py
+++ b/unyt/tests/test_array_functions.py
@@ -278,9 +278,9 @@ def get_wrapped_functions(*modules):
     wrapped_functions = {}
     for mod in modules:
         for name, f in mod.__dict__.items():
-            if f is np.printoptions:
-                continue
             if callable(f) and hasattr(f, "__wrapped__"):
+                if f is np.printoptions or f.__name__.startswith("_"):
+                    continue
                 wrapped_functions[mod.__name__ + "." + name] = f
     return dict(sorted(wrapped_functions.items()))