From 439c0b62cd42921c81250bd75319059c4a3410c9 Mon Sep 17 00:00:00 2001 From: Roman Solomatin <36135455+Samoed@users.noreply.github.com> Date: Sun, 29 Mar 2026 13:26:24 +0300 Subject: [PATCH 1/3] update pyproject to include ruff rules directly and groups --- CONTRIBUTING.md | 6 +++--- pyproject.toml | 26 +++++++++++++++++++++----- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c4cfc937f..c69315086 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -214,7 +214,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 ``` @@ -222,8 +222,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 bdbf2ad4f..78afe30d1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -86,8 +86,24 @@ 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>=2.4.3", + "pytest>=9.0.2", + "pytest-repeat>=0.9.4", +] + +[tool.ruff] +target-version = "py310" + +[tool.ruff.lint] +select = [ + "E9", + "F63", + "F7", + "F82", +] From 68cfa47828e349c3431f92c32e7815b395ddb947 Mon Sep 17 00:00:00 2001 From: Ash Vardanian <1983160+ashvardanian@users.noreply.github.com> Date: Sun, 5 Apr 2026 12:59:39 +0000 Subject: [PATCH 2/3] Polish: Update build dep to numkong, loosen numpy, add line-length MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Build dependency: simsimd → numkong>=7.0.0 - Test dependency: numpy>=2.4.3 → numpy>=1.21 (less restrictive) - Ruff: add line-length = 120 to match .clang-format convention --- pyproject.toml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 78afe30d1..a0c1fad89 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,7 @@ requires = [ "cmake>=3.22", "pybind11", "numpy", - "simsimd>=6.0.5,<7.0.0", + "numkong>=7.0.0", ] build-backend = "setuptools.build_meta" @@ -92,12 +92,13 @@ lint = [ "ruff>=0.15.8", ] tests = [ - "numpy>=2.4.3", + "numpy>=1.21", "pytest>=9.0.2", "pytest-repeat>=0.9.4", ] [tool.ruff] +line-length = 120 target-version = "py310" [tool.ruff.lint] From 65cc2e1b7fe6a63b92eb41e35e466c8d737f88d9 Mon Sep 17 00:00:00 2001 From: Ash Vardanian <1983160+ashvardanian@users.noreply.github.com> Date: Sun, 5 Apr 2026 13:07:32 +0000 Subject: [PATCH 3/3] Polish: Consistent TOML formatting, ruff formatter config, VS Code - Normalize pyproject.toml formatting (2-space indent, sorted keys) - Add [tool.ruff.format] with quote-style = "double" for Black compat - Set VS Code default Python formatter to ruff - Bump numkong build dep to >=7.4.0 --- .vscode/settings.json | 4 +++ pyproject.toml | 69 ++++++++++++++++++++++--------------------- 2 files changed, 39 insertions(+), 34 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 01bccf2e2..5e5fdd4d9 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/pyproject.toml b/pyproject.toml index a0c1fad89..b871556ad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,30 +7,30 @@ # * for PyPy versions from 3.7 to 3.10. # = meaning 7 platforms * 11 Python versions = 77 builds. [build-system] +build-backend = "setuptools.build_meta" requires = [ - "setuptools>=42", - "wheel", - "cmake>=3.22", - "pybind11", - "numpy", - "numkong>=7.0.0", + "setuptools>=42", + "wheel", + "cmake>=3.22", + "pybind11", + "numpy", + "numkong>=7.4.0", ] -build-backend = "setuptools.build_meta" [tool.pytest.ini_options] -minversion = "6.0" addopts = "-ra --showlocals --strict-markers --strict-config -s -x -p no:warnings" -xfail_strict = true filterwarnings = ["error"] +minversion = "6.0" +xfail_strict = true # Avoid running tests, as everything is happening in a super slow container # We have already run all the relavent Python tests in `prerelease.yml` # test-requires = ["pytest", "numpy"] # test-command = "pytest {project}/python/scripts" [tool.cibuildwheel] -test-requires = [] -test-command = "" build-verbosity = 0 +test-command = "" +test-requires = [] # Add "pp*" to skip PyPy builds, but they should work fine these days :) # https://cibuildwheel.readthedocs.io/en/stable/options/#build-skip @@ -40,9 +40,9 @@ skip = [] [tool.cibuildwheel.linux] archs = ["x86_64", "aarch64"] before-build = [ - "rm -rf {project}/CMakeCache.txt {project}/build {project}/build_debug {project}/CMakeFiles.txt {project}/_deps {project}/.pytest_cache", - "mkdir -p build/usearch", - "git submodule update --init --recursive", + "rm -rf {project}/CMakeCache.txt {project}/build {project}/build_debug {project}/CMakeFiles.txt {project}/_deps {project}/.pytest_cache", + "mkdir -p build/usearch", + "git submodule update --init --recursive", ] repair-wheel-command = "auditwheel repair --lib-sdir . -w {dest_dir} {wheel}" @@ -51,10 +51,10 @@ repair-wheel-command = "auditwheel repair --lib-sdir . -w {dest_dir} {wheel}" # You can keep track of the most recent images on Quay: # - for `manylinux`: https://quay.io/search?q=manylinux # - for `musllinux`: https://quay.io/search?q=musllinux -manylinux-x86_64-image = "manylinux_2_28" manylinux-aarch64-image = "manylinux_2_28" -musllinux-x86_64-image = "musllinux_1_2" +manylinux-x86_64-image = "manylinux_2_28" musllinux-aarch64-image = "musllinux_1_2" +musllinux-x86_64-image = "musllinux_1_2" # On CentOS we have to use `yum`. # The healthy version would be: `apt-get update && apt-get install -y libc6-dev wget python3-dev`. @@ -64,47 +64,48 @@ before-all = ["yum update -y && yum install -y glibc-devel wget python3-devel"] # This may also be handy for using custom dependencies for different Python versions: # https://cibuildwheel.readthedocs.io/en/stable/options/#overrides [[tool.cibuildwheel.overrides]] -select = "*-musllinux*" before-all = "apk add --update wget python3-dev" +select = "*-musllinux*" [tool.cibuildwheel.macos] archs = ["x86_64", "universal2", "arm64"] before-build = [ - "rm -rf {project}/CMakeCache.txt {project}/build {project}/build_debug {project}/CMakeFiles.txt {project}/_deps {project}/.pytest_cache", - "mkdir -p build/usearch", - "git submodule update --init --recursive", - "export CC=$(echo CXX)", + "rm -rf {project}/CMakeCache.txt {project}/build {project}/build_debug {project}/CMakeFiles.txt {project}/_deps {project}/.pytest_cache", + "mkdir -p build/usearch", + "git submodule update --init --recursive", + "export CC=$(echo CXX)", ] repair-wheel-command = "delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}" - [tool.cibuildwheel.windows] archs = ["AMD64", "ARM64"] before-build = [ - "rd /s /q {project}\\CMakeCache.txt {project}\\build {project}\\build_debug {project}\\CMakeFiles.txt {project}\\_deps {project}\\.pytest_cache || echo Done", - "md build\\usearch", - "git submodule update --init --recursive", + "rd /s /q {project}\\CMakeCache.txt {project}\\build {project}\\build_debug {project}\\CMakeFiles.txt {project}\\_deps {project}\\.pytest_cache || echo Done", + "md build\\usearch", + "git submodule update --init --recursive", ] - [dependency-groups] lint = [ - "ruff>=0.15.8", + "ruff>=0.15.8", ] tests = [ - "numpy>=1.21", - "pytest>=9.0.2", - "pytest-repeat>=0.9.4", + "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", + "E9", + "F63", + "F7", + "F82", ]