A clean, multi-tenant Weaviate wrapper for isolated data management.
Project description
WeavScope 🔭
A clean, multi-tenant wrapper for Weaviate.
WeavScope simplifies working with isolated data in Weaviate by providing a context-managed "Scope" that automatically handles connection, tenant creation, and cleanup based on your configuration.
Features
- Config-Driven Lifecycle: Pass a
WeaviateConfigobject; the wrapper handles the connection. - Auto-Tenant Management: Automatically create a tenant on entry and DELETES it on exit.
- Fluent API: Simplified batch ingestion and querying (
scope.batch/scope.query). - Idempotent Inserts: Automatic deterministic UUID generation based on
(object_id, tenant_id).
Installation
pip install weavscope
Quick Start
from weavscope import WeavScope, WeaviateConfig
# 1. Define your connection and class settings
config = WeaviateConfig(
WEAVIATE_HOST="localhost", # Your Weaviate host
WEAVIATE_PORT=8080,
WEAVIATE_CLASS_NAME="Articles",
WEAVIATE_EMBEDDING_MODEL_PROVIDER="gemini",
WEAVIATE_EMBEDDING_MODEL_NAME="gemini-embedding-001",
WEAVIATE_EMBEDDING_MODEL_API_KEY="[ENCRYPTION_KEY]"
)
# 2. Use WeavScope to isolate operations to a specific tenant
# The tenant 'project-A' is created on entry and DELETED on exit.
with WeavScope(config, tenant_id="project-A") as scope:
# Batch-insert objects
scope.batch.add_objects(
objects=[
{"title": "Intro to AI", "content": "AI is changing the world..."},
{"title": "Vector DBs", "content": "Vector databases are cool."}
],
id_field="title" # Ensures deterministic UUIDs
)
# Semantic search within the tenant
results = scope.query.hybrid("machine learning")
for hit in results:
print(f"Found: {hit['properties']['title']} (score: {hit['score']})")
# Connection is closed and tenant 'project-A' (with all its data) is deleted.
Manual Management
If you don't want the automatic deletion behavior, simply omit the tenant_id from the constructor:
with WeavScope(config) as scope:
# Manually ensure a tenant exists
scope.ensure_tenant("permanent-tenant")
# The collection is created automatically if it didn't exist
scope.batch.add_objects(
tenant_id="permanent-tenant",
objects=[...]
)
AI/LLM Documentation
For AI coding assistants and LLMs looking for an in-depth technical overview of WeavScope's architecture and API, please refer to LLM.txt.
License
MIT - Copyright (c) 2026 Tahcin Ul Karim (Mycin)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file weavscope-0.1.0.tar.gz.
File metadata
- Download URL: weavscope-0.1.0.tar.gz
- Upload date:
- Size: 12.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fceca786564beb591ef58ed0863f14905de905848a5d4e6aa3bd9d1288fcd502
|
|
| MD5 |
d25c68ce6417b585e075620ff0c18296
|
|
| BLAKE2b-256 |
60bb32db314c2f8d7f9c6483a39bf96cf97f11ba596cbe952925cea266c3892e
|
File details
Details for the file weavscope-0.1.0-py3-none-any.whl.
File metadata
- Download URL: weavscope-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7d59c8cf07d0f020cc3a81a7760a8dc8b9e026691cd264fef85519691fe7791
|
|
| MD5 |
be3a662f46a1f35201f0e75420dca69a
|
|
| BLAKE2b-256 |
016cee9d0dd9e9d650f6fab74e9528a77b8c09aceea4a4da72acf0d1421f65b2
|