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.
Files changed (36) hide show
  1. {coffy-0.1.0/coffy.egg-info → coffy-0.1.1}/PKG-INFO +5 -5
  2. {coffy-0.1.0 → coffy-0.1.1}/README.md +4 -4
  3. coffy-0.1.1/coffy/graph/__pycache__/graphdb_nx.cpython-312.pyc +0 -0
  4. {coffy-0.1.0 → coffy-0.1.1}/coffy/graph/graphdb_nx.py +28 -2
  5. {coffy-0.1.0 → coffy-0.1.1/coffy.egg-info}/PKG-INFO +5 -5
  6. {coffy-0.1.0 → coffy-0.1.1}/setup.py +1 -1
  7. coffy-0.1.0/coffy/graph/__pycache__/graphdb_nx.cpython-312.pyc +0 -0
  8. {coffy-0.1.0 → coffy-0.1.1}/LICENSE +0 -0
  9. {coffy-0.1.0 → coffy-0.1.1}/MANIFEST.in +0 -0
  10. {coffy-0.1.0 → coffy-0.1.1}/coffy/__init__.py +0 -0
  11. {coffy-0.1.0 → coffy-0.1.1}/coffy/__pycache__/__init__.cpython-311.pyc +0 -0
  12. {coffy-0.1.0 → coffy-0.1.1}/coffy/__pycache__/__init__.cpython-312.pyc +0 -0
  13. {coffy-0.1.0 → coffy-0.1.1}/coffy/graph/__init__.py +0 -0
  14. {coffy-0.1.0 → coffy-0.1.1}/coffy/graph/__pycache__/__init__.cpython-312.pyc +0 -0
  15. {coffy-0.1.0 → coffy-0.1.1}/coffy/nosql/__init__.py +0 -0
  16. {coffy-0.1.0 → coffy-0.1.1}/coffy/nosql/__pycache__/__init__.cpython-311.pyc +0 -0
  17. {coffy-0.1.0 → coffy-0.1.1}/coffy/nosql/__pycache__/__init__.cpython-312.pyc +0 -0
  18. {coffy-0.1.0 → coffy-0.1.1}/coffy/nosql/__pycache__/engine.cpython-311.pyc +0 -0
  19. {coffy-0.1.0 → coffy-0.1.1}/coffy/nosql/__pycache__/engine.cpython-312.pyc +0 -0
  20. {coffy-0.1.0 → coffy-0.1.1}/coffy/nosql/engine.py +0 -0
  21. {coffy-0.1.0 → coffy-0.1.1}/coffy/sql/__init__.py +0 -0
  22. {coffy-0.1.0 → coffy-0.1.1}/coffy/sql/__pycache__/__init__.cpython-311.pyc +0 -0
  23. {coffy-0.1.0 → coffy-0.1.1}/coffy/sql/__pycache__/__init__.cpython-312.pyc +0 -0
  24. {coffy-0.1.0 → coffy-0.1.1}/coffy/sql/__pycache__/engine.cpython-311.pyc +0 -0
  25. {coffy-0.1.0 → coffy-0.1.1}/coffy/sql/__pycache__/engine.cpython-312.pyc +0 -0
  26. {coffy-0.1.0 → coffy-0.1.1}/coffy/sql/__pycache__/io.cpython-312.pyc +0 -0
  27. {coffy-0.1.0 → coffy-0.1.1}/coffy/sql/__pycache__/sqldict.cpython-311.pyc +0 -0
  28. {coffy-0.1.0 → coffy-0.1.1}/coffy/sql/__pycache__/sqldict.cpython-312.pyc +0 -0
  29. {coffy-0.1.0 → coffy-0.1.1}/coffy/sql/engine.py +0 -0
  30. {coffy-0.1.0 → coffy-0.1.1}/coffy/sql/sqldict.py +0 -0
  31. {coffy-0.1.0 → coffy-0.1.1}/coffy.egg-info/SOURCES.txt +0 -0
  32. {coffy-0.1.0 → coffy-0.1.1}/coffy.egg-info/dependency_links.txt +0 -0
  33. {coffy-0.1.0 → coffy-0.1.1}/coffy.egg-info/requires.txt +0 -0
  34. {coffy-0.1.0 → coffy-0.1.1}/coffy.egg-info/top_level.txt +0 -0
  35. {coffy-0.1.0 → coffy-0.1.1}/pyproject.toml +0 -0
  36. {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.0
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 minimal wrapper over SQLite for executing raw SQL with clean tabular results
28
- - `coffy.graph`: An in-memory graph engine built on `networkx` with advanced filtering and logic-based querying
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 file-based if initialized with a path
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
- - Returns clean structured output, easy to extend
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 minimal wrapper over SQLite for executing raw SQL with clean tabular results
7
- - `coffy.graph`: An in-memory graph engine built on `networkx` with advanced filtering and logic-based querying
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 file-based if initialized with a path
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
- - Returns clean structured output, easy to extend
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
 
@@ -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.0
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 minimal wrapper over SQLite for executing raw SQL with clean tabular results
28
- - `coffy.graph`: An in-memory graph engine built on `networkx` with advanced filtering and logic-based querying
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 file-based if initialized with a path
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
- - Returns clean structured output, easy to extend
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.0",
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(),
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