Skip to content

Commit 37f5060

Browse files
committed
Enhance Python bindings documentation and tests
- Updated mkdocs.yml to improve navigation structure and added examples section. - Revised README.md in tests to reflect updated test counts and results. - Introduced comprehensive tests for rich data types and SQL features in test_core.py. - Enhanced test_server_patterns.py with realistic CRUD operations benchmark and performance comparison between HTTP and Java APIs.
1 parent 7e8477c commit 37f5060

29 files changed

Lines changed: 4521 additions & 1047 deletions

bindings/python/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Native Python bindings for ArcadeDB - the multi-model database that supports Graph, Document, Key/Value, Search Engine, Time Series, and Vector models.
44

5-
**Status**: ✅ Production Ready | **Tests**: 42/42 Passing (100%)
5+
**Status**: ✅ Production Ready | **Tests**: 44/44 Passing (100%)
66

77
---
88

@@ -37,7 +37,7 @@ pip install arcadedb-embedded-minimal
3737
pip install arcadedb-embedded
3838
```
3939

40-
**Requirements**: Java 11+ must be installed ([details](https://humemai.github.io/arcadedb/latest/getting-started/installation/#java-runtime-environment-jre))
40+
**Requirements**: Java 21+ must be installed ([details](https://humemai.github.io/arcadedb/latest/getting-started/installation/#java-runtime-environment-jre))
4141

4242
### 5-Minute Example
4343

@@ -95,7 +95,7 @@ All use the same import: `import arcadedb_embedded as arcadedb`
9595

9696
## 🧪 Testing
9797

98-
**Status**: 42/42 tests passing (100%)
98+
**Status**: 44/44 tests passing (100%)
9999

100100
```bash
101101
# Run all tests

bindings/python/docs/development/contributing.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pytest tests/
2929
**Required:**
3030

3131
- Python 3.8+
32-
- Java 11+ (JDK or JRE)
32+
- Java 21+ (JDK or JRE)
3333
- Docker (for building distributions)
3434
- Git
3535

@@ -78,7 +78,7 @@ pip install pytest pytest-cov black isort mypy numpy
7878
python --version # Should be 3.8+
7979

8080
# Check Java
81-
java -version # Should be 11+
81+
java -version # Should be 21+
8282

