graphitedb 0.1.1__tar.gz → 0.1.3__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.
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Mahan Khalili
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.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mahan Khalili
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,203 @@
1
+ Metadata-Version: 2.4
2
+ Name: graphitedb
3
+ Version: 0.1.3
4
+ Summary: A clean, embedded graph database engine for Python.
5
+ Author-email: Mahan Khalili <khalili1388mahan@gmail.com>
6
+ Maintainer-email: Mahan Khalili <khalili1388mahan@gmail.com>
7
+ License-Expression: MIT
8
+ Project-URL: Homepage, https://github.com/mkh-user/graphite
9
+ Project-URL: Issues, https://github.com/mkh-user/graphite/issues
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Operating System :: OS Independent
12
+ Requires-Python: >=3.9
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Dynamic: license-file
16
+
17
+ # Graphite
18
+
19
+ A clean, embedded graph database engine for Python.
20
+
21
+ ---
22
+
23
+ **Graphite** is a lightweight yet flexible **graph database engine** implemented in pure Python.
24
+ It is designed to model graph-like data inside large Python codebases **without introducing the complexity of an external database**.
25
+
26
+ ---
27
+
28
+ ## Features
29
+
30
+ ### 🧩 Embedded by Design
31
+ Graphite is not a separate service or infrastructure dependency.
32
+ It lives inside your project, evolves with it, and collaborates naturally with your existing code.
33
+
34
+ No servers. No ports. No deployment headaches.
35
+
36
+ ---
37
+
38
+ ### 🛠 Ready-made, Customizable Module
39
+ Graphite is intentionally simple and hackable.
40
+ You can fork it, modify it, or deeply integrate it into your project without fighting rigid abstractions.
41
+
42
+ The database adapts to your project — not the other way around.
43
+
44
+ ---
45
+
46
+ ### 🐍 Native Python API
47
+ Everything is done through Python APIs.
48
+ No query strings.
49
+ DSL parsing is just an optional layer.
50
+ No context switching.
51
+
52
+ Your editor already knows how to autocomplete and document your queries.
53
+
54
+ ---
55
+
56
+ ### 🔍 Query? It’s Code.
57
+ Queries are built by chaining Python methods on the `QueryResult` object.
58
+
59
+ - Zero parsing cost
60
+ - Full IDE support
61
+ - Refactor-safe
62
+ - Debuggable
63
+
64
+ ---
65
+
66
+ ### 🔄 Runtime Evolution
67
+ Change structures, data, or even engine behavior **at runtime**.
68
+ No shutdowns.
69
+ No migrations.
70
+ No waiting.
71
+
72
+ ---
73
+
74
+ ### 🧱 Structure-Oriented Modeling
75
+ Define:
76
+ - node types
77
+ - relation types
78
+ - fields
79
+ - base types
80
+ - valid forms
81
+
82
+ Model your domain explicitly and safely.
83
+
84
+ ---
85
+
86
+ ### 🧬 Node Inheritance
87
+ Create base node types and extend them with shared properties and advanced relationships.
88
+
89
+ ---
90
+
91
+ ### ✨ Simple, Predictable Syntax
92
+ From defining structures to querying data, every step favors clarity and minimal syntax.
93
+
94
+ ---
95
+
96
+ ### 💾 Serializable
97
+ Persist the entire database into a single file.
98
+
99
+ ---
100
+
101
+ ## Installation
102
+
103
+ Install from **PyPI**:
104
+
105
+ ```bash
106
+ pip install graphitedb
107
+ ````
108
+
109
+ ---
110
+
111
+ ## Why Graphite?
112
+
113
+ Graphite was extracted from a **large production codebase** where Neo4j introduced more complexity than value.
114
+
115
+ Neo4j is a powerful tool — but in large projects, adding a separate graph database often increases:
116
+
117
+ * infrastructure complexity
118
+ * deployment cost
119
+ * maintenance burden
120
+ * cognitive load on developers
121
+
122
+ Graphite exists for cases where this cost is **not justified**.
123
+
124
+ It provides graph modeling **without adding another system to operate**.
125
+
126
+ ---
127
+
128
+ ## Example Usage
129
+
130
+ ```python
131
+ import graphite
132
+
133
+ def example_complete_dsl_loading():
134
+ engine = graphite.engine()
135
+
136
+ complete_dsl = """
137
+ # Define node types
138
+ node Person
139
+ name: string
140
+ age: int
141
+
142
+ node User from Person
143
+ id: string
144
+ email: string
145
+
146
+ node Object
147
+ node Book from Object
148
+ title: string
149
+ n_pages: int
150
+
151
+ node Car from Object
152
+ model: string
153
+ year: int
154
+
155
+ # Define relation types
156
+ relation FRIEND both
157
+ Person - Person
158
+ since: date
159
+
160
+ relation OWNER reverse OWNED_BY
161
+ Person -> Object
162
+ since: date
163
+ purchased_at: date
164
+
165
+ relation AUTHOR reverse AUTHORED_BY
166
+ Person -> Book
167
+ year: int
168
+
169
+ # Create nodes
170
+ User, user_1, "Joe Doe", 32, "joe4030", "joe@email.com"
171
+ User, user_2, "Jane Smith", 28, "jane28", "jane@email.com"
172
+ User, user_3, "Bob Wilson", 45, "bob45", "bob@email.com"
173
+ User, user_4, "Alice Brown", 22, "alice22", "alice@email.com"
174
+
175
+ Book, book_1, "The Great Gatsby", 180
176
+ Book, book_2, "Python Programming", 450
177
+ Book, book_3, "Graph Databases", 320
178
+
179
+ Car, car_1, "Toyota Camry", 2020
180
+ Car, car_2, "Honda Civic", 2018
181
+
182
+ # Create relations
183
+ user_1 -[FRIEND, 2020-05-15]- user_2
184
+ user_1 -[FRIEND, 2019-08-22]- user_3
185
+ user_2 -[FRIEND, 2021-01-10]- user_4
186
+
187
+ user_1 -[OWNER, 2021-03-01, 2021-02-15]-> car_1
188
+ user_2 -[OWNER, 2019-06-20, 2019-05-10]-> book_1
189
+ user_3 -[OWNER, 2022-11-05, 2022-10-20]-> book_2
190
+
191
+ user_1 -[AUTHOR, 2020]-> book_3
192
+ user_2 -[AUTHOR, 2021]-> book_2
193
+ """
194
+
195
+ engine.load_dsl(complete_dsl)
196
+
197
+ users = engine.query.User.get()
198
+ print([u["name"] for u in users])
199
+
200
+ return engine
201
+ ```
202
+
203
+ More examples are available in `example.py` in the GitHub repository.
@@ -0,0 +1,187 @@
1
+ # Graphite
2
+
3
+ A clean, embedded graph database engine for Python.
4
+
5
+ ---
6
+
7
+ **Graphite** is a lightweight yet flexible **graph database engine** implemented in pure Python.
8
+ It is designed to model graph-like data inside large Python codebases **without introducing the complexity of an external database**.
9
+
10
+ ---
11
+
12
+ ## Features
13
+
14
+ ### 🧩 Embedded by Design
15
+ Graphite is not a separate service or infrastructure dependency.
16
+ It lives inside your project, evolves with it, and collaborates naturally with your existing code.
17
+
18
+ No servers. No ports. No deployment headaches.
19
+
20
+ ---
21
+
22
+ ### 🛠 Ready-made, Customizable Module
23
+ Graphite is intentionally simple and hackable.
24
+ You can fork it, modify it, or deeply integrate it into your project without fighting rigid abstractions.
25
+
26
+ The database adapts to your project — not the other way around.
27
+
28
+ ---
29
+
30
+ ### 🐍 Native Python API
31
+ Everything is done through Python APIs.
32
+ No query strings.
33
+ DSL parsing is just an optional layer.
34
+ No context switching.
35
+
36
+ Your editor already knows how to autocomplete and document your queries.
37
+
38
+ ---
39
+
40
+ ### 🔍 Query? It’s Code.
41
+ Queries are built by chaining Python methods on the `QueryResult` object.
42
+
43
+ - Zero parsing cost
44
+ - Full IDE support
45
+ - Refactor-safe
46
+ - Debuggable
47
+
48
+ ---
49
+
50
+ ### 🔄 Runtime Evolution
51
+ Change structures, data, or even engine behavior **at runtime**.
52
+ No shutdowns.
53
+ No migrations.
54
+ No waiting.
55
+
56
+ ---
57
+
58
+ ### 🧱 Structure-Oriented Modeling
59
+ Define:
60
+ - node types
61
+ - relation types
62
+ - fields
63
+ - base types
64
+ - valid forms
65
+
66
+ Model your domain explicitly and safely.
67
+
68
+ ---
69
+
70
+ ### 🧬 Node Inheritance
71
+ Create base node types and extend them with shared properties and advanced relationships.
72
+
73
+ ---
74
+
75
+ ### ✨ Simple, Predictable Syntax
76
+ From defining structures to querying data, every step favors clarity and minimal syntax.
77
+
78
+ ---
79
+
80
+ ### 💾 Serializable
81
+ Persist the entire database into a single file.
82
+
83
+ ---
84
+
85
+ ## Installation
86
+
87
+ Install from **PyPI**:
88
+
89
+ ```bash
90
+ pip install graphitedb
91
+ ````
92
+
93
+ ---
94
+
95
+ ## Why Graphite?
96
+
97
+ Graphite was extracted from a **large production codebase** where Neo4j introduced more complexity than value.
98
+
99
+ Neo4j is a powerful tool — but in large projects, adding a separate graph database often increases:
100
+
101
+ * infrastructure complexity
102
+ * deployment cost
103
+ * maintenance burden
104
+ * cognitive load on developers
105
+
106
+ Graphite exists for cases where this cost is **not justified**.
107
+
108
+ It provides graph modeling **without adding another system to operate**.
109
+
110
+ ---
111
+
112
+ ## Example Usage
113
+
114
+ ```python
115
+ import graphite
116
+
117
+ def example_complete_dsl_loading():
118
+ engine = graphite.engine()
119
+
120
+ complete_dsl = """
121
+ # Define node types
122
+ node Person
123
+ name: string
124
+ age: int
125
+
126
+ node User from Person
127
+ id: string
128
+ email: string
129
+
130
+ node Object
131
+ node Book from Object
132
+ title: string
133
+ n_pages: int
134
+
135
+ node Car from Object
136
+ model: string
137
+ year: int
138
+
139
+ # Define relation types
140
+ relation FRIEND both
141
+ Person - Person
142
+ since: date
143
+
144
+ relation OWNER reverse OWNED_BY
145
+ Person -> Object
146
+ since: date
147
+ purchased_at: date
148
+
149
+ relation AUTHOR reverse AUTHORED_BY
150
+ Person -> Book
151
+ year: int
152
+
153
+ # Create nodes
154
+ User, user_1, "Joe Doe", 32, "joe4030", "joe@email.com"
155
+ User, user_2, "Jane Smith", 28, "jane28", "jane@email.com"
156
+ User, user_3, "Bob Wilson", 45, "bob45", "bob@email.com"
157
+ User, user_4, "Alice Brown", 22, "alice22", "alice@email.com"
158
+
159
+ Book, book_1, "The Great Gatsby", 180
160
+ Book, book_2, "Python Programming", 450
161
+ Book, book_3, "Graph Databases", 320
162
+
163
+ Car, car_1, "Toyota Camry", 2020
164
+ Car, car_2, "Honda Civic", 2018
165
+
166
+ # Create relations
167
+ user_1 -[FRIEND, 2020-05-15]- user_2
168
+ user_1 -[FRIEND, 2019-08-22]- user_3
169
+ user_2 -[FRIEND, 2021-01-10]- user_4
170
+
171
+ user_1 -[OWNER, 2021-03-01, 2021-02-15]-> car_1
172
+ user_2 -[OWNER, 2019-06-20, 2019-05-10]-> book_1
173
+ user_3 -[OWNER, 2022-11-05, 2022-10-20]-> book_2
174
+
175
+ user_1 -[AUTHOR, 2020]-> book_3
176
+ user_2 -[AUTHOR, 2021]-> book_2
177
+ """
178
+
179
+ engine.load_dsl(complete_dsl)
180
+
181
+ users = engine.query.User.get()
182
+ print([u["name"] for u in users])
183
+
184
+ return engine
185
+ ```
186
+
187
+ More examples are available in `example.py` in the GitHub repository.
@@ -1,26 +1,26 @@
1
- [build-system]
2
- requires = ["setuptools >= 77.0.3"]
3
- build-backend = "setuptools.build_meta"
4
-
5
- [project]
6
- name = "graphitedb"
7
- version = "0.1.1"
8
- authors = [
9
- { name="Mahan Khalili", email="khalili1388mahan@gmail.com" },
10
- ]
11
- maintainers = [
12
- { name="Mahan Khalili", email="khalili1388mahan@gmail.com" },
13
- ]
14
- description = "A clean graph database engine"
15
- readme = "README.md"
16
- requires-python = ">=3.9"
17
- classifiers = [
18
- "Programming Language :: Python :: 3",
19
- "Operating System :: OS Independent",
20
- ]
21
- license = "MIT"
22
- license-files = ["LICEN[CS]E*"]
23
-
24
- [project.urls]
25
- Homepage = "https://github.com/mkh-user/graphite"
1
+ [build-system]
2
+ requires = ["setuptools >= 77.0.3"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "graphitedb"
7
+ version = "0.1.3"
8
+ authors = [
9
+ { name="Mahan Khalili", email="khalili1388mahan@gmail.com" },
10
+ ]
11
+ maintainers = [
12
+ { name="Mahan Khalili", email="khalili1388mahan@gmail.com" },
13
+ ]
14
+ description = "A clean, embedded graph database engine for Python."
15
+ readme = "README.md"
16
+ requires-python = ">=3.9"
17
+ classifiers = [
18
+ "Programming Language :: Python :: 3",
19
+ "Operating System :: OS Independent",
20
+ ]
21
+ license = "MIT"
22
+ license-files = ["LICEN[CS]E*"]
23
+
24
+ [project.urls]
25
+ Homepage = "https://github.com/mkh-user/graphite"
26
26
  Issues = "https://github.com/mkh-user/graphite/issues"
@@ -1,4 +1,4 @@
1
- [egg_info]
2
- tag_build =
3
- tag_date = 0
4
-
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+