Files
alibaba--zvec/pyproject.toml
T
2026-07-13 12:47:42 +08:00

300 lines
9.3 KiB
TOML

######################################################################################################
# Zvec: High-Performance Vector Database with PyBind11 & C++ Backend
######################################################################################################
[project]
name = "zvec"
dynamic = ["version"]
description = "A high-performance vector database engine with native C++ backend and Python bindings"
readme = "README.md"
license = { text = "Apache-2.0" }
authors = [
{ name = "zvec", email = "zvec@alibaba-inc.com" },
]
maintainers = [
{ name = "Zvec Core Team", email = "zvec@alibaba-inc.com" },
]
requires-python = ">=3.9" # NOTE: Only 64-bit Python interpreters are supported.
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS",
"Programming Language :: C++",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Database",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Software Development :: Libraries :: Python Modules",
]
keywords = [
"vector-database", "ann", "nearest-neighbor"
]
dependencies = [
"numpy >=1.23",
]
[project.urls]
Homepage = "https://github.com/alibaba/zvec"
Repository = "https://github.com/alibaba/zvec"
"Bug Tracker" = "https://github.com/alibaba/zvec/issues"
"Documentation" = "https://zvec.org"
[project.optional-dependencies]
test = [
"pytest >=8.0",
"pytest-cov >=4.1",
"pytest-mock >=3.12",
"pytest-xdist >=3.5",
"cibuildwheel == 3.4.0",
]
docs = [
"mkdocs >=1.5",
"mkdocs-material >=9.5",
"mkdocstrings[python] >=0.24",
]
dev = [
"ruff >=0.4",
"black >=24.0",
"mypy >=1.8",
"pre-commit >=3.6",
"build >=1.0",
"twine >=4.0",
"numpy >=1.23",
# Inherit test deps
"pytest >=8.0",
"pytest-cov >=4.1",
"pytest-mock >=3.12",
"cibuildwheel == 3.4.0",
# Inherit docs deps
"mkdocs >=1.5",
"mkdocs-material >=9.5",
"mkdocstrings[python] >=0.24",
"pybind11-stubgen>=2.5.5",
"pybind11 >=3.0",
]
######################################################################################################
# BUILD SYSTEM CONFIGURATION (scikit-build-core)
######################################################################################################
[build-system]
requires = [
"scikit-build-core >=0.11",
"pybind11 >=3.0",
"setuptools_scm>=8.0",
"cmake>=3.26,<4.0",
"ninja>=1.11",
]
build-backend = "scikit_build_core.build"
[tool.scikit-build]
# Core settings
minimum-version = "0.11"
metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"
# CMake configuration
cmake.version = ">=3.26,<4.0"
ninja.version = ">=1.11"
cmake.build-type = "Release"
install.strip = true # Strip symbols in release builds to reduce wheel size
# Only pull the runtime artifacts tagged COMPONENT "python" into the wheel.
# This excludes the C++ SDK install rules (static/shared libs under lib/ and
# public headers under include/) that cc_library(PACKED) registers for a
# standalone `make install`, which would otherwise bloat the wheel.
install.components = ["python"]
# Build directory
build-dir = "build"
# Platform support
wheel.expand-macos-universal-tags = true
wheel.packages = ["python/zvec"]
# Source distribution
sdist.include = [
"README.md",
"LICENSE",
"pyproject.toml",
"CMakeLists.txt",
"src/**/*",
"stub/zvec/**/*",
"python/zvec/py.typed",
]
# CMake defines (env-overridable)
[tool.scikit-build.cmake.define]
BUILD_TOOLS = "OFF"
BUILD_PYTHON_BINDINGS = "ON"
#CMAKE_VERBOSE_MAKEFILE = "ON"
# Setuptools config for test pypi
[tool.setuptools_scm]
local_scheme = "no-local-version"
version_scheme = "guess-next-dev"
fallback_version = "0.0.0"
######################################################################################################
# TESTING & QUALITY
######################################################################################################
[tool.pytest.ini_options]
minversion = "8.0"
addopts = [
"-ra",
"--showlocals",
"--strict-markers",
"--strict-config",
"--tb=short",
"-n=auto",
]
xfail_strict = true
log_cli_level = "INFO"
filterwarnings = [
"error",
"ignore::pytest.PytestCacheWarning",
# Ignore numpy deprecation warnings in tests (if any)
"ignore:.*numpy.*:DeprecationWarning",
]
testpaths = ["python/tests"]
markers = [
"title: Custom marker for test title/description",
# "slow: marks tests as slow",
]
######################################################################################################
# BUILD WHEEL
######################################################################################################
[tool.cibuildwheel]
build = [
"cp310-*",
"cp311-*",
"cp312-*",
"cp313-*",
"cp314-*",
]
build-frontend = "build"
test-requires = ["pytest", "pytest-xdist", "numpy"]
test-command = "cd {project} && pytest python/tests -v --tb=short"
build-verbosity = 1
[tool.cibuildwheel.linux]
# libaio is required by the C++ backend; install it inside the manylinux
# container (manylinux_2_28 is AlmaLinux 8 based, so use dnf/libaio-devel).
# libaio-devel lives in BaseOS; disable EPEL so a flaky EPEL mirror cannot
# break metadata refresh.
before-all = "dnf install -y --disablerepo=epel libaio-devel"
archs = ["auto"]
environment = { CMAKE_GENERATOR = "Unix Makefiles", CMAKE_BUILD_PARALLEL_LEVEL = "16" }
manylinux-x86_64-image = "manylinux_2_28"
manylinux-aarch64-image = "manylinux_2_28"
# Skip 32-bit builds and musllinux
skip = ["*-manylinux_i686", "*-musllinux*"]
[tool.cibuildwheel.macos]
archs = ["arm64"]
# Inherits CMAKE_GENERATOR and CMAKE_BUILD_PARALLEL_LEVEL from [tool.cibuildwheel] won't work;
# platform-level environment overrides the top-level entirely, so all vars must be listed here
environment = { CMAKE_GENERATOR = "Unix Makefiles", CMAKE_BUILD_PARALLEL_LEVEL = "16", MACOSX_DEPLOYMENT_TARGET = "11.0" }
[tool.cibuildwheel.windows]
archs = ["auto64"]
test-command = "cd /d {project} && pytest python/tests -v --tb=short --basetemp=./.pytest_tmp"
environment = { CMAKE_GENERATOR = "Ninja" }
#config-settings = { build-dir = "build/{wheel_tag}" }
#&& if exist .pytest_tmp rmdir /s /q .pytest_tmp"
before-build = [
"python -c \"import shutil, glob, os; [shutil.rmtree(p, ignore_errors=True) for p in ['build', '.pytest_tmp']];\""
]
######################################################################################################
# CODE QUALITY & FORMATTING (Ruff)
######################################################################################################
[tool.ruff]
target-version = "py310"
line-length = 88
exclude = [
"build/",
"dist/",
".git/",
".venv/",
"venv/",
"thirdparty",
]
[tool.ruff.lint]
extend-select = [
"B", # flake8-bugbear
"I", # isort
"ARG", # flake8-unused-arguments
"C4", # flake8-comprehensions
"EM", # flake8-errmsg
"ICN", # flake8-import-conventions
"G", # flake8-logging-format
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PL", # pylint
"PT", # flake8-pytest-style
"PTH", # flake8-use-pathlib
"RET", # flake8-return
"RUF", # Ruff-specific
"SIM", # flake8-simplify
"T20", # flake8-print
"UP", # pyupgrade
"YTT", # flake8-2020
"EXE", # flake8-executable
"NPY", # NumPy-specific
"PD", # pandas-vet
]
ignore = [
"PLR0913", # Too many arguments (common in bindings)
"PLR2004", # Magic value used in comparison
"UP045", "UP007", # Use list() instead of [] (breaks C++ init)
"EM101", "EM102", # Exception messages as literals (ok in tests/utils)
"B008", # Mutable default args (cautiously allowed in config)
"E731", # Lambda assignment (used in callbacks)
"B019", # `functools.lru_cache` on methods (handled manually)
"PLR0912", # Too many branches
"PLC0105", # Ignore contravariant
"RUF002", # Ignore Unicode
]
fixable = ["ALL"]
unfixable = []
# Ignore all errors in docstrings
[tool.ruff.lint.pydocstyle]
convention = "google" # or "numpy", "pep257"
ignore-decorators = ["typing.overload"]
[tool.ruff.lint.flake8-type-checking]
# Don't check code examples in docstrings
quote-annotations = true
[tool.ruff.lint.isort]
required-imports = ["from __future__ import annotations"]
known-first-party = ["zvec"]
[tool.ruff.lint.per-file-ignores]
"python/tests/**" = ["ALL"]
"bench/core/**" = ["ALL"]
"python/zvec/__init__.py" = [
"F401", # Unused import (for __all__)
"E402", # Module level import not at top (C++ module init order)
"PLE0605", # Invalid format for __all__
"RUF022", # __all__ is not sorted
]
"python/zvec/model/doc.py" = [
"RUF023", # Unused sort (for __slot__)
]
"python/zvec/extension/**" = [
"PLC0415", # Import outside top-level (dynamic imports in _get_model)
]
[tool.ruff.format]
indent-style = "space"
quote-style = "double"
line-ending = "lf"
skip-magic-trailing-comma = false