Repository: dask/dask

Issue:
Add a dummy .copy() method on dask arrays?
There's no need to copy the data in dask arrays, because they're (currently) immutable. Still, it's common to copy numpy arrays to be on the safe side, so it might be nice to add this for duck-array compatibility.

Discussion:

Patch:
diff --git a/dask/array/core.py b/dask/array/core.py
index b85b5c2c0..a6e10cc55 100644
--- a/dask/array/core.py
+++ b/dask/array/core.py
@@ -1377,6 +1377,12 @@ class Array(Base):
         out._chunks = chunks
         return out
 
+    def copy(self):
+        """
+        Copy array.  This is a no-op for dask.arrays, which are immutable
+        """
+        return self
+
     def to_imperative(self):
         """ Convert Array into dask Values
 


Test patch:
diff --git a/dask/array/tests/test_array_core.py b/dask/array/tests/test_array_core.py
index f75b85ee5..1351bff05 100644
--- a/dask/array/tests/test_array_core.py
+++ b/dask/array/tests/test_array_core.py
@@ -2003,3 +2003,8 @@ def test_atop_names():
 def test_A_property():
     x = da.ones(5, chunks=(2,))
     assert x.A is x
+
+
+def test_copy():
+    x = da.ones(5, chunks=(2,))
+    assert x.copy() is x