Repository: probabl-ai/skore

Issue:
bug: `skore.show_versions()` does not show `scikit-learn`'s version
When running `skore.show_versions()`, the result is:

```
System:
    python: 3.12.5 (main, Aug  6 2024, 19:08:49) [Clang 15.0.0 (clang-1500.3.9.4)]
executable: /Users/camille/Hacque/probabl/internal_demos/.direnv/python-3.12/bin/python
   machine: macOS-15.2-arm64-arm-64bit

Python dependencies:
        skore: 0.5.0
          pip: 24.2
   setuptools: None
    diskcache: 5.6.3
      fastapi: 0.115.6
 plotly<6,>=5: None
      pyarrow: 18.1.0
         rich: 13.9.4
scikit-learn<1.7: None
        skops: 0.11.0
      uvicorn: 0.34.0
```

Since we are controlling the upper bound version for `scikit-learn`, the procedure fails to parse the actual version number.  
Same goes for plotly, no version is displayed.  

Discussion:

Patch:
diff --git a/skore/src/skore/utils/_show_versions.py b/skore/src/skore/utils/_show_versions.py
index bfac999..c61bc94 100644
--- a/skore/src/skore/utils/_show_versions.py
+++ b/skore/src/skore/utils/_show_versions.py
@@ -6,6 +6,7 @@ adapted from :func:`sklearn.show_versions`
 
 import importlib
 import platform
+import re
 import sys
 
 
@@ -47,7 +48,9 @@ def _get_deps_info():
 
     requirements = importlib.metadata.requires("skore")
     for requirement in filter(lambda r: "; extra" not in r, requirements):
-        deps.append(requirement)
+        # Extract just the package name before any version specifiers
+        package_name = re.split(r"[<>=~!]", requirement)[0].strip()
+        deps.append(package_name)
 
     deps_info = {
         "skore": version("skore"),


Test patch:
diff --git a/skore/tests/unit/utils/test_show_versions.py b/skore/tests/unit/utils/test_show_versions.py
index 634db9d..f8c10b8 100644
--- a/skore/tests/unit/utils/test_show_versions.py
+++ b/skore/tests/unit/utils/test_show_versions.py
@@ -18,11 +18,28 @@ def test_get_deps_info():
 
 
 def test_show_versions(capfd):
+    """Check that we have the expected packages in the output of `show_versions()`.
+
+    We use `:` in the assertion to be sure that we are robust to package
+    version specifiers.
+
+    Non-regression test for:
+    https://github.com/probabl-ai/skore/issues/987
+    """
     show_versions()
     captured = capfd.readouterr()
-    assert "python" in captured.out
-    assert "executable" in captured.out
-    assert "machine" in captured.out
-    assert "pip" in captured.out
-    assert "setuptools" in captured.out
-    assert "skore" in captured.out
+    assert "python:" in captured.out
+    assert "executable:" in captured.out
+    assert "machine:" in captured.out
+    assert "skore:" in captured.out
+    assert "pip:" in captured.out
+    assert "setuptools:" in captured.out
+    assert "diskcache:" in captured.out
+    assert "fastapi:" in captured.out
+    assert "numpy:" in captured.out
+    assert "plotly:" in captured.out
+    assert "pyarrow:" in captured.out
+    assert "rich:" in captured.out
+    assert "scikit-learn:" in captured.out
+    assert "skops:" in captured.out
+    assert "uvicorn:" in captured.out