Skip to content

Commit f0d3c7f

Browse files
authored
Merge pull request #5 from toondb/release/0.3.5
Release/0.3.5
2 parents 9f866dc + 6147246 commit f0d3c7f

3 files changed

Lines changed: 615 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,15 @@ jobs:
250250
build-sdist:
251251
name: Build Source Distribution
252252
runs-on: ubuntu-latest
253+
strategy:
254+
matrix:
255+
include:
256+
- target: x86_64-unknown-linux-gnu
257+
archive_ext: tar.gz
258+
- target: aarch64-apple-darwin
259+
archive_ext: tar.gz
260+
- target: x86_64-pc-windows-msvc
261+
archive_ext: zip
253262
steps:
254263
- name: Checkout repository
255264
uses: actions/checkout@v4
@@ -259,16 +268,81 @@ jobs:
259268
with:
260269
python-version: '3.12'
261270

271+
- name: Create directory structure
272+
run: |
273+
mkdir -p src/toondb/_bin/${{ matrix.target }}
274+
mkdir -p src/toondb/lib/${{ matrix.target }}
275+
276+
- name: Download binaries from main ToonDB release
277+
shell: bash
278+
run: |
279+
# Use toondb_version if provided, otherwise use version
280+
VERSION="${{ inputs.toondb_version }}"
281+
if [ -z "$VERSION" ]; then
282+
VERSION="${{ inputs.version }}"
283+
fi
284+
285+
TAG="v${VERSION}"
286+
TARGET="${{ matrix.target }}"
287+
288+
if [ "${{ matrix.archive_ext }}" = "zip" ]; then
289+
ASSET_NAME="toondb-${VERSION}-${TARGET}.zip"
290+
else
291+
ASSET_NAME="toondb-${VERSION}-${TARGET}.tar.gz"
292+
fi
293+
294+
DOWNLOAD_URL="https://github.com/${{ env.TOONDB_REPO }}/releases/download/${TAG}/${ASSET_NAME}"
295+
echo "Downloading ToonDB binaries for sdist:"
296+
echo " URL: $DOWNLOAD_URL"
297+
298+
curl -L -f -o release-archive.${{ matrix.archive_ext }} "$DOWNLOAD_URL"
299+
300+
# Extract the archive
301+
if [ "${{ matrix.archive_ext }}" = "zip" ]; then
302+
unzip -o release-archive.zip
303+
else
304+
tar -xzf release-archive.tar.gz
305+
fi
306+
307+
- name: Copy binaries to SDK
308+
shell: bash
309+
run: |
310+
TARGET="${{ matrix.target }}"
311+
312+
# Copy binaries
313+
if [ "$TARGET" = "x86_64-pc-windows-msvc" ]; then
314+
# Windows binaries
315+
find . -maxdepth 2 -name "toondb-bulk.exe" -type f -exec cp {} src/toondb/_bin/${TARGET}/ \;
316+
find . -maxdepth 2 -name "toondb-grpc-server.exe" -type f -exec cp {} src/toondb/_bin/${TARGET}/ \;
317+
find . -maxdepth 2 -name "toondb_storage.dll" -type f -exec cp {} src/toondb/lib/${TARGET}/ \;
318+
find . -maxdepth 2 -name "toondb_index.dll" -type f -exec cp {} src/toondb/lib/${TARGET}/ \;
319+
else
320+
# Unix binaries
321+
find . -maxdepth 2 -name "toondb-bulk" -type f -exec cp {} src/toondb/_bin/${TARGET}/ \;
322+
find . -maxdepth 2 -name "toondb-server" -type f -exec cp {} src/toondb/_bin/${TARGET}/ \; || true
323+
find . -maxdepth 2 -name "toondb-grpc-server" -type f -exec cp {} src/toondb/_bin/${TARGET}/ \;
324+
find . -maxdepth 2 -name "libtoondb_storage*" -type f -exec cp {} src/toondb/lib/${TARGET}/ \;
325+
find . -maxdepth 2 -name "libtoondb_index*" -type f -exec cp {} src/toondb/lib/${TARGET}/ \;
326+
chmod +x src/toondb/_bin/${TARGET}/* 2>/dev/null || true
327+
fi
328+
329+
echo "=== Binaries for ${TARGET} ==="
330+
ls -la src/toondb/_bin/${TARGET}/ 2>/dev/null || echo "No binaries"
331+
echo "=== Libraries for ${TARGET} ==="
332+
ls -la src/toondb/lib/${TARGET}/ 2>/dev/null || echo "No libraries"
333+
262334
- name: Update package version
263335
run: |
264336
sed -i 's/version = ".*"/version = "${{ inputs.version }}"/' pyproject.toml
265337
266-
- name: Build sdist
338+
- name: Build sdist (only first target)
339+
if: matrix.target == 'x86_64-unknown-linux-gnu'
267340
run: |
268341
pip install build
269342
python -m build --sdist
270343
271344
- name: Upload sdist artifact
345+
if: matrix.target == 'x86_64-unknown-linux-gnu'
272346
uses: actions/upload-artifact@v4
273347
with:
274348
name: sdist

README.md

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,39 @@
1-
# ToonDB Python SDK v0.3.4
1+
# ToonDB Python SDK v0.3.5
22

33
**Dual-mode architecture: Embedded (FFI) + Server (gRPC/IPC)**
44
Choose the deployment mode that fits your needs.
55

6+
## What's New in 0.3.5
7+
8+
### 🔢 Vector Operations in Database Class
9+
No need for separate `VectorIndex` class anymore - vector operations are now directly available on the `Database` class:
10+
11+
```python
12+
from toondb import Database
13+
14+
db = Database.open('./mydb')
15+
16+
# Create vector index
17+
db.create_index('embeddings', dimension=384)
18+
19+
# Insert vectors
20+
db.insert_vectors('embeddings', [1, 2, 3], [
21+
[0.1, 0.2, ...], # vector 1
22+
[0.3, 0.4, ...], # vector 2
23+
[0.5, 0.6, ...], # vector 3
24+
])
25+
26+
# Search
27+
results = db.search('embeddings', [0.1, 0.2, ...], k=5)
28+
for id, distance in results:
29+
print(f'ID: {id}, Distance: {distance:.4f}')
30+
```
31+
32+
### 🏗️ Works with Tokio-Optional Architecture
33+
- Supports both sync and async Rust backend (v0.3.5)
34+
- No breaking changes to existing code
35+
- Smaller binaries (~500KB reduction)
36+
637
## Architecture: Flexible Deployment
738

839
```
@@ -72,6 +103,19 @@ with Database.open("./mydb") as db:
72103
db.put(b"key", b"value")
73104
value = db.get(b"key")
74105

106+
# Vector operations (NEW in 0.3.5)
107+
db.create_index('embeddings', dimension=384)
108+
db.insert_vectors('embeddings', [1, 2, 3], [
109+
[0.1, 0.2, ...], # vector 1
110+
[0.3, 0.4, ...], # vector 2
111+
[0.5, 0.6, ...], # vector 3
112+
])
113+
114+
# Search for similar vectors
115+
results = db.search('embeddings', [0.1, 0.2, ...], k=5)
116+
for id, distance in results:
117+
print(f'ID: {id}, Distance: {distance}')
118+
75119
# Namespaces
76120
ns = db.namespace("tenant_123")
77121
collection = ns.collection("documents", dimension=384)

0 commit comments

Comments
 (0)