Contributing to Zvec

April 3, 2026 ยท View on GitHub

First off, thank you for considering contributing to Zvec! ๐Ÿ™Œ
Whether you're reporting a bug, proposing a feature, improving documentation, or submitting code โ€” every contribution helps make Zvec better.

Code of Conduct

By participating, you agree to abide by our Code of Conduct. Please be respectful, collaborative, and inclusive.


Development Setup

Tip

Linux is the recommended environment for development and performance benchmarking.

Prerequisites

  • Python 3.10 - 3.14
  • CMake โ‰ฅ 3.26, < 4.0 (cmake --version)
  • A C++17-compatible compiler (e.g., g++-11+, clang++, Apple Clang on macOS)

Clone & Initialize

git clone --recursive https://github.com/alibaba/zvec.git
cd zvec

๐Ÿ’ก Tip

  • Forgot --recursive? Run:
    git submodule update --init --recursive
    
  • Set up pre-commit hooks:
    pip install pre-commit && pre-commit install
    

Build from Source (Editable Install)

pip install -e ".[dev]"
# This installs dev dependencies (pytest, ruff, etc.) and builds the C++ extension in-place

โœ… Verify:

python -c "import zvec; print('Success!')"

Testing

Run All Tests

pytest python/tests/ -v

Run with Coverage (Debug/CI)

pytest python/tests/ --cov=zvec --cov-report=term-missing

๐Ÿ”Ž See full rules in [tool.ruff] section of pyproject.toml.


Build Customization

You can control build behavior via environment variables or pyproject.toml:

OptionHow to SetDescription
Build TypeCMAKE_BUILD_TYPE=DebugDebug, Release, or Coverage (for gcov/lcov)
GeneratorCMAKE_GENERATOR="Unix Makefiles"Default: Ninja; use Make if preferred
AVX-512ENABLE_SKYLAKE_AVX512=ONEnable AVX-512 optimizations (x86_64 only)

Example (Debug + Make):

CMAKE_BUILD_TYPE=Debug CMAKE_GENERATOR="Unix Makefiles" pip install -v .

Submitting Changes

  1. Fork the repo and create a feature branch (feat/..., fix/..., docs/...)
  2. Write clear commit messages (e.g., fix(query): handle null vector in dense_fp32)
  3. Ensure tests pass & linter is clean
  4. Open a Pull Request to main
  5. Link related issue (e.g., Closes #123)

โœ… PRs should include:

  • Test coverage for new behavior
  • Updates to documentation (if applicable)
  • Reasoning behind non-obvious design choices

Documentation

  • User guides: docs/ (built with MkDocs)
  • API reference: generated from docstrings (follow Google style)
  • Build & deploy: mkdocs serve / mkdocs build

Need Help

  • Browse existing issues
  • For sensitive/security issues: email zvec@alibaba-inc.com

โœจ Thanks again for being part of Zvec!