hive-db (Python)
Binding Python de HiveDB, la base de memoria embebida para agentes de IA: registro inmutable de
eventos, colecciones de documentos, búsqueda híbrida (BM25 + vectores con fusión RRF) y un embedder
local opcional. El motor es el mismo que el del paquete npm @johpaz/hive-db (Rust), sin servidor y
sin dependencias de Python.
pip install johpaz-hive-db
Wheels para Linux (glibc y musl, x64 y arm64), macOS (x64 y arm64) y Windows (x64); una sola wheel por plataforma sirve a Python 3.9 en adelante.
Uso rápido
from hivedb import HiveDB
with HiveDB.open("./memoria") as db:
# Registro de eventos (inmutable)
seq = db.append("agente-1", "tarea-7", "Fact", {"temperatura": 21.5})
# Colecciones con versión optimista
notas = db.collection("notas")
notas.put("n1", {"titulo": "Factura", "cliente": "acme"})
notas.create_index("cliente")
print(notas.find_by("cliente", "acme"))
# Búsqueda de texto (BM25, español e inglés)
db.upsert_doc("d1", body="El cliente prefiere factura electrónica", filters={"tenant": "acme"})
print(db.query_hybrid(text="factura", k=5, filters={"tenant": "acme"}))
Embeddings locales (búsqueda por significado)
from hivedb import HiveDB
# Una sola vez por aplicación: descarga (~470 MB) y verifica el modelo, con progreso.
HiveDB.prepare_embedder(lambda p: print(f"{p.file}: {p.downloaded}/{p.total}"))
db = HiveDB.open("./memoria", embedder="local") # no hace falta indicar `vector`
db.upsert_doc("d2", body="Receta de paella valenciana")
print(db.query_hybrid(text="cómo cocinar arroz", k=3))
El modelo no viaja en el paquete: se descarga al activarlo y se comparte entre todas las bases
del proceso (un modelo por aplicación, ~12 MiB por base adicional). Variables: HIVEDB_MODEL_DIR
(caché), HIVEDB_MODEL_BASE_URL (espejo), HIVEDB_OFFLINE=1 (sin red).
asyncio
from hivedb import AsyncHiveDB
async with await AsyncHiveDB.open("./memoria", embedder="local") as db:
hits = await db.query_hybrid(text="factura", k=5)
async for event in db.events({"kind": "Fact"}):
...
Las llamadas sueltan el GIL mientras trabaja el motor: varios hilos (o tareas con AsyncHiveDB)
consultan la misma base a la vez.
Errores
Todos los errores del motor son HiveDBError; los semánticos llevan code
(INVALID_VECTOR, VECTOR_SPACE_MISMATCH, INDEX_DEGRADED, EMBEDDER_UNAVAILABLE):
from hivedb import HiveDBError
try:
HiveDB.open("./m", embedder="local")
except HiveDBError as error:
if error.code == "EMBEDDER_UNAVAILABLE":
...
Bases compartidas por varios inquilinos
Igual que en Node: usa filters={"tenant": ...} en upsert_doc y en query_hybrid, y pasa
agents=[...] a tool_stats y causal_thread. Para inquilinos grandes, una base por inquilino.
Guía completa en docs/AGENT_GUIDE.md.
Licencia
Apache-2.0.
Metadata
Release files for johpaz-hive-db 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| johpaz_hive_db-0.7.0.tar.gz | 176.0 kB | Without provenance | Details for johpaz_hive_db-0.7.0.tar.gz |
Built distributions (wheels)
Total release size: 37.2 MB
Release files / johpaz_hive_db-0.7.0.tar.gz
| Download URL | johpaz_hive_db-0.7.0.tar.gz |
|---|---|
| Size | 176.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6272f62e072b4a2636656a795fdb0a40709d627973d28b6b39aeddd46ed447de
|
|
BLAKE2b-256 checksum How to use checksums |
8ba10181b1307c7d2de0d8d1f2cd9e8cf50c7fbbb9502b5fe6bf58a2ac13bb39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / johpaz_hive_db-0.7.0-cp39-abi3-win_amd64.whl
| Download URL | johpaz_hive_db-0.7.0-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 5.9 MB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
3eac8714b005e57545dba20fe67d2a4a125fea94d92217aaed8a37a7482d61bd
|
|
BLAKE2b-256 checksum How to use checksums |
6082898ec9d2341dd6e721f03e4eda0f0093758a01d44d16e7e33619b25ddbaa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / johpaz_hive_db-0.7.0-cp39-abi3-musllinux_1_2_x86_64.whl
| Download URL | johpaz_hive_db-0.7.0-cp39-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 6.6 MB |
| Tags | CPython 3.9 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
a5fe0ee24f928d442c6c06043b6ae0b3b692f8e05f17a75338baf034f53056cb
|
|
BLAKE2b-256 checksum How to use checksums |
fb9dccb7d693f16369651658bdaf5af429f04c41fcbc4566a8ffcdbb1b8e6fc6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / johpaz_hive_db-0.7.0-cp39-abi3-manylinux_2_28_x86_64.whl
| Download URL | johpaz_hive_db-0.7.0-cp39-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 6.4 MB |
| Tags | CPython 3.9 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
6224cb874da195ab99a72cb5228bb630f05e3b22552f32135851bafaaef6cda1
|
|
BLAKE2b-256 checksum How to use checksums |
fd2d76b354d13a3c2e2f41a5d109220ae8d4835ed4aa152311888cca70fad02d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / johpaz_hive_db-0.7.0-cp39-abi3-manylinux_2_28_aarch64.whl
| Download URL | johpaz_hive_db-0.7.0-cp39-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 6.2 MB |
| Tags | CPython 3.9 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
4a7b90f36ebda5d444cb2aa64fd67e057663ca8f6059dbf5f687e69f6c48cde3
|
|
BLAKE2b-256 checksum How to use checksums |
72dbeff70c1d0396108875e4b490d5287f9b4f5b7f9d529e9b19bc230b1f3006
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / johpaz_hive_db-0.7.0-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | johpaz_hive_db-0.7.0-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 5.7 MB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
6f46587b0a67e1d94de27d38e13e8701248a6b38b17d34f6212d2a593353977d
|
|
BLAKE2b-256 checksum How to use checksums |
d2489913be83cb2c230c5c402356b5fc23c49c4d2f373af944b1277b9be064ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / johpaz_hive_db-0.7.0-cp39-abi3-macosx_10_12_x86_64.whl
| Download URL | johpaz_hive_db-0.7.0-cp39-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 6.1 MB |
| Tags | CPython 3.9 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
56a04ad691fb54f4c156cdf3336b462fba120da57b6532431fc0129f241654e7
|
|
BLAKE2b-256 checksum How to use checksums |
5285fb3d321d30c3e173198875418454c88a72dd783990c2dd25abbfba227be5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for johpaz-hive-db 0.7.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.