Skip to content

feat(diskann): expose Python update APIs - #105

Merged
huanglune merged 1 commit into
AlayaDB-AI:mainfrom
ScissorJack-ever:feat/python-update-api
Jul 22, 2026
Merged

feat(diskann): expose Python update APIs#105
huanglune merged 1 commit into
AlayaDB-AI:mainfrom
ScissorJack-ever:feat/python-update-api

Conversation

@ScissorJack-ever

Copy link
Copy Markdown
Contributor

Description

Expose the standalone updatable DiskANN index through Python bindings.

Python callers can build, load, search, insert, and remove vectors using external IDs only. External-ID deletion resolves the corresponding internal slot and reuses the existing internal deletion implementation.

Related Issue

N/A

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Performance improvement
  • Code refactoring
  • Documentation update
  • CI/CD changes

Changes Made

  • Add the alayalite.diskann Python module with build, load, search, insert, batch insert, remove, batch remove, contains, and flush APIs.
  • Maintain a live external-ID-to-internal-slot mapping for updatable DiskANN indexes.
  • Resolve external IDs before deletion and reuse the shared internal single and batch deletion implementations.
  • Validate reserved, duplicate, and unknown external IDs before mutating the index.
  • Rebuild the external-ID mapping when loading an updatable index and keep it synchronized across insertion, deletion, slot reuse, flush, and reload.
  • Convert missing external IDs to Python KeyError.
  • Add C++ and Python coverage for external-ID updates, validation atomicity, slot reuse, and persistence.

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
/tmp/alayalite-python-update-build/tests/diskann/test_diskann_index

ALAYA_DISKANN_UPDATE_IO=blocking \
  /tmp/alayalite-python-update-build/tests/diskann/test_diskann_update_e2e

PYTHONPATH=/tmp/alayalite-python-update-build/python:python/src \
  .venv/bin/python -c \
  "import sys, _alayalitepy; sys.modules['alayalite._alayalitepy'] = _alayalitepy; import pytest; raise SystemExit(pytest.main(['-q', 'python/tests/diskann/test_update.py']))"

Results:

  • DiskANN C++ unit tests: 16 passed
  • DiskANN update E2E tests: 23 passed
  • Python DiskANN update tests: 4 passed
  • Commit-time lint, formatting, license, and static checks passed

Checklist

  • My code follows the project's coding style
  • I have run make lint and fixed any issues
  • I have added tests that prove my fix/feature works
  • All new and existing tests pass (make test)
  • I have updated documentation if needed
  • My commits follow the conventional commits (https://www.conventionalcommits.org/) format

Additional Notes

The Python update API intentionally exposes external IDs only. Internal slot IDs remain an implementation detail of the C++ index.

@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@huanglune
huanglune merged commit 2eaa79d into AlayaDB-AI:main Jul 22, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants