graph-ted-db 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- graph_ted_db-0.1.0/CHANGELOG.md +74 -0
- graph_ted_db-0.1.0/LICENSE +21 -0
- graph_ted_db-0.1.0/MANIFEST.in +10 -0
- graph_ted_db-0.1.0/PKG-INFO +173 -0
- graph_ted_db-0.1.0/README.md +142 -0
- graph_ted_db-0.1.0/graph_ted_db/__init__.py +23 -0
- graph_ted_db-0.1.0/graph_ted_db/__main__.py +3 -0
- graph_ted_db-0.1.0/graph_ted_db/cli.py +367 -0
- graph_ted_db-0.1.0/graph_ted_db/driver/__init__.py +16 -0
- graph_ted_db-0.1.0/graph_ted_db/driver/graphiti.py +201 -0
- graph_ted_db-0.1.0/graph_ted_db/driver/http.py +158 -0
- graph_ted_db-0.1.0/graph_ted_db/engine/__init__.py +17 -0
- graph_ted_db-0.1.0/graph_ted_db/engine/ast.py +222 -0
- graph_ted_db-0.1.0/graph_ted_db/engine/errors.py +11 -0
- graph_ted_db-0.1.0/graph_ted_db/engine/eval.py +287 -0
- graph_ted_db-0.1.0/graph_ted_db/engine/executor.py +927 -0
- graph_ted_db-0.1.0/graph_ted_db/engine/fulltext.py +84 -0
- graph_ted_db-0.1.0/graph_ted_db/engine/functions.py +259 -0
- graph_ted_db-0.1.0/graph_ted_db/engine/lexer.py +206 -0
- graph_ted_db-0.1.0/graph_ted_db/engine/parser.py +593 -0
- graph_ted_db-0.1.0/graph_ted_db/engine/values.py +189 -0
- graph_ted_db-0.1.0/graph_ted_db/index/__init__.py +5 -0
- graph_ted_db-0.1.0/graph_ted_db/index/local.py +211 -0
- graph_ted_db-0.1.0/graph_ted_db/server/__init__.py +19 -0
- graph_ted_db-0.1.0/graph_ted_db/server/http.py +414 -0
- graph_ted_db-0.1.0/graph_ted_db/store/__init__.py +42 -0
- graph_ted_db-0.1.0/graph_ted_db/store/aliases.py +228 -0
- graph_ted_db-0.1.0/graph_ted_db/store/format.py +78 -0
- graph_ted_db-0.1.0/graph_ted_db/store/graph.py +1561 -0
- graph_ted_db-0.1.0/graph_ted_db/store/init.py +88 -0
- graph_ted_db-0.1.0/graph_ted_db/store/jsonl.py +265 -0
- graph_ted_db-0.1.0/graph_ted_db/store/lock.py +81 -0
- graph_ted_db-0.1.0/graph_ted_db/store/lww.py +81 -0
- graph_ted_db-0.1.0/graph_ted_db/store/paths.py +196 -0
- graph_ted_db-0.1.0/graph_ted_db/store/records.py +446 -0
- graph_ted_db-0.1.0/graph_ted_db.egg-info/PKG-INFO +173 -0
- graph_ted_db-0.1.0/graph_ted_db.egg-info/SOURCES.txt +41 -0
- graph_ted_db-0.1.0/graph_ted_db.egg-info/dependency_links.txt +1 -0
- graph_ted_db-0.1.0/graph_ted_db.egg-info/entry_points.txt +3 -0
- graph_ted_db-0.1.0/graph_ted_db.egg-info/requires.txt +3 -0
- graph_ted_db-0.1.0/graph_ted_db.egg-info/top_level.txt +1 -0
- graph_ted_db-0.1.0/pyproject.toml +68 -0
- graph_ted_db-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to graph-ted-db are listed here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/). Until 1.0.0, a minor
|
|
5
|
+
version may include breaking changes; they are called out under **Changed**.
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.1.0]
|
|
10
|
+
|
|
11
|
+
First public release.
|
|
12
|
+
|
|
13
|
+
### Security
|
|
14
|
+
|
|
15
|
+
- Unauthenticated `GET /health` returns only `ok` and the library version.
|
|
16
|
+
The graph name, id, counts and problem counts are on `GET /info`, which
|
|
17
|
+
needs the token when one is set.
|
|
18
|
+
- `serve` warns when it listens off loopback, even with a token.
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- `GraphStore` and `init_graph`: a property graph stored in a folder of
|
|
23
|
+
sharded JSONL files, opened and queried in-process with no server.
|
|
24
|
+
- Record types exported from `graph_ted_db`: `NodeRecord`, `EdgeRecord`,
|
|
25
|
+
`VectorRecord`, `Tombstone`.
|
|
26
|
+
- Nodes, edges and embedding vectors: `make_node` / `make_edge`, `put_*`,
|
|
27
|
+
`get_*`, `iter_nodes` / `iter_edges`, `delete_*` (tombstones).
|
|
28
|
+
- Per-record last-write-wins, and reading of sync-tool conflict copies
|
|
29
|
+
(OneDrive- and Dropbox-style names, rclone bisync `.conflictN` / `..pathN`)
|
|
30
|
+
so a graph folder can be shared through a file-sync service. Multiple
|
|
31
|
+
devices can add and edit at the same time; concurrent edits to the same
|
|
32
|
+
record resolve to the latest version.
|
|
33
|
+
- On-disk format version 2 (`docs/format.md`): each writer appends only to
|
|
34
|
+
its own files (`<shard>.<writer>.jsonl`, `meta/deleted.<writer>.jsonl`),
|
|
35
|
+
with a random writer id kept in local app data and a registration file in
|
|
36
|
+
`meta/writers/`. Versions are ordered by a hybrid logical clock
|
|
37
|
+
`(updated_at, counter, writer)`. Version 1 folders are read, and upgraded on
|
|
38
|
+
the first write.
|
|
39
|
+
- Torn-tail repair touches only this writer's own files; other writers' files
|
|
40
|
+
are never modified, and an unterminated last line is skipped and reported.
|
|
41
|
+
`compact` refuses to run on a shared store (`SharedStoreError`).
|
|
42
|
+
- `GraphStore.problems()`, `graph-ted-db info --check`, a `problems` object
|
|
43
|
+
in `/health` (counts only), and a warning on open, for skipped lines,
|
|
44
|
+
other writers' unterminated files, cloud-only placeholders and empty record
|
|
45
|
+
files. `doctor` lists them.
|
|
46
|
+
- `graph-ted-db export` / `import` and `GraphStore.export` /
|
|
47
|
+
`import_export`: back up the current state to one JSONL file and restore
|
|
48
|
+
it into a new graph. Backup guidance in `docs/backup.md`.
|
|
49
|
+
- openCypher: `count(*)`, and unaliased `RETURN` expressions (the column is
|
|
50
|
+
named by its source text, e.g. `b.name`).
|
|
51
|
+
- Opening a graph above 250,000 records logs how long it took and points to
|
|
52
|
+
the Graph size docs.
|
|
53
|
+
- Crash safety: one flush and fsync per multi-record transaction, replay of
|
|
54
|
+
an interrupted transaction on open, torn-line repair.
|
|
55
|
+
- `GraphStore.execute` / `execute_many`: a documented subset of openCypher,
|
|
56
|
+
with `CypherError` (and its source position) for anything outside it.
|
|
57
|
+
- NetworkX-style helpers: `add_node`, `add_edge`, `neighbors`, `has_node`,
|
|
58
|
+
`has_edge`, `remove_node`, `remove_edge`, `nodes`, `edges`.
|
|
59
|
+
- `graph-ted-db` CLI (alias `graphted-db`): `init`, `info`, node and edge
|
|
60
|
+
CRUD, `compact`, `doctor` (repairs torn lines and reports dangling edges;
|
|
61
|
+
`--fix` tombstones them), `cypher`, `serve`, `--version`.
|
|
62
|
+
- `updated_by` (record author) is empty by default and never taken from the
|
|
63
|
+
OS login name. Set it with `--by` / `--updated-by` on CLI writes, the
|
|
64
|
+
`GRAPH_TED_DB_UPDATED_BY` environment variable, or `updated_by=` in Python.
|
|
65
|
+
- `graph-ted-db serve`: optional localhost JSON-over-HTTP endpoint
|
|
66
|
+
(`/health`, `/info`, `/cypher`, atomic `statements` batches). Binding
|
|
67
|
+
beyond loopback requires a token. `/health`, the one route open without a
|
|
68
|
+
token, does not include the folder path.
|
|
69
|
+
- Optional Graphiti driver (`graph_ted_db.driver.GraphTedDbDriver`), in-process
|
|
70
|
+
or over HTTP.
|
|
71
|
+
- Documentation site with `llms.txt` and `llms-full.txt`.
|
|
72
|
+
|
|
73
|
+
[Unreleased]: https://github.com/graph-ted/graph-ted-db/compare/v0.1.0...HEAD
|
|
74
|
+
[0.1.0]: https://github.com/graph-ted/graph-ted-db/releases/tag/v0.1.0
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 graph-ted-db contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Meta package is built from packages/graphted, not shipped inside graph-ted-db.
|
|
2
|
+
prune packages
|
|
3
|
+
# The sdist is the library plus README, LICENSE and CHANGELOG. Tests need the
|
|
4
|
+
# repo's scripts, docs and fixtures, so they stay in git, not in the sdist.
|
|
5
|
+
prune tests
|
|
6
|
+
prune reports
|
|
7
|
+
prune docs
|
|
8
|
+
prune scripts
|
|
9
|
+
include CHANGELOG.md
|
|
10
|
+
global-exclude *.py[cod] __pycache__
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: graph-ted-db
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Local property-graph storage for Python. Data lives in a folder; open and query it in-process, with no database server for the default path.
|
|
5
|
+
Author: graph-ted-db contributors
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://graph-ted.com/graph-ted-db/
|
|
8
|
+
Project-URL: Documentation, https://graph-ted.com/graph-ted-db/docs/
|
|
9
|
+
Project-URL: Source, https://github.com/graph-ted/graph-ted-db
|
|
10
|
+
Project-URL: Issues, https://github.com/graph-ted/graph-ted-db/issues
|
|
11
|
+
Project-URL: Changelog, https://github.com/graph-ted/graph-ted-db/blob/main/CHANGELOG.md
|
|
12
|
+
Keywords: graph,property-graph,graph-database,opencypher,local-first,embedded
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
+
Classifier: Topic :: Database
|
|
24
|
+
Classifier: Topic :: Database :: Database Engines/Servers
|
|
25
|
+
Requires-Python: >=3.10
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
<p align="center">
|
|
33
|
+
<img src="https://graph-ted.com/graph-ted-db/docs/assets/logo-readme.png" alt="graph-ted-db" width="340" height="116">
|
|
34
|
+
</p>
|
|
35
|
+
|
|
36
|
+
<!-- Images and links use absolute URLs so they render on PyPI. The logo is served by the docs site. -->
|
|
37
|
+
|
|
38
|
+
# graph-ted-db
|
|
39
|
+
|
|
40
|
+
Local property-graph storage for Python. Your data lives in a folder on disk; open it from your process, query it in-process, and optionally sync that folder like any other files. No database server to run for the default path.
|
|
41
|
+
|
|
42
|
+
**Package:** `graph-ted-db` · **Import:** `graph_ted_db` · **Repo:** [graph-ted/graph-ted-db](https://github.com/graph-ted/graph-ted-db) · **License:** MIT
|
|
43
|
+
|
|
44
|
+
> Status: the public API and on-disk format below are what we ship. `pip install graph-ted-db` is the intended install; until the package is on PyPI, use a checkout (`pip install -e .`) or a wheel path.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Install
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pip install graph-ted-db
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Requires Python 3.10+.
|
|
55
|
+
|
|
56
|
+
## Quick start
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
from graph_ted_db import GraphStore, init_graph
|
|
60
|
+
|
|
61
|
+
init_graph("./my-graph", name="demo", exist_ok=True)
|
|
62
|
+
g = GraphStore.open("./my-graph")
|
|
63
|
+
|
|
64
|
+
alice = g.make_node(labels=["Person"], props={"name": "Alice"})
|
|
65
|
+
bob = g.make_node(labels=["Person"], props={"name": "Bob"})
|
|
66
|
+
g.make_edge(type="KNOWS", from_id=alice.id, to_id=bob.id)
|
|
67
|
+
|
|
68
|
+
print(g.get_node(alice.id).props["name"])
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
CLI:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
graph-ted-db init ./my-graph --name demo --exist-ok
|
|
75
|
+
graph-ted-db put-node ./my-graph --label Person --prop name=Alice
|
|
76
|
+
graph-ted-db ls-nodes ./my-graph
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
`graphted-db` is an alias for the same command.
|
|
80
|
+
|
|
81
|
+
Optional HTTP (localhost only by default; see [HTTP docs](https://graph-ted.com/graph-ted-db/docs/http/)):
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
graph-ted-db serve ./my-graph
|
|
85
|
+
# in another terminal:
|
|
86
|
+
curl -s http://127.0.0.1:8099/health
|
|
87
|
+
curl -s http://127.0.0.1:8099/cypher -H 'Content-Type: application/json' \
|
|
88
|
+
-d '{"query":"MATCH (n:Person) RETURN n.name AS name"}'
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Features
|
|
92
|
+
|
|
93
|
+
- **Folder = database** — nodes, edges, and embeddings as sharded JSONL; readable, backupable, syncable
|
|
94
|
+
- **In-process API** — `put` / `get` / `iter` / `delete` without opening a network port
|
|
95
|
+
- **openCypher queries** — `g.execute(...)` runs a documented subset of openCypher for graph-pattern queries ([openCypher subset](https://graph-ted.com/graph-ted-db/docs/cypher/))
|
|
96
|
+
- **Optional HTTP** — localhost endpoint for openCypher queries when another process needs the store ([HTTP docs](https://graph-ted.com/graph-ted-db/docs/http/))
|
|
97
|
+
- **Sync-friendly** — multiple devices can write at once; last-write-wins per record; conflict-copy shards merged on read
|
|
98
|
+
- **NetworkX-style helpers** — `add_node`, `add_edge`, `neighbors`, and related methods on the same `GraphStore` (no algorithm suite)
|
|
99
|
+
|
|
100
|
+
## What it is and isn't
|
|
101
|
+
|
|
102
|
+
**It is:**
|
|
103
|
+
|
|
104
|
+
- A Python library that stores a property graph (nodes, edges, properties, embeddings) as plain JSONL files in one folder.
|
|
105
|
+
- In-process: open, read, write and query from your own Python process. No server to install or run.
|
|
106
|
+
- A documented subset of openCypher, plus NetworkX-style helpers.
|
|
107
|
+
- Sync-friendly across devices: multiple devices can add and edit at the same time; concurrent edits to the same record resolve to the latest version. The folder can live in OneDrive, Dropbox or an `rclone bisync` folder (see [Sharing](https://graph-ted.com/graph-ted-db/docs/sharing/)).
|
|
108
|
+
- Small: no runtime dependencies beyond the Python standard library.
|
|
109
|
+
|
|
110
|
+
**It isn't:**
|
|
111
|
+
|
|
112
|
+
- A database server, a hosted service or a multi-tenant system. The optional HTTP endpoint is for local processes on the same machine.
|
|
113
|
+
- Encrypted. Files are ordinary files; protect them with disk encryption and OS permissions.
|
|
114
|
+
- A complete Cypher implementation or a Neo4j replacement. Unsupported clauses fail with an error rather than being ignored.
|
|
115
|
+
- A graph-algorithm library. Use NetworkX or similar on exported data.
|
|
116
|
+
- Built for very large graphs. The whole graph is loaded into memory when it opens; see the tested sizes in [Overview](https://graph-ted.com/graph-ted-db/docs/overview/).
|
|
117
|
+
- Stable across minor versions before 1.0 (see [Versioning](#versioning)).
|
|
118
|
+
- Telemetry-enabled. It makes no network calls of its own.
|
|
119
|
+
|
|
120
|
+
## When to use it
|
|
121
|
+
|
|
122
|
+
Good fit for prototypes, local tools, agents, and small trusted groups that want a property graph next to the app.
|
|
123
|
+
|
|
124
|
+
Choose a server graph database when you need multi-tenant hosting, fine-grained remote auth, or a complete query language and enterprise feature set out of the box.
|
|
125
|
+
|
|
126
|
+
## Security
|
|
127
|
+
|
|
128
|
+
Data is stored as ordinary files. The library does **not** encrypt the graph folder. Security matches your environment: disk or volume encryption, OS account permissions, backups, sync tools, and whether anything listens on the network.
|
|
129
|
+
|
|
130
|
+
- **Airgapped host + encrypted volume** — can be very strong; treat that environment as your boundary.
|
|
131
|
+
- **Synced or shared folders** — anyone with access to the folder can read what you stored (including properties).
|
|
132
|
+
- **HTTP serve** — defaults to localhost; binding beyond loopback requires an explicit host and a token. That protects the port, not the files on disk.
|
|
133
|
+
|
|
134
|
+
Choose storage and network to match how sensitive the data is.
|
|
135
|
+
|
|
136
|
+
## Documentation
|
|
137
|
+
|
|
138
|
+
Docs: [graph-ted.com/graph-ted-db/docs](https://graph-ted.com/graph-ted-db/docs/), built from the `docs/` folder in this repository. Preview locally: see [PREVIEW.md](https://github.com/graph-ted/graph-ted-db/blob/main/PREVIEW.md).
|
|
139
|
+
|
|
140
|
+
| Doc | Contents |
|
|
141
|
+
|-----|----------|
|
|
142
|
+
| [Overview](https://graph-ted.com/graph-ted-db/docs/overview/) | Product overview |
|
|
143
|
+
| [On-disk format](https://graph-ted.com/graph-ted-db/docs/format/) | On-disk layout |
|
|
144
|
+
| [openCypher subset](https://graph-ted.com/graph-ted-db/docs/cypher/) | Supported openCypher subset |
|
|
145
|
+
| [Trademarks](https://graph-ted.com/graph-ted-db/docs/trademarks/) | Trademarks |
|
|
146
|
+
| [HTTP](https://graph-ted.com/graph-ted-db/docs/http/) | Local HTTP serve |
|
|
147
|
+
|
|
148
|
+
## Trademarks
|
|
149
|
+
|
|
150
|
+
openCypher is a trademark of Neo4j, Inc. Other names are trademarks of their respective owners; no endorsement implied. See [Trademarks](https://graph-ted.com/graph-ted-db/docs/trademarks/).
|
|
151
|
+
|
|
152
|
+
## Versioning
|
|
153
|
+
|
|
154
|
+
Pre-1.0 (`0.1.0`). Until 1.0.0, minor versions may include breaking changes; they are noted in release notes. From 1.0.0, breaking changes bump the major version.
|
|
155
|
+
|
|
156
|
+
## Development
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
pip install -e ".[dev]"
|
|
160
|
+
pytest
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Feedback and issues
|
|
164
|
+
|
|
165
|
+
- **Bugs, enhancement requests, docs problems:** [open an issue](https://github.com/graph-ted/graph-ted-db/issues/new/choose) using one of the forms.
|
|
166
|
+
- **Questions and ideas:** [Discussions](https://github.com/graph-ted/graph-ted-db/discussions).
|
|
167
|
+
- **Security vulnerabilities:** report privately as described in [SECURITY.md](https://github.com/graph-ted/graph-ted-db/blob/main/SECURITY.md), never in a public issue.
|
|
168
|
+
|
|
169
|
+
Contributing: see [CONTRIBUTING.md](https://github.com/graph-ted/graph-ted-db/blob/main/CONTRIBUTING.md).
|
|
170
|
+
|
|
171
|
+
## Related
|
|
172
|
+
|
|
173
|
+
graph-ted-db is the local store for the graph-ted toolkit ([graph-ted.com](https://graph-ted.com/)). This repository is the database library only.
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://graph-ted.com/graph-ted-db/docs/assets/logo-readme.png" alt="graph-ted-db" width="340" height="116">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<!-- Images and links use absolute URLs so they render on PyPI. The logo is served by the docs site. -->
|
|
6
|
+
|
|
7
|
+
# graph-ted-db
|
|
8
|
+
|
|
9
|
+
Local property-graph storage for Python. Your data lives in a folder on disk; open it from your process, query it in-process, and optionally sync that folder like any other files. No database server to run for the default path.
|
|
10
|
+
|
|
11
|
+
**Package:** `graph-ted-db` · **Import:** `graph_ted_db` · **Repo:** [graph-ted/graph-ted-db](https://github.com/graph-ted/graph-ted-db) · **License:** MIT
|
|
12
|
+
|
|
13
|
+
> Status: the public API and on-disk format below are what we ship. `pip install graph-ted-db` is the intended install; until the package is on PyPI, use a checkout (`pip install -e .`) or a wheel path.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pip install graph-ted-db
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Requires Python 3.10+.
|
|
24
|
+
|
|
25
|
+
## Quick start
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
from graph_ted_db import GraphStore, init_graph
|
|
29
|
+
|
|
30
|
+
init_graph("./my-graph", name="demo", exist_ok=True)
|
|
31
|
+
g = GraphStore.open("./my-graph")
|
|
32
|
+
|
|
33
|
+
alice = g.make_node(labels=["Person"], props={"name": "Alice"})
|
|
34
|
+
bob = g.make_node(labels=["Person"], props={"name": "Bob"})
|
|
35
|
+
g.make_edge(type="KNOWS", from_id=alice.id, to_id=bob.id)
|
|
36
|
+
|
|
37
|
+
print(g.get_node(alice.id).props["name"])
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
CLI:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
graph-ted-db init ./my-graph --name demo --exist-ok
|
|
44
|
+
graph-ted-db put-node ./my-graph --label Person --prop name=Alice
|
|
45
|
+
graph-ted-db ls-nodes ./my-graph
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
`graphted-db` is an alias for the same command.
|
|
49
|
+
|
|
50
|
+
Optional HTTP (localhost only by default; see [HTTP docs](https://graph-ted.com/graph-ted-db/docs/http/)):
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
graph-ted-db serve ./my-graph
|
|
54
|
+
# in another terminal:
|
|
55
|
+
curl -s http://127.0.0.1:8099/health
|
|
56
|
+
curl -s http://127.0.0.1:8099/cypher -H 'Content-Type: application/json' \
|
|
57
|
+
-d '{"query":"MATCH (n:Person) RETURN n.name AS name"}'
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Features
|
|
61
|
+
|
|
62
|
+
- **Folder = database** — nodes, edges, and embeddings as sharded JSONL; readable, backupable, syncable
|
|
63
|
+
- **In-process API** — `put` / `get` / `iter` / `delete` without opening a network port
|
|
64
|
+
- **openCypher queries** — `g.execute(...)` runs a documented subset of openCypher for graph-pattern queries ([openCypher subset](https://graph-ted.com/graph-ted-db/docs/cypher/))
|
|
65
|
+
- **Optional HTTP** — localhost endpoint for openCypher queries when another process needs the store ([HTTP docs](https://graph-ted.com/graph-ted-db/docs/http/))
|
|
66
|
+
- **Sync-friendly** — multiple devices can write at once; last-write-wins per record; conflict-copy shards merged on read
|
|
67
|
+
- **NetworkX-style helpers** — `add_node`, `add_edge`, `neighbors`, and related methods on the same `GraphStore` (no algorithm suite)
|
|
68
|
+
|
|
69
|
+
## What it is and isn't
|
|
70
|
+
|
|
71
|
+
**It is:**
|
|
72
|
+
|
|
73
|
+
- A Python library that stores a property graph (nodes, edges, properties, embeddings) as plain JSONL files in one folder.
|
|
74
|
+
- In-process: open, read, write and query from your own Python process. No server to install or run.
|
|
75
|
+
- A documented subset of openCypher, plus NetworkX-style helpers.
|
|
76
|
+
- Sync-friendly across devices: multiple devices can add and edit at the same time; concurrent edits to the same record resolve to the latest version. The folder can live in OneDrive, Dropbox or an `rclone bisync` folder (see [Sharing](https://graph-ted.com/graph-ted-db/docs/sharing/)).
|
|
77
|
+
- Small: no runtime dependencies beyond the Python standard library.
|
|
78
|
+
|
|
79
|
+
**It isn't:**
|
|
80
|
+
|
|
81
|
+
- A database server, a hosted service or a multi-tenant system. The optional HTTP endpoint is for local processes on the same machine.
|
|
82
|
+
- Encrypted. Files are ordinary files; protect them with disk encryption and OS permissions.
|
|
83
|
+
- A complete Cypher implementation or a Neo4j replacement. Unsupported clauses fail with an error rather than being ignored.
|
|
84
|
+
- A graph-algorithm library. Use NetworkX or similar on exported data.
|
|
85
|
+
- Built for very large graphs. The whole graph is loaded into memory when it opens; see the tested sizes in [Overview](https://graph-ted.com/graph-ted-db/docs/overview/).
|
|
86
|
+
- Stable across minor versions before 1.0 (see [Versioning](#versioning)).
|
|
87
|
+
- Telemetry-enabled. It makes no network calls of its own.
|
|
88
|
+
|
|
89
|
+
## When to use it
|
|
90
|
+
|
|
91
|
+
Good fit for prototypes, local tools, agents, and small trusted groups that want a property graph next to the app.
|
|
92
|
+
|
|
93
|
+
Choose a server graph database when you need multi-tenant hosting, fine-grained remote auth, or a complete query language and enterprise feature set out of the box.
|
|
94
|
+
|
|
95
|
+
## Security
|
|
96
|
+
|
|
97
|
+
Data is stored as ordinary files. The library does **not** encrypt the graph folder. Security matches your environment: disk or volume encryption, OS account permissions, backups, sync tools, and whether anything listens on the network.
|
|
98
|
+
|
|
99
|
+
- **Airgapped host + encrypted volume** — can be very strong; treat that environment as your boundary.
|
|
100
|
+
- **Synced or shared folders** — anyone with access to the folder can read what you stored (including properties).
|
|
101
|
+
- **HTTP serve** — defaults to localhost; binding beyond loopback requires an explicit host and a token. That protects the port, not the files on disk.
|
|
102
|
+
|
|
103
|
+
Choose storage and network to match how sensitive the data is.
|
|
104
|
+
|
|
105
|
+
## Documentation
|
|
106
|
+
|
|
107
|
+
Docs: [graph-ted.com/graph-ted-db/docs](https://graph-ted.com/graph-ted-db/docs/), built from the `docs/` folder in this repository. Preview locally: see [PREVIEW.md](https://github.com/graph-ted/graph-ted-db/blob/main/PREVIEW.md).
|
|
108
|
+
|
|
109
|
+
| Doc | Contents |
|
|
110
|
+
|-----|----------|
|
|
111
|
+
| [Overview](https://graph-ted.com/graph-ted-db/docs/overview/) | Product overview |
|
|
112
|
+
| [On-disk format](https://graph-ted.com/graph-ted-db/docs/format/) | On-disk layout |
|
|
113
|
+
| [openCypher subset](https://graph-ted.com/graph-ted-db/docs/cypher/) | Supported openCypher subset |
|
|
114
|
+
| [Trademarks](https://graph-ted.com/graph-ted-db/docs/trademarks/) | Trademarks |
|
|
115
|
+
| [HTTP](https://graph-ted.com/graph-ted-db/docs/http/) | Local HTTP serve |
|
|
116
|
+
|
|
117
|
+
## Trademarks
|
|
118
|
+
|
|
119
|
+
openCypher is a trademark of Neo4j, Inc. Other names are trademarks of their respective owners; no endorsement implied. See [Trademarks](https://graph-ted.com/graph-ted-db/docs/trademarks/).
|
|
120
|
+
|
|
121
|
+
## Versioning
|
|
122
|
+
|
|
123
|
+
Pre-1.0 (`0.1.0`). Until 1.0.0, minor versions may include breaking changes; they are noted in release notes. From 1.0.0, breaking changes bump the major version.
|
|
124
|
+
|
|
125
|
+
## Development
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
pip install -e ".[dev]"
|
|
129
|
+
pytest
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Feedback and issues
|
|
133
|
+
|
|
134
|
+
- **Bugs, enhancement requests, docs problems:** [open an issue](https://github.com/graph-ted/graph-ted-db/issues/new/choose) using one of the forms.
|
|
135
|
+
- **Questions and ideas:** [Discussions](https://github.com/graph-ted/graph-ted-db/discussions).
|
|
136
|
+
- **Security vulnerabilities:** report privately as described in [SECURITY.md](https://github.com/graph-ted/graph-ted-db/blob/main/SECURITY.md), never in a public issue.
|
|
137
|
+
|
|
138
|
+
Contributing: see [CONTRIBUTING.md](https://github.com/graph-ted/graph-ted-db/blob/main/CONTRIBUTING.md).
|
|
139
|
+
|
|
140
|
+
## Related
|
|
141
|
+
|
|
142
|
+
graph-ted-db is the local store for the graph-ted toolkit ([graph-ted.com](https://graph-ted.com/)). This repository is the database library only.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""Local property-graph storage for Python: open a folder and query it in-process (import graph_ted_db)."""
|
|
2
|
+
|
|
3
|
+
from graph_ted_db.engine import CypherError
|
|
4
|
+
from graph_ted_db.store import (
|
|
5
|
+
EdgeRecord,
|
|
6
|
+
GraphStore,
|
|
7
|
+
NodeRecord,
|
|
8
|
+
Tombstone,
|
|
9
|
+
VectorRecord,
|
|
10
|
+
init_graph,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
__version__ = "0.1.0"
|
|
14
|
+
__all__ = [
|
|
15
|
+
"CypherError",
|
|
16
|
+
"EdgeRecord",
|
|
17
|
+
"GraphStore",
|
|
18
|
+
"NodeRecord",
|
|
19
|
+
"Tombstone",
|
|
20
|
+
"VectorRecord",
|
|
21
|
+
"__version__",
|
|
22
|
+
"init_graph",
|
|
23
|
+
]
|