graphitedb 0.1.1__py3-none-any.whl → 0.1.3__py3-none-any.whl

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.
@@ -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,6 @@
1
+ graphite/__init__.py,sha256=PDUUAyHqLUImV2yjyblCqjchwBIYHch7MbwCvPrgOGY,22498
2
+ graphitedb-0.1.3.dist-info/licenses/LICENSE,sha256=3n5Zi5QXqsnus7yX3xKY7wKtX7Ios_ofbTxdhSUz0dA,1070
3
+ graphitedb-0.1.3.dist-info/METADATA,sha256=JZBBCG5L6-JwcWNd_HjMTS6872KhITSP23H-CMf6xUQ,4799
4
+ graphitedb-0.1.3.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
5
+ graphitedb-0.1.3.dist-info/top_level.txt,sha256=QPrpQuMV9WIM20kS6NN7OWkIzypVFiSTICJLsYYkJ1w,9
6
+ graphitedb-0.1.3.dist-info/RECORD,,
@@ -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.
__init__.py DELETED
File without changes
@@ -1,149 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: graphitedb
3
- Version: 0.1.1
4
- Summary: A clean graph database engine
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
- A clean graph database engine!
19
-
20
- ---
21
-
22
- Graphite is a simple yet flexible **Graph Database Engine** that is implemented in Python. This engine uses basic structures (similar to classes in programming languages) for nodes and connections (equivalent to Edges in other engines).
23
-
24
- ## Features
25
-
26
- - **Structure-oriented:** Define node types and relation types in structure, define fields, base type, and valid forms.
27
- - **Base Node Type:** Create base type for node types to add base properties and advanced relations.
28
- - **First-class Nodes:** Create nodes from node types and fill data fields.
29
- - **Relations with Properties:** Like nodes, relations can have properties too.
30
- - **Simple Syntax:** The most simple syntaxes in all steps.
31
- - **Serializable:** Save whole database into one file.
32
- - And much more...
33
-
34
- ## Installation
35
- Install package from **Python Package Index**:
36
- ```text
37
- pip install graphitedb
38
- ```
39
-
40
- ## Example Usage
41
- ```python
42
- import graphite
43
-
44
- def example_complete_dsl_loading():
45
- engine = graphite.engine()
46
-
47
- complete_dsl = """
48
- # Define node types
49
- node Person
50
- name: string
51
- age: int
52
-
53
- node User from Person
54
- id: string
55
- email: string
56
-
57
- node Object
58
-
59
- node Book from Object
60
- title: string
61
- n_pages: int
62
-
63
- node Car from Object
64
- model: string
65
- year: int
66
-
67
- # Define relation types
68
- relation FRIEND both
69
- Person - Person
70
- since: date
71
-
72
- relation OWNER reverse OWNED_BY
73
- Person -> Object
74
- since: date
75
- purchased_at: date
76
-
77
- relation AUTHOR reverse AUTHORED_BY
78
- Person -> Book
79
- year: int
80
-
81
- # Create node instances
82
- User, user_1, "Joe Doe", 32, "joe4030", "joe@email.com"
83
- User, user_2, "Jane Smith", 28, "jane28", "jane@email.com"
84
- User, user_3, "Bob Wilson", 45, "bob45", "bob@email.com"
85
- User, user_4, "Alice Brown", 22, "alice22", "alice@email.com"
86
-
87
- Book, book_1, "The Great Gatsby", 180
88
- Book, book_2, "Python Programming", 450
89
- Book, book_3, "Graph Databases", 320
90
-
91
- Car, car_1, "Toyota Camry", 2020
92
- Car, car_2, "Honda Civic", 2018
93
-
94
- # Create relation instances
95
- user_1 -[FRIEND, 2020-05-15]- user_2
96
- user_1 -[FRIEND, 2019-08-22]- user_3
97
- user_2 -[FRIEND, 2021-01-10]- user_4
98
-
99
- user_1 -[OWNER, 2021-03-01, 2021-02-15]-> car_1
100
- user_2 -[OWNER, 2019-06-20, 2019-05-10]-> book_1
101
- user_3 -[OWNER, 2022-11-05, 2022-10-20]-> book_2
102
-
103
- user_1 -[AUTHOR, 2020]-> book_3
104
- user_2 -[AUTHOR, 2021]-> book_2
105
-
106
- # Alternative syntax (reverse relation)
107
- book_1 -[OWNED_BY, 2019-06-20, 2019-05-10]-> user_2
108
- car_2 -[OWNED_BY, 2018-12-01, 2018-11-15]-> user_4
109
- """
110
-
111
- # Load all with one call
112
- engine.load_dsl(complete_dsl)
113
-
114
- print("=== Database Stats ===")
115
- stats = engine.stats()
116
- print(f"Node Types: {stats['node_types']}")
117
- print(f"Relation Types: {stats['relation_types']}")
118
- print(f"Nodes: {stats['nodes']}")
119
- print(f"Relations: {stats['relations']}")
120
-
121
- print("\n=== Query Examples ===")
122
-
123
- # All users
124
- users = engine.query.User.get()
125
- print(f"All Users ({len(users)}): {[u['name'] for u in users]}")
126
-
127
- # Users with more than 30 years age
128
- older_users = engine.query.User.where("age > 30").get()
129
- print(f"\nUsers over 30: {[u['name'] for u in older_users]}")
130
-
131
- # Joe Doe books
132
- joe_books = (engine.query.User
133
- .where(lambda u: u['name'] == "Joe Doe")
134
- .outgoing("AUTHOR")
135
- .get())
136
- print(f"\nBooks authored by Joe Doe: {[b['title'] for b in joe_books]}")
137
-
138
- # Two steps traverse
139
- friends_of_friends = (engine.query.User
140
- .where(lambda u: u['name'] == "Joe Doe")
141
- .outgoing("FRIEND")
142
- .outgoing("FRIEND")
143
- .distinct()
144
- .get())
145
- print(f"\nFriends of friends of Joe Doe: {[f['name'] for f in friends_of_friends]}")
146
-
147
- return engine
148
- ```
149
- You can see more examples in `example.py` in GitHub repo.
@@ -1,7 +0,0 @@
1
- __init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- graphite/__init__.py,sha256=7yoRf4SWB3tAqd7AyaWIZj3qXktmXpHSwe5To7gZKgE,20976
3
- graphitedb-0.1.1.dist-info/licenses/LICENSE,sha256=0vynlOYOP8-cAnXfGAMabNOAfaQ2HarY3ctdboen79g,1091
4
- graphitedb-0.1.1.dist-info/METADATA,sha256=61o1noWOU6PiCwgC_DnXg-79EDS-IJVVOm25sM4jxeQ,4593
5
- graphitedb-0.1.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
6
- graphitedb-0.1.1.dist-info/top_level.txt,sha256=3a6k71PT31c_EyE1n54UPWzTLUKEUx8PmMNA4uyTByM,18
7
- graphitedb-0.1.1.dist-info/RECORD,,