8383
# Run quick test
8484
python -c "import arcadedb_embedded; print('✅ Setup successful!')"
@@ -776,10 +776,10 @@ dependencies = [
776776

777777
```bash
778778
# Check Java version
779-
java -version # Must be 11+
779+
java -version # Must be 21+
780780

781781
# Set JAVA_HOME
782-
export JAVA_HOME=/path/to/jdk-11
782+
export JAVA_HOME=/path/to/jdk-21
783783
```
784784

785785
### Build Errors

bindings/python/docs/development/release.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ cd bindings/python
3030

3131
# Test each distribution
3232
pip install dist/arcadedb_embedded_headless-*.whl
33-
pytest # 35 passed, 7 skipped
33+
pytest # 37 passed, 7 skipped
3434

3535
pip install --force-reinstall dist/arcadedb_embedded_minimal-*.whl
36-
pytest # 39 passed, 3 skipped
36+
pytest # 41 passed, 3 skipped
3737

3838
pip install --force-reinstall dist/arcadedb_embedded_full-*.whl
39-
pytest # 42 passed, 0 skipped
39+
pytest # 44 passed, 0 skipped
4040
```
4141

4242
**Note**: Version is automatically extracted from `pom.xml` by `extract_version.py` during build. The `-SNAPSHOT` suffix is converted to `.dev0` for PEP 440 compliance.
@@ -73,9 +73,9 @@ Instead of pushing tags manually, create a GitHub Release which automatically cr
7373

7474
## Test Results
7575

76-
- Headless: 35/42 passed (7 skipped)
77-
- Minimal: 39/42 passed (3 skipped)
78-
- Full: 42/42 passed
76+
- Headless: 37/44 passed (7 skipped)
77+
- Minimal: 41/44 passed (3 skipped)
78+
- Full: 44/44 passed
7979
```
8080

8181
6. Click **Publish release** (or **Save as draft** to test first)
@@ -114,9 +114,9 @@ https://humemai.github.io/arcadedb/
114114
115115
## Test Results
116116
117-
- Headless: 35/42 passed
118-
- Minimal: 39/42 passed
119-
- Full: 42/42 passed"
117+
- Headless: 37/44 passed
118+
- Minimal: 41/44 passed
119+
- Full: 44/44 passed
120120
121121
**What happens automatically:**
122122
@@ -347,7 +347,7 @@ mike set-default 25.9.0 --push
347347
348348
- Run specific test: `pytest tests/test_core.py::test_name -v`
349349
- Check logs in `bindings/python/log/`
350-
- Verify Java JDK 11+ is available
350+
- Verify Java JDK 21+ is available
351351
352352
## Automation Improvements
353353

bindings/python/docs/development/testing.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
Comprehensive testing documentation for ArcadeDB Python bindings.
44

55
!!! success "Test Coverage"
6-
**42 tests** across 6 test files, 100% passing
6+
**44 tests** across 6 test files, 100% passing
77

8-
- **Headless**: 35 passed, 7 skipped
9-
- **Minimal**: 39 passed, 3 skipped
10-
- **Full**: 42 passed, 0 skipped
8+
- **Headless**: 37 passed, 7 skipped
9+
- **Minimal**: 41 passed, 3 skipped
10+
- **Full**: 44 passed, 0 skipped
1111

1212
## Quick Navigation
1313

bindings/python/docs/development/testing/overview.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ The ArcadeDB Python bindings have a comprehensive test suite covering all major
55
## Quick Statistics
66

77
!!! success "Test Results by Distribution"
8-
- **Headless**: ✅ 35 passed, 7 skipped (Cypher, Gremlin, Server tests)
9-
- **Minimal**: ✅ 39 passed, 3 skipped (Cypher, Gremlin tests)
10-
- **Full**: ✅ 42 passed, 0 skipped (all features available)
8+
- **Headless**: ✅ 37 passed, 7 skipped (Cypher, Gremlin, Server tests)
9+
- **Minimal**: ✅ 41 passed, 3 skipped (Cypher, Gremlin tests)
10+
- **Full**: ✅ 44 passed, 0 skipped (all features available)
1111

12-
**Total: 42 tests** across 6 test files, 100% passing
12+
**Total: 44 tests** across 6 test files, 100% passing
1313

1414
## What's Tested
1515

@@ -144,13 +144,13 @@ pytest -m "not slow"
144144
When all tests pass, you should see:
145145

146146
```
147-
======================== 42 passed in 9.67s =========================
147+
======================== 44 passed in 9.67s =========================
148148
```
149149

150150
With some distributions, you may see skipped tests:
151151

152152
```
153-
================== 39 passed, 3 skipped in 8.50s ===================
153+
================== 41 passed, 3 skipped in 8.50s ===================
154154
```
155155

156156
This is normal! Tests are skipped when features aren't available in your distribution.

bindings/python/docs/development/testing/test-core.md

Lines changed: 66 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,11 +315,74 @@ import arcadedb_embedded as arcadedb
315315

316316
with arcadedb.create_database("./test_db") as db:
317317
# Create document type with vector property
318-
db.command("sql", "CREATE DOCUMENT TYPE Document")
319-
db.command("sql", "CREATE PROPERTY Document.embedding EMBEDDING DOUBLE[3]")
318+
db.command("sql", "CREATE VERTEX TYPE Document")
319+
db.command("sql", "CREATE PROPERTY Document.name STRING")
320+
db.command("sql", "CREATE PROPERTY Document.embedding ARRAY_OF_FLOATS")
320321

321322
# Create HNSW index
322-
db.command("sql", """
323+
index = db.create_vector_index(
324+
vertex_type="Document",
325+
vector_property="embedding",
326+
dimensions=3,
327+
id_property="name",
328+
distance_function="cosine",
329+
m=16,
330+
ef=128,
331+
ef_construction=128,
332+
max_items=100
333+
)
334+
335+
# Insert documents with vectors
336+
with db.transaction():
337+
for i, vec in enumerate([[1.0, 0.0, 0.0], [0.9, 0.1, 0.0],
338+
[0.0, 1.0, 0.0]]):
339+
vertex = db.new_vertex("Document")
340+
vertex.set("name", f"doc{i+1}")
341+
vertex.set("embedding", arcadedb.to_java_float_array(vec))
342+
vertex.save()
343+
index.add_vertex(vertex)
344+
345+
# Search for nearest neighbors
346+
query_vec = [1.0, 0.0, 0.0]
347+
results = list(index.find_nearest(query_vec, k=2))
348+
349+
assert len(results) == 2
350+
# Verify results ordered by distance
351+
assert results[0][0].get_property("name") == "doc1" # Exact match
352+
assert results[1][0].get_property("name") == "doc2" # Second closest
353+
```
354+
355+
!!! note "Implementation Status"
356+
Vector search is **experimental**. Current implementation uses jelmerk/hnswlib.
357+
Future migration to datastax/jvector planned for better performance.
358+
359+
**What it tests:**
360+
361+
- EMBEDDING property type creation
362+
- HNSW index creation with parameters
363+
- Vector insertion (NumPy arrays or Python lists)
364+
- Cosine similarity search
365+
- Result ranking by similarity
366+
367+
**Key findings:**
368+
369+
- ✅ Index creation fast (~0.16s) - creates metadata only
370+
- ⚠️ Index population expensive (~13ms/doc) - builds HNSW graph + disk writes
371+
- ✅ Search efficient (logarithmic) - visits ~1,500-2,000 vertices, not all
372+
- ✅ Works with NumPy arrays and plain Python lists
373+
- ✅ Distance values correct (cosine distance = 1 - similarity, range [0,2])
374+
- ⚠️ No native filtered search - requires oversampling or multiple indexes
375+
376+
**Performance characteristics** (10K documents, 384D):
377+
378+
- Total storage: ~115 MB (24MB vertices + 91MB edges)
379+
- Index file: 4 KB (metadata only, graph stored as edges)
380+
- Per-document cost: ~13ms (HNSW algorithm + edge writes)
381+
- Search working set: ~4 MB (visited vertices, not entire dataset)
382+
383+
See [Vector Search Example](../../examples/03_vector_search.md) for detailed documentation.
384+
385+
---
323386
CREATE HNSW INDEX Document.embedding
324387
ON Document(embedding)
325388
WITH m=16, ef=128, efConstruction=128

0 commit comments

Comments
 (0)