A Python library for storing and querying n-ary relationships with provenance tracking. SQLite-backed, zero configuration.
Project description
Hypabase
Hypabase is a Python library for storing and querying relationships between entities. A single edge connects two or more nodes, every edge tracks where it came from (source and confidence), and the whole graph lives in a local SQLite file with no server or configuration.
Use it to build knowledge graphs, retrieval-augmented generation pipelines, and structured agent memory. Recent research explores hypergraph representations for these tasks:
- HyperGraphRAG — n-ary knowledge retrieval across medicine, agriculture, CS, and law
- Cog-RAG — dual-hypergraph retrieval with theme-level and entity-level recall
- Hypergraph Memory for Multi-step RAG — hypergraph-based memory for long-context relational modeling
Install
uv add hypabase
Quick example
from hypabase import Hypabase
hb = Hypabase("my.db") # local SQLite, zero config
# One edge connecting five entities
hb.edge(
["dr_smith", "patient_123", "aspirin", "headache", "mercy_hospital"],
type="treatment",
source="clinical_records",
confidence=0.95,
)
# Query edges involving a node
hb.edges(containing=["patient_123"])
# Find paths between entities
hb.paths("dr_smith", "mercy_hospital")
Provenance
Every edge carries source and confidence:
hb.edge(
["patient_123", "aspirin", "ibuprofen"],
type="drug_interaction",
source="clinical_decision_support_v3",
confidence=0.92,
)
# Bulk provenance
with hb.context(source="schema_analysis", confidence=0.9):
hb.edge(["a", "b"], type="fk")
hb.edge(["b", "c"], type="fk")
# Query by provenance
hb.edges(source="clinical_decision_support_v3")
hb.edges(min_confidence=0.9)
# Overview of all sources
hb.sources()
Namespace isolation
Isolate data into separate namespaces within a single database file:
hb = Hypabase("knowledge.db")
drugs = hb.database("drugs")
sessions = hb.database("sessions")
drugs.node("aspirin", type="drug")
sessions.node("s1", type="session")
drugs.nodes() # → [aspirin]
sessions.nodes() # → [s1]
Features
- N-ary hyperedges — an edge connects 2+ nodes in a single relationship
- O(1) vertex-set lookup — find edges by their exact node set
- Provenance — every edge carries
sourceandconfidence - Provenance queries — filter by
sourceandmin_confidence, summarize withsources() - SQLite persistence — local-first, zero-config
- Namespace isolation —
.database("name")for scoped views in a single file - MCP server — 14 tools + 2 resources for AI agent integration
- CLI —
hypabase init,hypabase node,hypabase edge,hypabase query
Documentation
License
Apache 2.0
Project details
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 hypabase-0.1.0.tar.gz.
File metadata
- Download URL: hypabase-0.1.0.tar.gz
- Upload date:
- Size: 184.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a695e216e6789ecc5aacb2e2a96bf7eafff95b8fb83fcc64ece0b5667e4ff17b
|
|
| MD5 |
673abebf168ef534171f4c71d01f1d2b
|
|
| BLAKE2b-256 |
17dd1970a7d9ca2ee427100b3bbedb19768f07910add74cf76a755dfeed813d2
|
Provenance
The following attestation bundles were made for hypabase-0.1.0.tar.gz:
Publisher:
release.yml on hypabase/hypabase
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hypabase-0.1.0.tar.gz -
Subject digest:
a695e216e6789ecc5aacb2e2a96bf7eafff95b8fb83fcc64ece0b5667e4ff17b - Sigstore transparency entry: 947489231
- Sigstore integration time:
-
Permalink:
hypabase/hypabase@c00ef944f1fe56cc0a099867c85037a91a9c48e1 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/hypabase
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c00ef944f1fe56cc0a099867c85037a91a9c48e1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file hypabase-0.1.0-py3-none-any.whl.
File metadata
- Download URL: hypabase-0.1.0-py3-none-any.whl
- Upload date:
- Size: 43.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
337994cbb6182046f7bb7c143901dc51ea9a987d05ec6c5453a17038529efccd
|
|
| MD5 |
40f1d81c767966db27942da5cfbf1b65
|
|
| BLAKE2b-256 |
6843f16e23efe9a59c19e725945e438582ae20aec3b671870c8250720a15ce24
|
Provenance
The following attestation bundles were made for hypabase-0.1.0-py3-none-any.whl:
Publisher:
release.yml on hypabase/hypabase
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hypabase-0.1.0-py3-none-any.whl -
Subject digest:
337994cbb6182046f7bb7c143901dc51ea9a987d05ec6c5453a17038529efccd - Sigstore transparency entry: 947489235
- Sigstore integration time:
-
Permalink:
hypabase/hypabase@c00ef944f1fe56cc0a099867c85037a91a9c48e1 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/hypabase
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c00ef944f1fe56cc0a099867c85037a91a9c48e1 -
Trigger Event:
push
-
Statement type: