A clean graph database engine
Project description
Graphite
A clean, embedded graph database engine for Python.
Graphite is a lightweight yet flexible graph database engine implemented in pure Python.
It is designed to model graph-like data inside large Python codebases without introducing the complexity of an external database.
Features
🧩 Embedded by Design
Graphite is not a separate service or infrastructure dependency.
It lives inside your project, evolves with it, and collaborates naturally with your existing code.
No servers. No ports. No deployment headaches.
🛠 Ready-made, Customizable Module
Graphite is intentionally simple and hackable.
You can fork it, modify it, or deeply integrate it into your project without fighting rigid abstractions.
The database adapts to your project — not the other way around.
🐍 Native Python API
Everything is done through Python APIs. No query strings. DSL parsing is just an optional layer. No context switching.
Your editor already knows how to autocomplete and document your queries.
🔍 Query? It’s Code.
Queries are built by chaining Python methods on the QueryResult object.
- Zero parsing cost
- Full IDE support
- Refactor-safe
- Debuggable
🔄 Runtime Evolution
Change structures, data, or even engine behavior at runtime. No shutdowns. No migrations. No waiting.
🧱 Structure-Oriented Modeling
Define:
- node types
- relation types
- fields
- base types
- valid forms
Model your domain explicitly and safely.
🧬 Node Inheritance
Create base node types and extend them with shared properties and advanced relationships.
✨ Simple, Predictable Syntax
From defining structures to querying data, every step favors clarity and minimal syntax.
💾 Serializable
Persist the entire database into a single file.
Installation
Install from PyPI:
pip install graphitedb
Why Graphite?
Graphite was extracted from a large production codebase where Neo4j introduced more complexity than value.
Neo4j is a powerful tool — but in large projects, adding a separate graph database often increases:
- infrastructure complexity
- deployment cost
- maintenance burden
- cognitive load on developers
Graphite exists for cases where this cost is not justified.
It provides graph modeling without adding another system to operate.
Example Usage
import graphite
def example_complete_dsl_loading():
engine = graphite.engine()
complete_dsl = """
# Define node types
node Person
name: string
age: int
node User from Person
id: string
email: string
node Object
node Book from Object
title: string
n_pages: int
node Car from Object
model: string
year: int
# Define relation types
relation FRIEND both
Person - Person
since: date
relation OWNER reverse OWNED_BY
Person -> Object
since: date
purchased_at: date
relation AUTHOR reverse AUTHORED_BY
Person -> Book
year: int
# Create nodes
User, user_1, "Joe Doe", 32, "joe4030", "joe@email.com"
User, user_2, "Jane Smith", 28, "jane28", "jane@email.com"
User, user_3, "Bob Wilson", 45, "bob45", "bob@email.com"
User, user_4, "Alice Brown", 22, "alice22", "alice@email.com"
Book, book_1, "The Great Gatsby", 180
Book, book_2, "Python Programming", 450
Book, book_3, "Graph Databases", 320
Car, car_1, "Toyota Camry", 2020
Car, car_2, "Honda Civic", 2018
# Create relations
user_1 -[FRIEND, 2020-05-15]- user_2
user_1 -[FRIEND, 2019-08-22]- user_3
user_2 -[FRIEND, 2021-01-10]- user_4
user_1 -[OWNER, 2021-03-01, 2021-02-15]-> car_1
user_2 -[OWNER, 2019-06-20, 2019-05-10]-> book_1
user_3 -[OWNER, 2022-11-05, 2022-10-20]-> book_2
user_1 -[AUTHOR, 2020]-> book_3
user_2 -[AUTHOR, 2021]-> book_2
"""
engine.load_dsl(complete_dsl)
users = engine.query.User.get()
print([u["name"] for u in users])
return engine
More examples are available in example.py in the GitHub repository.
::contentReference[oaicite:0]{index=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 graphitedb-0.1.2.tar.gz.
File metadata
- Download URL: graphitedb-0.1.2.tar.gz
- Upload date:
- Size: 11.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
071e11448a3ace95018a39a585f8e1576603ee9776cf3834793fe05c942343d6
|
|
| MD5 |
f1a7ccca732e05c1ea985def3586f7bb
|
|
| BLAKE2b-256 |
b0714dda2e8c7da4ad968daef668449a3bc0dc2a13e28bf9610384d3bb07adfc
|
Provenance
The following attestation bundles were made for graphitedb-0.1.2.tar.gz:
Publisher:
python-publish.yml on mkh-user/graphite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
graphitedb-0.1.2.tar.gz -
Subject digest:
071e11448a3ace95018a39a585f8e1576603ee9776cf3834793fe05c942343d6 - Sigstore transparency entry: 871879859
- Sigstore integration time:
-
Permalink:
mkh-user/graphite@575652bd58c44dc36f7e5f11fa916f0a0dab86e0 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/mkh-user
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@575652bd58c44dc36f7e5f11fa916f0a0dab86e0 -
Trigger Event:
release
-
Statement type:
File details
Details for the file graphitedb-0.1.2-py3-none-any.whl.
File metadata
- Download URL: graphitedb-0.1.2-py3-none-any.whl
- Upload date:
- Size: 9.7 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 |
1ffe87035ff8ffc64086d642cbdbb01efb02f7b182bd637c2aa756142165aa23
|
|
| MD5 |
c83b3442fd8a1e4d0550951203080ae6
|
|
| BLAKE2b-256 |
473a12343679aaec7bfe632bc5d8cac6f814d06cda1566702341f5818409ab05
|
Provenance
The following attestation bundles were made for graphitedb-0.1.2-py3-none-any.whl:
Publisher:
python-publish.yml on mkh-user/graphite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
graphitedb-0.1.2-py3-none-any.whl -
Subject digest:
1ffe87035ff8ffc64086d642cbdbb01efb02f7b182bd637c2aa756142165aa23 - Sigstore transparency entry: 871879888
- Sigstore integration time:
-
Permalink:
mkh-user/graphite@575652bd58c44dc36f7e5f11fa916f0a0dab86e0 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/mkh-user
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@575652bd58c44dc36f7e5f11fa916f0a0dab86e0 -
Trigger Event:
release
-
Statement type: