Repository: dask/dask (python)

Issue:
Removal of dask.compatibility.entry_points has broken dask-kubernetes
It looks like `dask.compatibility.entry_points` was removed in #10070 without warning. This was being used in `dask-kubernetes` so CI is now failing.

https://github.com/dask/dask-kubernetes/actions/runs/4499027159/jobs/7916366189?pr=683

cc @graingert @jrbourbeau 

Pull request description:
Restore Entrypoints compatibility
- [x] Closes #10112
- [x] Tests added / passed
- [x] Passes `pre-commit run --all-files`

Restored the test that was removed in #10070 and then imported `importlib_metadata.entry_point` to replace the old implementation. 

I added an extra commit that adds a deprecation warning so that this can be removed again in the future. But we can pop that commit off if we just want to leave it as it is.

Patch:
diff --git a/dask/compatibility.py b/dask/compatibility.py
index b156f60d0..b1b9e9bf6 100644
--- a/dask/compatibility.py
+++ b/dask/compatibility.py
@@ -1,7 +1,19 @@
 import sys
+import warnings
 
+from importlib_metadata import entry_points as _entry_points
 from packaging.version import parse as parse_version
 
 _PY_VERSION = parse_version(".".join(map(str, sys.version_info[:3])))
 
 _EMSCRIPTEN = sys.platform == "emscripten"
+
+
+def entry_points(group=None):
+    warnings.warn(
+        "`dask.compatibility.entry_points` has been replaced by `importlib_metadata.entry_points` and will be removed "
+        "in a future version. Please use `importlib_metadata.entry_points` instead.",
+        DeprecationWarning,
+        stacklevel=2,
+    )
+    return _entry_points(group=group)


Test patch:
diff --git a/dask/tests/test_compatibility.py b/dask/tests/test_compatibility.py
new file mode 100644
index 000000000..970013ca6
--- /dev/null
+++ b/dask/tests/test_compatibility.py
@@ -0,0 +1,8 @@
+import pytest
+
+from dask.compatibility import entry_points
+
+
+def test_entry_points():
+    with pytest.warns(DeprecationWarning):
+        assert "pytest" in [ep.name for ep in entry_points(group="console_scripts")]