coffy 0.1.0__tar.gz → 0.1.1__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.
- {coffy-0.1.0/coffy.egg-info → coffy-0.1.1}/PKG-INFO +5 -5
- {coffy-0.1.0 → coffy-0.1.1}/README.md +4 -4
- coffy-0.1.1/coffy/graph/__pycache__/graphdb_nx.cpython-312.pyc +0 -0
- {coffy-0.1.0 → coffy-0.1.1}/coffy/graph/graphdb_nx.py +28 -2
- {coffy-0.1.0 → coffy-0.1.1/coffy.egg-info}/PKG-INFO +5 -5
- {coffy-0.1.0 → coffy-0.1.1}/setup.py +1 -1
- coffy-0.1.0/coffy/graph/__pycache__/graphdb_nx.cpython-312.pyc +0 -0
- {coffy-0.1.0 → coffy-0.1.1}/LICENSE +0 -0
- {coffy-0.1.0 → coffy-0.1.1}/MANIFEST.in +0 -0
- {coffy-0.1.0 → coffy-0.1.1}/coffy/__init__.py +0 -0
- {coffy-0.1.0 → coffy-0.1.1}/coffy/__pycache__/__init__.cpython-311.pyc +0 -0
- {coffy-0.1.0 → coffy-0.1.1}/coffy/__pycache__/__init__.cpython-312.pyc +0 -0
- {coffy-0.1.0 → coffy-0.1.1}/coffy/graph/__init__.py +0 -0
- {coffy-0.1.0 → coffy-0.1.1}/coffy/graph/__pycache__/__init__.cpython-312.pyc +0 -0
- {coffy-0.1.0 → coffy-0.1.1}/coffy/nosql/__init__.py +0 -0
- {coffy-0.1.0 → coffy-0.1.1}/coffy/nosql/__pycache__/__init__.cpython-311.pyc +0 -0
- {coffy-0.1.0 → coffy-0.1.1}/coffy/nosql/__pycache__/__init__.cpython-312.pyc +0 -0
- {coffy-0.1.0 → coffy-0.1.1}/coffy/nosql/__pycache__/engine.cpython-311.pyc +0 -0
- {coffy-0.1.0 → coffy-0.1.1}/coffy/nosql/__pycache__/engine.cpython-312.pyc +0 -0
- {coffy-0.1.0 → coffy-0.1.1}/coffy/nosql/engine.py +0 -0
- {coffy-0.1.0 → coffy-0.1.1}/coffy/sql/__init__.py +0 -0
- {coffy-0.1.0 → coffy-0.1.1}/coffy/sql/__pycache__/__init__.cpython-311.pyc +0 -0
- {coffy-0.1.0 → coffy-0.1.1}/coffy/sql/__pycache__/__init__.cpython-312.pyc +0 -0
- {coffy-0.1.0 → coffy-0.1.1}/coffy/sql/__pycache__/engine.cpython-311.pyc +0 -0
- {coffy-0.1.0 → coffy-0.1.1}/coffy/sql/__pycache__/engine.cpython-312.pyc +0 -0
- {coffy-0.1.0 → coffy-0.1.1}/coffy/sql/__pycache__/io.cpython-312.pyc +0 -0
- {coffy-0.1.0 → coffy-0.1.1}/coffy/sql/__pycache__/sqldict.cpython-311.pyc +0 -0
- {coffy-0.1.0 → coffy-0.1.1}/coffy/sql/__pycache__/sqldict.cpython-312.pyc +0 -0
- {coffy-0.1.0 → coffy-0.1.1}/coffy/sql/engine.py +0 -0
- {coffy-0.1.0 → coffy-0.1.1}/coffy/sql/sqldict.py +0 -0
- {coffy-0.1.0 → coffy-0.1.1}/coffy.egg-info/SOURCES.txt +0 -0
- {coffy-0.1.0 → coffy-0.1.1}/coffy.egg-info/dependency_links.txt +0 -0
- {coffy-0.1.0 → coffy-0.1.1}/coffy.egg-info/requires.txt +0 -0
- {coffy-0.1.0 → coffy-0.1.1}/coffy.egg-info/top_level.txt +0 -0
- {coffy-0.1.0 → coffy-0.1.1}/pyproject.toml +0 -0
- {coffy-0.1.0 → coffy-0.1.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: coffy
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.1
|
4
4
|
Summary: Lightweight local NoSQL, SQL, and Graph embedded database engine
|
5
5
|
Author: nsarathy
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
@@ -24,8 +24,8 @@ Dynamic: summary
|
|
24
24
|
**Coffy** is a lightweight embedded database engine for Python, designed for local-first apps, scripts, and tools. It includes:
|
25
25
|
|
26
26
|
- `coffy.nosql`: A simple JSON-backed NoSQL engine with a fluent, chainable query interface
|
27
|
-
- `coffy.sql`: A
|
28
|
-
- `coffy.graph`: An
|
27
|
+
- `coffy.sql`: A wrapper over SQLite for executing raw SQL with clean tabular results
|
28
|
+
- `coffy.graph`: An graph engine built on `networkx` with advanced filtering and logic-based querying
|
29
29
|
|
30
30
|
No dependencies (except `networkx`). No boilerplate. Just data.
|
31
31
|
|
@@ -55,7 +55,7 @@ pip install coffy
|
|
55
55
|
|
56
56
|
- SQLite-backed engine with raw SQL query support
|
57
57
|
- Outputs as readable tables or exportable lists
|
58
|
-
- Uses in-memory DB by default, or
|
58
|
+
- Uses in-memory DB by default, or json-based if initialized with a path
|
59
59
|
|
60
60
|
📄 [SQL Documentation →](./SQL_DOCS.md)
|
61
61
|
|
@@ -65,7 +65,7 @@ pip install coffy
|
|
65
65
|
|
66
66
|
- Wrapper around `networkx` with simplified node/relationship API
|
67
67
|
- Query nodes and relationships using filters like `gt`, `lt`, `eq`, `or`, `not`
|
68
|
-
-
|
68
|
+
- Uses in-memory DB by default, or json-based if initialized with a path
|
69
69
|
|
70
70
|
📄 [Graph Documentation →](./GRAPH_DOCS.md)
|
71
71
|
|
@@ -3,8 +3,8 @@
|
|
3
3
|
**Coffy** is a lightweight embedded database engine for Python, designed for local-first apps, scripts, and tools. It includes:
|
4
4
|
|
5
5
|
- `coffy.nosql`: A simple JSON-backed NoSQL engine with a fluent, chainable query interface
|
6
|
-
- `coffy.sql`: A
|
7
|
-
- `coffy.graph`: An
|
6
|
+
- `coffy.sql`: A wrapper over SQLite for executing raw SQL with clean tabular results
|
7
|
+
- `coffy.graph`: An graph engine built on `networkx` with advanced filtering and logic-based querying
|
8
8
|
|
9
9
|
No dependencies (except `networkx`). No boilerplate. Just data.
|
10
10
|
|
@@ -34,7 +34,7 @@ pip install coffy
|
|
34
34
|
|
35
35
|
- SQLite-backed engine with raw SQL query support
|
36
36
|
- Outputs as readable tables or exportable lists
|
37
|
-
- Uses in-memory DB by default, or
|
37
|
+
- Uses in-memory DB by default, or json-based if initialized with a path
|
38
38
|
|
39
39
|
📄 [SQL Documentation →](./SQL_DOCS.md)
|
40
40
|
|
@@ -44,7 +44,7 @@ pip install coffy
|
|
44
44
|
|
45
45
|
- Wrapper around `networkx` with simplified node/relationship API
|
46
46
|
- Query nodes and relationships using filters like `gt`, `lt`, `eq`, `or`, `not`
|
47
|
-
-
|
47
|
+
- Uses in-memory DB by default, or json-based if initialized with a path
|
48
48
|
|
49
49
|
📄 [Graph Documentation →](./GRAPH_DOCS.md)
|
50
50
|
|
Binary file
|
@@ -1,8 +1,14 @@
|
|
1
1
|
import networkx as nx
|
2
|
+
import json
|
3
|
+
import os
|
2
4
|
|
3
5
|
class GraphDB:
|
4
|
-
def __init__(self, directed=False):
|
6
|
+
def __init__(self, directed=False, path=None):
|
5
7
|
self.g = nx.DiGraph() if directed else nx.Graph()
|
8
|
+
self.directed = directed
|
9
|
+
self.path = path
|
10
|
+
if path and os.path.exists(path):
|
11
|
+
self.load(path)
|
6
12
|
|
7
13
|
# Node operations
|
8
14
|
def add_node(self, node_id, **attrs):
|
@@ -96,4 +102,24 @@ class GraphDB:
|
|
96
102
|
return {
|
97
103
|
"nodes": self.nodes(),
|
98
104
|
"relationships": self.relationships()
|
99
|
-
}
|
105
|
+
}
|
106
|
+
|
107
|
+
def save(self, path=None):
|
108
|
+
path = path or self.path
|
109
|
+
if not path:
|
110
|
+
raise ValueError("No path specified to save the graph.")
|
111
|
+
with open(path, "w", encoding="utf-8") as f:
|
112
|
+
json.dump(self.to_dict(), f, indent=4)
|
113
|
+
|
114
|
+
def load(self, path=None):
|
115
|
+
path = path or self.path
|
116
|
+
if not path:
|
117
|
+
raise ValueError("No path specified to load the graph.")
|
118
|
+
with open(path, "r", encoding="utf-8") as f:
|
119
|
+
data = json.load(f)
|
120
|
+
self.g.clear()
|
121
|
+
for node in data.get("nodes", []):
|
122
|
+
self.add_node(node["id"], **{k: v for k, v in node.items() if k != "id"})
|
123
|
+
for rel in data.get("relationships", []):
|
124
|
+
self.add_relationship(rel["source"], rel["target"],
|
125
|
+
**{k: v for k, v in rel.items() if k not in ["source", "target"]})
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: coffy
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.1
|
4
4
|
Summary: Lightweight local NoSQL, SQL, and Graph embedded database engine
|
5
5
|
Author: nsarathy
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
@@ -24,8 +24,8 @@ Dynamic: summary
|
|
24
24
|
**Coffy** is a lightweight embedded database engine for Python, designed for local-first apps, scripts, and tools. It includes:
|
25
25
|
|
26
26
|
- `coffy.nosql`: A simple JSON-backed NoSQL engine with a fluent, chainable query interface
|
27
|
-
- `coffy.sql`: A
|
28
|
-
- `coffy.graph`: An
|
27
|
+
- `coffy.sql`: A wrapper over SQLite for executing raw SQL with clean tabular results
|
28
|
+
- `coffy.graph`: An graph engine built on `networkx` with advanced filtering and logic-based querying
|
29
29
|
|
30
30
|
No dependencies (except `networkx`). No boilerplate. Just data.
|
31
31
|
|
@@ -55,7 +55,7 @@ pip install coffy
|
|
55
55
|
|
56
56
|
- SQLite-backed engine with raw SQL query support
|
57
57
|
- Outputs as readable tables or exportable lists
|
58
|
-
- Uses in-memory DB by default, or
|
58
|
+
- Uses in-memory DB by default, or json-based if initialized with a path
|
59
59
|
|
60
60
|
📄 [SQL Documentation →](./SQL_DOCS.md)
|
61
61
|
|
@@ -65,7 +65,7 @@ pip install coffy
|
|
65
65
|
|
66
66
|
- Wrapper around `networkx` with simplified node/relationship API
|
67
67
|
- Query nodes and relationships using filters like `gt`, `lt`, `eq`, `or`, `not`
|
68
|
-
-
|
68
|
+
- Uses in-memory DB by default, or json-based if initialized with a path
|
69
69
|
|
70
70
|
📄 [Graph Documentation →](./GRAPH_DOCS.md)
|
71
71
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
2
2
|
|
3
3
|
setup(
|
4
4
|
name="coffy",
|
5
|
-
version="0.1.
|
5
|
+
version="0.1.1",
|
6
6
|
author="nsarathy",
|
7
7
|
description="Lightweight local NoSQL, SQL, and Graph embedded database engine",
|
8
8
|
long_description=open("README.md", encoding="utf-8").read(),
|
Binary file
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|