All notable changes to the SochDB Python SDK will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
-
insert()now writes to KV store — previouslyinsert()only populated the in-memory HNSW index, leaving single-vector inserts invisible tokeyword_search(),hybrid_search(), and the FFI BM25 path. Docs are now persisted to the KV store using the same JSON schema asinsert_multi(). -
insert_batch()now writes to KV store — same issue asinsert(). Batch-inserted documents were not written to KV, so any follow-up keyword or hybrid search would miss them. All docs in a batch are now written in a single atomic transaction. -
Python BM25 fallback now uses proper BM25 formula — the fallback
_keyword_search()(used when the native FFI call returnsNone) previously scored documents by raw term-frequency count with no IDF weighting and no length normalisation. It now implements the Robertson–Spärck Jones BM25 formula (k1=1.2, b=0.75 — Lucene / Elasticsearch defaults), matching the behaviour of the native Rustbm25.rsimplementation.
- Version bump aligned with SochDB core 0.5.0
- Version bump aligned with SochDB core 0.4.9
- Added Engine Internals status table to README (§4 Architecture Overview)
- Cost-based optimizer documented as production-ready
- Adaptive group commit documented as implemented
- WAL compaction documented as partially implemented
- Added missing
QuantizationTypeexport to__init__.py
A complete memory management system for AI agents with FFI/gRPC dual-mode support:
Extraction Pipeline (sochdb.memory.extraction):
Entity,Relation,Assertiontyped intermediate representationExtractionSchemafor validation with type constraints and confidence thresholdsExtractionPipelinewith atomic commits- Deterministic ID generation via content hashing
Event-Sourced Consolidation (sochdb.memory.consolidation):
RawAssertionimmutable events (append-only, never deleted)CanonicalFactderived view (merged, deduplicated)UnionFindclustering with O(α(n)) operations- Temporal interval updates for contradictions (not destructive edits)
- Full provenance tracking with
explain()method
Hybrid Retrieval (sochdb.memory.retrieval):
AllowedSetfor pre-filtering (security invariant: Results ⊆ allowed_set)- RRF fusion leveraging SochDB's built-in implementation
- Optional cross-encoder reranking support
HybridRetrieverwithexplain()for ranking debugging
Namespace Isolation (sochdb.memory.isolation):
NamespaceIdstrongly-typed identifier with validationScopedQueryfor type-level safety guaranteesNamespaceGrantfor explicit, auditable cross-namespace accessScopedNamespacewith full audit loggingNamespaceManagerfor namespace lifecycle management- Policy modes:
STRICT,EXPLICIT,AUDIT_ONLY
All modules include:
- FFI backend (embedded mode)
- gRPC backend (server mode)
- In-memory backend (testing)
- Factory functions with auto-detection
- Added comprehensive Memory System section (Section 18) to README
- Full API documentation with usage examples
- Updated Table of Contents
- Platform detection bug: Fixed binary resolution using Rust target triple format (
aarch64-apple-darwin) instead of Python platform tag format (darwin-aarch64) - Improved documentation accuracy across all doc files
- 📦 Moved Python SDK to its own repository: https://github.com/sochdb/sochdb-python-sdk
- This allows for independent versioning and faster CI/CD pipelines.
- New Release Workflow: Now pulls pre-built binaries directly from sochdb/sochdb releases.
- Supports Python 3.9 through 3.13
- Automatically creates GitHub releases with all wheel packages attached
- Each wheel bundles platform-specific binaries and FFI libraries
- See RELEASE.md for detailed release process documentation
- Trusted Publishing: Configured PyPI Trusted Publisher (OIDC) security.
- Platform Bundles:
- Linux x86_64 (manylinux_2_17)
- macOS ARM64 (Apple Silicon)
- Windows x64
- Added comprehensive RELEASE.md explaining how binaries are sourced from sochdb/sochdb
- Updated README with binary source information
- Enhanced release workflow with detailed summaries and status reporting
CLI commands now available globally after pip install sochdb-client:
sochdb-server # IPC server for multi-process access
sochdb-bulk # High-performance vector operations
sochdb-grpc-server # gRPC server for remote vector searchsochdb-server features:
- Stale socket detection - Auto-cleans orphaned socket files
- Health checks - Waits for server ready before returning
- Graceful shutdown - Handles SIGTERM/SIGINT/SIGHUP
- PID tracking - Writes PID file for process management
- Permission checks - Validates directory writable before starting
- stop/status commands - Built-in process management
sochdb-bulk features:
- Input validation - Checks file exists, readable, correct extension
- Output validation - Checks directory writable, handles overwrites
- Progress reporting - Shows file sizes during operations
- Structured subcommands - build-index, query, info, convert
sochdb-grpc-server features:
- Port checking - Verifies port available before binding
- Process detection - Identifies what process is using a port
- Privileged port check - Warns about ports < 1024 requiring root
- status command - Check if server is running
| Code | Name | Description |
|---|---|---|
| 0 | SUCCESS | Operation completed |
| 1 | GENERAL_ERROR | General error |
| 2 | BINARY_NOT_FOUND | Native binary not found |
| 3 | PORT/SOCKET_IN_USE | Port or socket in use |
| 4 | PERMISSION_DENIED | Permission denied |
| 5 | STARTUP_FAILED | Server startup failed |
| 130 | INTERRUPTED | Interrupted by Ctrl+C |
SOCHDB_SERVER_PATH- Override sochdb-server binary pathSOCHDB_BULK_PATH- Override sochdb-bulk binary pathSOCHDB_GRPC_SERVER_PATH- Override sochdb-grpc-server binary path
- CLI wrappers now provide actionable error messages with fix suggestions
- Binary resolution searches multiple locations with clear fallback chain
- Signal handlers for graceful shutdown on all platforms
- Zero-compile installation: Pre-built
sochdb-bulkbinaries bundled in wheels - Platform support matrix:
manylinux_2_17_x86_64- Linux x86_64 (glibc ≥ 2.17)manylinux_2_17_aarch64- Linux ARM64 (AWS Graviton, etc.)macosx_11_0_universal2- macOS Intel + Apple Siliconwin_amd64- Windows x64
- Automatic binary resolution with fallback chain:
- Bundled in wheel (
_bin/<platform>/sochdb-bulk) - System PATH (
which sochdb-bulk) - Cargo target directory (development mode)
- Bundled in wheel (
bulk_query_index()- Query HNSW indexes for k nearest neighborsbulk_info()- Get index metadata (vector count, dimension, etc.)get_sochdb_bulk_path()- Get resolved path to sochdb-bulk binary_get_platform_tag()- Platform detection (linux-x86_64, darwin-aarch64, etc.)_find_bundled_binary()- Usesimportlib.resourcesfor installed packages
- GitHub Actions workflow for building platform-specific wheels
- cibuildwheel configuration for cross-platform builds
- QEMU emulation for ARM64 Linux builds
- PyPI publishing with trusted publishing
- PYTHON_DISTRIBUTION.md - Full distribution architecture
- Updated BULK_OPERATIONS.md with troubleshooting
- Updated SDK_DOCUMENTATION.md with Bulk API reference
- Updated ARCHITECTURE.md with Python SDK section
- Package renamed from
sochdb-clienttosochdb - Wheel tags changed from
anyto platform-specific (py3-none-<platform>) - Binary resolution now uses
importlib.resourcesinstead of__file__paths
Follows the "uv-style" approach where:
- Wheels are tagged
py3-none-<platform>(not CPython-ABI-tied) - One wheel per platform (not per Python version)
- Artifact count: O(P·A) where P=platforms, A=architectures
- manylinux_2_17 baseline (glibc ≥ 2.17)
- Covers: CentOS 7+, RHEL 7+, Ubuntu 14.04+, Debian 8+
- Same baseline used by
uvfor production deployments
- universal2 fat binaries containing both x86_64 and arm64
- Created with
lipo -createduring build - Minimum macOS 11.0 (Big Sur)
- Initial release
- Embedded mode with FFI access to SochDB
- IPC client mode for multi-process access
- Path-native API with O(|path|) lookups
- ACID transactions with snapshot isolation
- Range scans and prefix queries
- TOON format output for LLM context optimization
- Bulk API for high-throughput vector ingestion
bulk_build_index()- Build HNSW indexes at ~1,600 vec/sconvert_embeddings_to_raw()- Convert numpy to raw f32
- Support for raw f32 and NumPy .npy input formats
| Method | 768D Throughput | Notes |
|---|---|---|
| Python FFI | ~130 vec/s | Direct FFI calls |
| Bulk API | ~1,600 vec/s | Subprocess to sochdb-bulk |
FFI overhead eliminated by subprocess approach for bulk operations.