diff --git a/.vscode/settings.json b/.vscode/settings.json index cabe1f45..82b9422d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,8 @@ { + "[python]": { + "editor.defaultFormatter": "charliermarsh.ruff", + "editor.formatOnSave": true + }, "[go]": { "editor.defaultFormatter": "golang.go", "editor.formatOnSave": true diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d5db7472..e6f56996 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -211,7 +211,7 @@ Following options are enabled: - The `-p no:warnings` option will suppress and allow warnings. ```sh -uv pip install pytest pytest-repeat numpy # for repeated fuzzy tests +uv pip install -e . --group tests # for repeated fuzzy tests python -m pytest # if you trust the default settings python -m pytest python/scripts/ -s -x -p no:warnings # to overwrite the default settings ``` @@ -219,8 +219,8 @@ python -m pytest python/scripts/ -s -x -p no:warnings # to overwrite the default Linting: ```sh -pip install ruff -ruff --format=github --select=E9,F63,F7,F82 --target-version=py310 python +uv pip install -e . --group lint +ruff --format=github python ``` Before merging your changes you may want to test your changes against the entire matrix of Python versions USearch supports. diff --git a/pyproject.toml b/pyproject.toml index 1d2eed5b..b871556a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -85,8 +85,27 @@ before-build = [ "git submodule update --init --recursive", ] -# Configuration options for the Black formatter: -# https://black.readthedocs.io/en/latest/usage_and_configuration/the_basics.html#where-black-looks-for-the-file -[tool.black] -line-length = 120 # Set line length to the same value as in `.clang-format` for modern wide screens -target-version = ['py36', 'py314'] +[dependency-groups] +lint = [ + "ruff>=0.15.8", +] +tests = [ + "numpy>=1.21", + "pytest>=9.0.2", + "pytest-repeat>=0.9.4", +] + +[tool.ruff] +line-length = 120 +target-version = "py310" + +[tool.ruff.format] +quote-style = "double" + +[tool.ruff.lint] +select = [ + "E9", + "F63", + "F7", + "F82", +]