spotify / voyager

🛰️ An approximate nearest-neighbor search library for Python and Java with a focus on ease of use, simplicity, and deployability.
https://spotify.github.io/voyager/
Apache License 2.0
1.26k stars 51 forks source link

Add tox to python review actions and fix formatting #42

Closed markkohdev closed 9 months ago

markkohdev commented 9 months ago

I noticed that we're not running tox during our github actions? When I run tox -e check-formatting locally it's failing black formatting checks

$ tox -e check-formatting
check-formatting: commands[0]> black tests --diff --check
--- /Users/markkoh/spotify/voyager/python/tests/test_index_recreation.py    2023-11-10 17:53:56.849930+00:00
+++ /Users/markkoh/spotify/voyager/python/tests/test_index_recreation.py    2023-11-10 17:54:05.819796+00:00
@@ -36,20 +36,26 @@
     [voyager.Space.Euclidean, voyager.Space.Cosine],
     ids=lambda x: x.name if hasattr(x, "name") else str(x),
 )
 @pytest.mark.parametrize(
     "storage_data_type",
-    [voyager.StorageDataType.E4M3, voyager.StorageDataType.Float8, voyager.StorageDataType.Float32],
+    [
....
....
....
Oh no! 💥 💔 💥
4 files would be reformatted, 2 files would be left unchanged.
check-formatting: exit 1 (0.48 seconds) /Users/markkoh/spotify/voyager/python> black tests --diff --check pid=26135
  check-formatting: FAIL code 1 (0.53=setup[0.05]+cmd[0.48] seconds)
  evaluation failed :( (0.63 seconds)

This PR adds a github action to run tox during review and master builds.

Additionally, this PR aligns black with our flake8 configuration of 120 char line length and reformats files as necessary

markkohdev commented 9 months ago

(closed this because a bad commit got stuck in the branch)