Graphinate 0.0.7__tar.gz → 0.0.8__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 (64) hide show
  1. graphinate-0.0.8/PKG-INFO +238 -0
  2. graphinate-0.0.8/README.md +191 -0
  3. {graphinate-0.0.7 → graphinate-0.0.8}/examples/code/python_ast.py +1 -1
  4. graphinate-0.0.8/examples/code/requirements.txt +1 -0
  5. {graphinate-0.0.7 → graphinate-0.0.8}/examples/math/graph_atlas.py +1 -1
  6. {graphinate-0.0.7 → graphinate-0.0.8}/examples/web/requirements.txt +0 -1
  7. {graphinate-0.0.7 → graphinate-0.0.8}/examples/web/web_graph.py +2 -8
  8. {graphinate-0.0.7 → graphinate-0.0.8}/pyproject.toml +14 -14
  9. {graphinate-0.0.7 → graphinate-0.0.8}/src/graphinate/builders.py +38 -13
  10. {graphinate-0.0.7 → graphinate-0.0.8}/src/graphinate/cli.py +2 -2
  11. {graphinate-0.0.7 → graphinate-0.0.8}/src/graphinate/server/__init__.py +3 -1
  12. graphinate-0.0.7/PKG-INFO +0 -132
  13. graphinate-0.0.7/README.md +0 -83
  14. graphinate-0.0.7/examples/code/requirements.txt +0 -1
  15. {graphinate-0.0.7 → graphinate-0.0.8}/.github/workflows/codeql.yml +0 -0
  16. {graphinate-0.0.7 → graphinate-0.0.8}/.github/workflows/publish.yml +0 -0
  17. {graphinate-0.0.7 → graphinate-0.0.8}/.github/workflows/test-python-beta.yml +0 -0
  18. {graphinate-0.0.7 → graphinate-0.0.8}/.github/workflows/test.yml +0 -0
  19. {graphinate-0.0.7 → graphinate-0.0.8}/.gitignore +0 -0
  20. {graphinate-0.0.7 → graphinate-0.0.8}/LICENSE +0 -0
  21. {graphinate-0.0.7 → graphinate-0.0.8}/docs/assets/images/network_graph.png +0 -0
  22. {graphinate-0.0.7 → graphinate-0.0.8}/docs/index.md +0 -0
  23. {graphinate-0.0.7 → graphinate-0.0.8}/docs/install.md +0 -0
  24. {graphinate-0.0.7 → graphinate-0.0.8}/docs/usage.md +0 -0
  25. {graphinate-0.0.7 → graphinate-0.0.8}/examples/code/call_graph.py +0 -0
  26. {graphinate-0.0.7 → graphinate-0.0.8}/examples/ethernet/traceroute.py +0 -0
  27. {graphinate-0.0.7 → graphinate-0.0.8}/examples/genric_graph.graphql +0 -0
  28. {graphinate-0.0.7 → graphinate-0.0.8}/examples/github/_client.py +0 -0
  29. {graphinate-0.0.7 → graphinate-0.0.8}/examples/github/followers.graphql +0 -0
  30. {graphinate-0.0.7 → graphinate-0.0.8}/examples/github/followers.py +0 -0
  31. {graphinate-0.0.7 → graphinate-0.0.8}/examples/github/graphql.config.yml +0 -0
  32. {graphinate-0.0.7 → graphinate-0.0.8}/examples/github/repositories.graphql +0 -0
  33. {graphinate-0.0.7 → graphinate-0.0.8}/examples/github/repositories.py +0 -0
  34. {graphinate-0.0.7 → graphinate-0.0.8}/examples/graphql.config.yml +0 -0
  35. {graphinate-0.0.7 → graphinate-0.0.8}/examples/math/hailstone.py +0 -0
  36. {graphinate-0.0.7 → graphinate-0.0.8}/examples/text/nlp_graph.py +0 -0
  37. {graphinate-0.0.7 → graphinate-0.0.8}/mkdocs.yml +0 -0
  38. {graphinate-0.0.7 → graphinate-0.0.8}/playground/grap_genus.py +0 -0
  39. {graphinate-0.0.7 → graphinate-0.0.8}/playground/house_of_graphs.py +0 -0
  40. {graphinate-0.0.7 → graphinate-0.0.8}/src/graphinate/__init__.py +0 -0
  41. {graphinate-0.0.7 → graphinate-0.0.8}/src/graphinate/__main__.py +0 -0
  42. {graphinate-0.0.7 → graphinate-0.0.8}/src/graphinate/color.py +0 -0
  43. {graphinate-0.0.7 → graphinate-0.0.8}/src/graphinate/materialize/__init__.py +0 -0
  44. {graphinate-0.0.7 → graphinate-0.0.8}/src/graphinate/materialize/matplotlib.py +0 -0
  45. {graphinate-0.0.7 → graphinate-0.0.8}/src/graphinate/modeling.py +0 -0
  46. {graphinate-0.0.7 → graphinate-0.0.8}/src/graphinate/server/starlette/__init__.py +0 -0
  47. {graphinate-0.0.7 → graphinate-0.0.8}/src/graphinate/server/starlette/views.py +0 -0
  48. {graphinate-0.0.7 → graphinate-0.0.8}/src/graphinate/server/web/__init__.py +0 -0
  49. {graphinate-0.0.7 → graphinate-0.0.8}/src/graphinate/server/web/graphiql/__init__.py +0 -0
  50. {graphinate-0.0.7 → graphinate-0.0.8}/src/graphinate/server/web/graphiql/index.html +0 -0
  51. {graphinate-0.0.7 → graphinate-0.0.8}/src/graphinate/server/web/static/images/network_graph.png +0 -0
  52. {graphinate-0.0.7 → graphinate-0.0.8}/src/graphinate/server/web/viewer/__init__.py +0 -0
  53. {graphinate-0.0.7 → graphinate-0.0.8}/src/graphinate/server/web/viewer/index.html +0 -0
  54. {graphinate-0.0.7 → graphinate-0.0.8}/src/graphinate/server/web/voyager/__init__.py +0 -0
  55. {graphinate-0.0.7 → graphinate-0.0.8}/src/graphinate/server/web/voyager/index.html +0 -0
  56. {graphinate-0.0.7 → graphinate-0.0.8}/src/graphinate/tools/__init__.py +0 -0
  57. {graphinate-0.0.7 → graphinate-0.0.8}/src/graphinate/tools/fs.py +0 -0
  58. {graphinate-0.0.7 → graphinate-0.0.8}/src/graphinate/tools/gui.py +0 -0
  59. {graphinate-0.0.7 → graphinate-0.0.8}/src/graphinate/tools/importer.py +0 -0
  60. {graphinate-0.0.7 → graphinate-0.0.8}/src/graphinate/tools/mutators.py +0 -0
  61. {graphinate-0.0.7 → graphinate-0.0.8}/src/graphinate/typing.py +0 -0
  62. {graphinate-0.0.7 → graphinate-0.0.8}/tests/conftest.py +0 -0
  63. {graphinate-0.0.7 → graphinate-0.0.8}/tests/graphinate/test_builders.py +0 -0
  64. {graphinate-0.0.7 → graphinate-0.0.8}/tests/graphinate/test_modeling.py +0 -0
@@ -0,0 +1,238 @@
1
+ Metadata-Version: 2.1
2
+ Name: Graphinate
3
+ Version: 0.0.8
4
+ Summary: Graphinate. Data to Graphs.
5
+ Project-URL: Homepage, https://github.com/erivlis/graphinate
6
+ Project-URL: Documentation, https://github.com/erivlis/graphinate#README.md
7
+ Project-URL: Bug Tracker, https://github.com/erivlis/graphinate/issues
8
+ Project-URL: Source, https://github.com/erivlis/graphinate
9
+ Author-email: Eran Rivlis <eran@rivlis.info>
10
+ License-File: LICENSE
11
+ Keywords: declarative,graph
12
+ Classifier: Development Status :: 2 - Pre-Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Information Technology
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)
17
+ Classifier: Natural Language :: English
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3 :: Only
21
+ Classifier: Programming Language :: Python :: 3.9
22
+ Classifier: Programming Language :: Python :: 3.10
23
+ Classifier: Programming Language :: Python :: 3.11
24
+ Classifier: Programming Language :: Python :: Implementation :: CPython
25
+ Classifier: Topic :: Scientific/Engineering
26
+ Classifier: Topic :: Software Development :: Libraries
27
+ Classifier: Typing :: Typed
28
+ Requires-Python: >=3.9
29
+ Requires-Dist: click>=8
30
+ Requires-Dist: inflect>=7
31
+ Requires-Dist: loguru>=0.7
32
+ Requires-Dist: matplotlib>=3.7
33
+ Requires-Dist: networkx>=3
34
+ Requires-Dist: strawberry-graphql[asgi,opentelemetry]
35
+ Provides-Extra: dev
36
+ Requires-Dist: ruff; extra == 'dev'
37
+ Provides-Extra: plot
38
+ Requires-Dist: matplotlib; extra == 'plot'
39
+ Requires-Dist: scipy; extra == 'plot'
40
+ Provides-Extra: server
41
+ Requires-Dist: starlette-prometheus; extra == 'server'
42
+ Requires-Dist: uvicorn[standard]; extra == 'server'
43
+ Provides-Extra: test
44
+ Requires-Dist: pytest-cov>=4.1.0; extra == 'test'
45
+ Requires-Dist: pytest>=7.3.2; extra == 'test'
46
+ Description-Content-Type: text/markdown
47
+
48
+ # Graphinate. Data to Graphs.
49
+
50
+ ## ⚠️ **Under Development!** ⚠️
51
+
52
+ This library is alpha-quality
53
+
54
+ ![PyPI](https://img.shields.io/pypi/v/graphinate)
55
+ ![PyPI - Status](https://img.shields.io/pypi/status/graphinate)
56
+ ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/graphinate)
57
+ ![GitHub](https://img.shields.io/github/license/erivlis/graphinate)
58
+ ![PyPI - Downloads](https://img.shields.io/pypi/dd/graphinate)
59
+ ![GitHub repo size](https://img.shields.io/github/repo-size/erivlis/graphinate)
60
+ [![Contributors](https://img.shields.io/github/contributors/erivlis/graphinate.svg)](https://github.com/erivlis/graphinate/graphs/contributors)
61
+ ![GitHub last commit (by committer)](https://img.shields.io/github/last-commit/erivlis/graphinate)
62
+
63
+ [![Tests](https://github.com/erivlis/graphinate/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/erivlis/graphinate/actions/workflows/test.yml)
64
+ [![Publish](https://github.com/erivlis/graphinate/actions/workflows/publish.yml/badge.svg)](https://github.com/erivlis/graphinate/actions/workflows/publish.yml)
65
+
66
+ ## Install
67
+
68
+ Graphinate is available on PyPI:
69
+
70
+ ```shell
71
+ python -m pip install graphinate
72
+ ```
73
+
74
+ Graphinate officially supports Python 3.9+.
75
+
76
+ ## Introduction
77
+
78
+ ### What is Graphinate?
79
+
80
+ Graphinate aims to simplify the generation of Graph data structures from sources of data.
81
+ It utilizes and build upon [NetworkX](https://networkx.org/)
82
+
83
+ ### What is a Graph?
84
+
85
+ > In a mathematician's terminology, a graph is a collection of points and lines connecting some (possibly empty) subset
86
+ > of them. The points of a graph are most commonly known as graph vertices, but may also be called "nodes" or simply "
87
+ > points." Similarly, the lines connecting the vertices of a graph are most commonly known as graph edges, but may also
88
+ > be
89
+ > called "arcs" or "lines."
90
+ >
91
+ > &mdash; [https://mathworld.wolfram.com/Graph.html](https://mathworld.wolfram.com/Graph.html)
92
+
93
+ ### What is Data?
94
+
95
+ > ...data is a collection of discrete or continuous values that convey information, describing the quantity, quality,
96
+ > fact, statistics, other basic units of meaning, or simply sequences of symbols that may be further interpreted
97
+ > formally.
98
+ >
99
+ > &mdash; [https://en.wikipedia.org/wiki/Data](https://en.wikipedia.org/wiki/Data)
100
+
101
+ ### Defining a Graph
102
+
103
+ One can define Graphs in two general ways:
104
+
105
+ #### Edge first
106
+
107
+ Generate a Graph by supplying a list of edges. The simplest definition of an edge will be a tuple of 2 values. Each
108
+ value represent a node (or vertex) in the graph. Additional attributes may be also added to the edge definition to
109
+ signify additional meaning.
110
+
111
+ In this case one defines the **edges explicitly** and the **nodes implicitly**.
112
+
113
+ Such graph is focused more on the _relationships_ or the _structure_ of the Graph than on the nodes themselves.
114
+
115
+ #### Node first
116
+
117
+ Alternatively, one can first add nodes (vertices) to a graph without defining edges. Additional attributes may be added
118
+ to the node definition to signify additional meaning. Later on edge definitions are added to generate the relationships
119
+ between the nodes.
120
+
121
+ In this case **both nodes and the edges** are defines **explicitly**.
122
+
123
+ Such a graph has focus first on the nodes and later on the relationship between them.
124
+
125
+ ## Gallery
126
+
127
+ ![d3_graph_ast](https://github.com/erivlis/graphinate/assets/9897520/9e7e1ed2-3a5c-41fe-8c5f-999da4b741ff)
128
+ ![repo_graph](https://github.com/erivlis/graphinate/assets/9897520/9c044bbe-1f21-41b8-b879-95b8362ad48d)
129
+ ![AST 3D Force animation](https://github.com/erivlis/graphinate/assets/9897520/2e9a53b1-5686-4683-a0e4-fbffa850a27b)
130
+
131
+ ## Examples
132
+
133
+ - [ ] Code
134
+ - [ ] Call Graph
135
+ - [x] Python AST
136
+ - [x] GitHub
137
+ - [x] Repository
138
+ - [x] Followers
139
+ - [ ] Ethernet
140
+ - [ ] Traceroute
141
+ - [ ] Math
142
+ - [x] Graph Atlas
143
+ - [ ] Hailstone
144
+ - [ ] Text
145
+ - [ ] NLP
146
+ - [ ] Web
147
+ - [ ] Web Graph
148
+
149
+ ## Guide
150
+
151
+ ### By Convention
152
+
153
+ https://github.com/erivlis/graphinate/blob/f5b363a360907aecf52cf11249b78666eb470d20/examples/github/followers.py#L1
154
+
155
+ ### By Configuration
156
+
157
+ https://github.com/erivlis/graphinate/blob/f5b363a360907aecf52cf11249b78666eb470d20/examples/github/repositories.py#L1
158
+
159
+ ## CLI
160
+
161
+ ### Commands
162
+
163
+ ```
164
+ Usage: python -m graphinate [OPTIONS] COMMAND [ARGS]...
165
+
166
+ Options:
167
+ --help Show this message and exit.
168
+
169
+ Commands:
170
+ save
171
+ server
172
+ ```
173
+
174
+ #### Save
175
+
176
+ ```
177
+ Usage: python -m graphinate save [OPTIONS] MODEL
178
+
179
+ Options:
180
+ --help Show this message and exit.
181
+ ```
182
+
183
+ #### Server
184
+
185
+ ```
186
+ Usage: python -m graphinate server [OPTIONS] MODEL
187
+
188
+ Options:
189
+ -p, --port INTEGER
190
+ --help Show this message and exit.
191
+ ```
192
+
193
+ ## Development
194
+
195
+ ### Lint
196
+
197
+ ```shell
198
+ ruff check src
199
+ ```
200
+
201
+ ### Docs
202
+
203
+ ```shell
204
+ python -m mkdocs build
205
+ ```
206
+
207
+ ### Build
208
+
209
+ ```shell
210
+ python -m build
211
+ ```
212
+
213
+ ### Test
214
+
215
+ ```shell
216
+ python -m pytest ./tests --cov=./src --cov-branch --cov-report=xml --junitxml=test_results.xml
217
+ ```
218
+
219
+ ## Acknowledgements
220
+
221
+ ### Dependencies
222
+
223
+ <a href="https://vasturiano.github.io/3d-force-graph/"><img height="50" style="padding: 5px; background: linear-gradient(-45deg, #FFFFFF, #CCCCCC);" src="http://gist.github.com/vasturiano/02affe306ce445e423f992faeea13521/raw/preview.png" alt="3D Force-Directed Graph Logo."></a>
224
+ <a href="https://palletsprojects.com/p/click/"><img height="50" style="padding: 5px; background: linear-gradient(-45deg, #FFFFFF, #CCCCCC);" src="https://click.palletsprojects.com/en/7.x/_images/click-logo.png" alt="Click Logo."></a>
225
+ <a href="https://github.com/Delgan/loguru"><img height="50" style="padding: 5px; background: linear-gradient(-45deg, #FFFFFF, #CCCCCC);" src="https://raw.githubusercontent.com/Delgan/loguru/master/docs/_static/img/logo.png" alt="Loguru Logo."></a>
226
+ <a href="https://matplotlib.org/"><img height="50" style="padding: 5px; background: linear-gradient(-45deg, #FFFFFF, #CCCCCC);" src="https://matplotlib.org/_static/logo_dark.svg" alt="matplotlib Logo."></a>
227
+ <a href="https://networkx.org/"><img height="50" style="padding: 5px; background: linear-gradient(-45deg, #FFFFFF, #CCCCCC);" src="https://networkx.org/_static/networkx_logo.svg" alt="NetworkX Logo."></a>
228
+ <a href="https://strawberry.rocks/"><img height="50" style="padding: 5px; background: linear-gradient(-45deg, #FFFFFF, #CCCCCC);" src="https://github.com/strawberry-graphql/strawberry/raw/main/.github/logo.png" alt="Strawberry GraphQL Logo."></a>
229
+
230
+ ### Dev Tools
231
+
232
+ <a href="https://hatch.pypa.io/"><img height="50" style="background: linear-gradient(-45deg, #FFFFFF, #CCCCCC);" src="https://hatch.pypa.io/latest/assets/images/logo.svg" alt="Hatch logo."></a>
233
+ <a href="https://pytest.org"><img height="50" style="background: linear-gradient(-45deg, #FFFFFF, #CCCCCC);" src="https://docs.pytest.org/en/7.4.x/_static/pytest_logo_curves.svg" alt="pytest logo."></a>
234
+ <a href="https://astral.sh/ruff"><img height="50" style="background: linear-gradient(-45deg, #FFFFFF, #CCCCCC);" src="https://astralcms.wpengine.com/wp-content/uploads/2023/03/Ruff-Logo.svg" alt="Ruff logo."></a>
235
+
236
+ ### IDE
237
+
238
+ <a href="https://www.jetbrains.com/pycharm/"><img height="50" style="background: linear-gradient(-45deg, #FCF84A, #3DEA62, #21D789);" src="https://resources.jetbrains.com/storage/products/company/brand/logos/PyCharm.png" alt="PyCharm logo."></a>
@@ -0,0 +1,191 @@
1
+ # Graphinate. Data to Graphs.
2
+
3
+ ## ⚠️ **Under Development!** ⚠️
4
+
5
+ This library is alpha-quality
6
+
7
+ ![PyPI](https://img.shields.io/pypi/v/graphinate)
8
+ ![PyPI - Status](https://img.shields.io/pypi/status/graphinate)
9
+ ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/graphinate)
10
+ ![GitHub](https://img.shields.io/github/license/erivlis/graphinate)
11
+ ![PyPI - Downloads](https://img.shields.io/pypi/dd/graphinate)
12
+ ![GitHub repo size](https://img.shields.io/github/repo-size/erivlis/graphinate)
13
+ [![Contributors](https://img.shields.io/github/contributors/erivlis/graphinate.svg)](https://github.com/erivlis/graphinate/graphs/contributors)
14
+ ![GitHub last commit (by committer)](https://img.shields.io/github/last-commit/erivlis/graphinate)
15
+
16
+ [![Tests](https://github.com/erivlis/graphinate/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/erivlis/graphinate/actions/workflows/test.yml)
17
+ [![Publish](https://github.com/erivlis/graphinate/actions/workflows/publish.yml/badge.svg)](https://github.com/erivlis/graphinate/actions/workflows/publish.yml)
18
+
19
+ ## Install
20
+
21
+ Graphinate is available on PyPI:
22
+
23
+ ```shell
24
+ python -m pip install graphinate
25
+ ```
26
+
27
+ Graphinate officially supports Python 3.9+.
28
+
29
+ ## Introduction
30
+
31
+ ### What is Graphinate?
32
+
33
+ Graphinate aims to simplify the generation of Graph data structures from sources of data.
34
+ It utilizes and build upon [NetworkX](https://networkx.org/)
35
+
36
+ ### What is a Graph?
37
+
38
+ > In a mathematician's terminology, a graph is a collection of points and lines connecting some (possibly empty) subset
39
+ > of them. The points of a graph are most commonly known as graph vertices, but may also be called "nodes" or simply "
40
+ > points." Similarly, the lines connecting the vertices of a graph are most commonly known as graph edges, but may also
41
+ > be
42
+ > called "arcs" or "lines."
43
+ >
44
+ > &mdash; [https://mathworld.wolfram.com/Graph.html](https://mathworld.wolfram.com/Graph.html)
45
+
46
+ ### What is Data?
47
+
48
+ > ...data is a collection of discrete or continuous values that convey information, describing the quantity, quality,
49
+ > fact, statistics, other basic units of meaning, or simply sequences of symbols that may be further interpreted
50
+ > formally.
51
+ >
52
+ > &mdash; [https://en.wikipedia.org/wiki/Data](https://en.wikipedia.org/wiki/Data)
53
+
54
+ ### Defining a Graph
55
+
56
+ One can define Graphs in two general ways:
57
+
58
+ #### Edge first
59
+
60
+ Generate a Graph by supplying a list of edges. The simplest definition of an edge will be a tuple of 2 values. Each
61
+ value represent a node (or vertex) in the graph. Additional attributes may be also added to the edge definition to
62
+ signify additional meaning.
63
+
64
+ In this case one defines the **edges explicitly** and the **nodes implicitly**.
65
+
66
+ Such graph is focused more on the _relationships_ or the _structure_ of the Graph than on the nodes themselves.
67
+
68
+ #### Node first
69
+
70
+ Alternatively, one can first add nodes (vertices) to a graph without defining edges. Additional attributes may be added
71
+ to the node definition to signify additional meaning. Later on edge definitions are added to generate the relationships
72
+ between the nodes.
73
+
74
+ In this case **both nodes and the edges** are defines **explicitly**.
75
+
76
+ Such a graph has focus first on the nodes and later on the relationship between them.
77
+
78
+ ## Gallery
79
+
80
+ ![d3_graph_ast](https://github.com/erivlis/graphinate/assets/9897520/9e7e1ed2-3a5c-41fe-8c5f-999da4b741ff)
81
+ ![repo_graph](https://github.com/erivlis/graphinate/assets/9897520/9c044bbe-1f21-41b8-b879-95b8362ad48d)
82
+ ![AST 3D Force animation](https://github.com/erivlis/graphinate/assets/9897520/2e9a53b1-5686-4683-a0e4-fbffa850a27b)
83
+
84
+ ## Examples
85
+
86
+ - [ ] Code
87
+ - [ ] Call Graph
88
+ - [x] Python AST
89
+ - [x] GitHub
90
+ - [x] Repository
91
+ - [x] Followers
92
+ - [ ] Ethernet
93
+ - [ ] Traceroute
94
+ - [ ] Math
95
+ - [x] Graph Atlas
96
+ - [ ] Hailstone
97
+ - [ ] Text
98
+ - [ ] NLP
99
+ - [ ] Web
100
+ - [ ] Web Graph
101
+
102
+ ## Guide
103
+
104
+ ### By Convention
105
+
106
+ https://github.com/erivlis/graphinate/blob/f5b363a360907aecf52cf11249b78666eb470d20/examples/github/followers.py#L1
107
+
108
+ ### By Configuration
109
+
110
+ https://github.com/erivlis/graphinate/blob/f5b363a360907aecf52cf11249b78666eb470d20/examples/github/repositories.py#L1
111
+
112
+ ## CLI
113
+
114
+ ### Commands
115
+
116
+ ```
117
+ Usage: python -m graphinate [OPTIONS] COMMAND [ARGS]...
118
+
119
+ Options:
120
+ --help Show this message and exit.
121
+
122
+ Commands:
123
+ save
124
+ server
125
+ ```
126
+
127
+ #### Save
128
+
129
+ ```
130
+ Usage: python -m graphinate save [OPTIONS] MODEL
131
+
132
+ Options:
133
+ --help Show this message and exit.
134
+ ```
135
+
136
+ #### Server
137
+
138
+ ```
139
+ Usage: python -m graphinate server [OPTIONS] MODEL
140
+
141
+ Options:
142
+ -p, --port INTEGER
143
+ --help Show this message and exit.
144
+ ```
145
+
146
+ ## Development
147
+
148
+ ### Lint
149
+
150
+ ```shell
151
+ ruff check src
152
+ ```
153
+
154
+ ### Docs
155
+
156
+ ```shell
157
+ python -m mkdocs build
158
+ ```
159
+
160
+ ### Build
161
+
162
+ ```shell
163
+ python -m build
164
+ ```
165
+
166
+ ### Test
167
+
168
+ ```shell
169
+ python -m pytest ./tests --cov=./src --cov-branch --cov-report=xml --junitxml=test_results.xml
170
+ ```
171
+
172
+ ## Acknowledgements
173
+
174
+ ### Dependencies
175
+
176
+ <a href="https://vasturiano.github.io/3d-force-graph/"><img height="50" style="padding: 5px; background: linear-gradient(-45deg, #FFFFFF, #CCCCCC);" src="http://gist.github.com/vasturiano/02affe306ce445e423f992faeea13521/raw/preview.png" alt="3D Force-Directed Graph Logo."></a>
177
+ <a href="https://palletsprojects.com/p/click/"><img height="50" style="padding: 5px; background: linear-gradient(-45deg, #FFFFFF, #CCCCCC);" src="https://click.palletsprojects.com/en/7.x/_images/click-logo.png" alt="Click Logo."></a>
178
+ <a href="https://github.com/Delgan/loguru"><img height="50" style="padding: 5px; background: linear-gradient(-45deg, #FFFFFF, #CCCCCC);" src="https://raw.githubusercontent.com/Delgan/loguru/master/docs/_static/img/logo.png" alt="Loguru Logo."></a>
179
+ <a href="https://matplotlib.org/"><img height="50" style="padding: 5px; background: linear-gradient(-45deg, #FFFFFF, #CCCCCC);" src="https://matplotlib.org/_static/logo_dark.svg" alt="matplotlib Logo."></a>
180
+ <a href="https://networkx.org/"><img height="50" style="padding: 5px; background: linear-gradient(-45deg, #FFFFFF, #CCCCCC);" src="https://networkx.org/_static/networkx_logo.svg" alt="NetworkX Logo."></a>
181
+ <a href="https://strawberry.rocks/"><img height="50" style="padding: 5px; background: linear-gradient(-45deg, #FFFFFF, #CCCCCC);" src="https://github.com/strawberry-graphql/strawberry/raw/main/.github/logo.png" alt="Strawberry GraphQL Logo."></a>
182
+
183
+ ### Dev Tools
184
+
185
+ <a href="https://hatch.pypa.io/"><img height="50" style="background: linear-gradient(-45deg, #FFFFFF, #CCCCCC);" src="https://hatch.pypa.io/latest/assets/images/logo.svg" alt="Hatch logo."></a>
186
+ <a href="https://pytest.org"><img height="50" style="background: linear-gradient(-45deg, #FFFFFF, #CCCCCC);" src="https://docs.pytest.org/en/7.4.x/_static/pytest_logo_curves.svg" alt="pytest logo."></a>
187
+ <a href="https://astral.sh/ruff"><img height="50" style="background: linear-gradient(-45deg, #FFFFFF, #CCCCCC);" src="https://astralcms.wpengine.com/wp-content/uploads/2023/03/Ruff-Logo.svg" alt="Ruff logo."></a>
188
+
189
+ ### IDE
190
+
191
+ <a href="https://www.jetbrains.com/pycharm/"><img height="50" style="background: linear-gradient(-45deg, #FCF84A, #3DEA62, #21D789);" src="https://resources.jetbrains.com/storage/products/company/brand/logos/PyCharm.png" alt="PyCharm logo."></a>
@@ -2,7 +2,7 @@ import ast
2
2
  import inspect
3
3
  import operator
4
4
  from _ast import AST
5
- from typing import Iterable
5
+ from collections.abc import Iterable
6
6
 
7
7
  import graphinate
8
8
  import graphinate.builders
@@ -0,0 +1 @@
1
+ PyGithub
@@ -776,7 +776,7 @@ def models(iterable):
776
776
  yield graph_model
777
777
 
778
778
 
779
- model = next(models(atlas()))
779
+ model = next(models(atlas().items()))
780
780
 
781
781
  if __name__ == '__main__':
782
782
  choices = graphinate.tools.gui.modal_listbox_chooser('Choose Graph', atlas())
@@ -1,4 +1,3 @@
1
-
2
1
  beautifulsoup4
3
2
  lxml
4
3
  requests
@@ -1,15 +1,9 @@
1
- """
2
- pip install beautifulsoup4
3
- pip install lxml
4
- pip install requests
5
- """
6
- from urllib.parse import urlparse, urljoin
1
+ from urllib.parse import urljoin, urlparse
7
2
 
3
+ import graphinate.builders
8
4
  import networkx as nx
9
5
  import requests
10
6
  from bs4 import BeautifulSoup
11
-
12
- import graphinate.builders
13
7
  from graphinate.materialize.matplotlib import show
14
8
 
15
9
  DEPTH = 0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "Graphinate"
3
- version = "0.0.7"
3
+ version = "0.0.8"
4
4
  authors = [
5
5
  { name = "Eran Rivlis", email = "eran@rivlis.info" },
6
6
  ]
@@ -32,7 +32,7 @@ dependencies = [
32
32
  "loguru>=0.7",
33
33
  "matplotlib>=3.7",
34
34
  "networkx>=3",
35
- "strawberry-graphql[asgi,opentelemetry]",
35
+ "strawberry-graphql[asgi,opentelemetry]"
36
36
  ]
37
37
 
38
38
  [project.urls]
@@ -43,18 +43,16 @@ dependencies = [
43
43
 
44
44
  [project.optional-dependencies]
45
45
  dev = [
46
- "pip-tools",
47
- "pipdeptree"
46
+ "ruff",
47
+ # "pip-tools",
48
+ # "pipdeptree"
48
49
  ]
49
- testing = [
50
+ test = [
50
51
  "pytest >= 7.3.2",
51
52
  "pytest-cov >= 4.1.0",
52
- "pytest-asyncio"
53
- # "pytest-rerunfailures",
54
- # "pytest-xdist",
55
- # build deps for tests
56
- # "flit_core >=2,<4",
57
- # "poetry_core>=1.0.0",
53
+ # "pytest-asyncio"
54
+ # "pytest-rerunfailures",
55
+ # "pytest-xdist",
58
56
  ]
59
57
  plot = [
60
58
  "matplotlib",
@@ -66,8 +64,6 @@ server = [
66
64
  ]
67
65
 
68
66
  [build-system]
69
- #requires = ["setuptools>=61.0"]
70
- #build-backend = "setuptools.build_meta"
71
67
  requires = ["hatchling"]
72
68
  build-backend = "hatchling.build"
73
69
 
@@ -78,6 +74,10 @@ allow-direct-references = true
78
74
  pythonpath = ["src"]
79
75
  testpaths = ["tests"]
80
76
 
77
+ [tool.black]
78
+ line-length = 120
79
+ #extend-exclude = ''
80
+
81
81
  [tool.ruff]
82
82
  select = [
83
83
  "E",
@@ -133,4 +133,4 @@ multiline-quotes = "single"
133
133
 
134
134
  [tool.ruff.mccabe]
135
135
  # Unlike Flake8, default to a complexity level of 10.
136
- max-complexity = 15
136
+ max-complexity = 15
@@ -100,11 +100,12 @@ class Builder(ABC):
100
100
  })
101
101
 
102
102
  def __init__(self, model: GraphModel, graph_type: GraphType = GraphType.Graph):
103
+ self._cached_build_kwargs = {}
103
104
  self.model = model
104
105
  self.graph_type = graph_type
105
106
 
106
107
  def build(self, **kwargs):
107
- raise NotImplementedError()
108
+ self._cached_build_kwargs = kwargs
108
109
 
109
110
 
110
111
  class NetworkxBuilder(Builder):
@@ -257,7 +258,8 @@ class NetworkxBuilder(Builder):
257
258
 
258
259
  self._graph.graph['created'] = datetime.utcnow()
259
260
 
260
- def build(self, **kwargs) -> nx.Graph:
261
+ def build(self, **kwargs):
262
+ super().build(**kwargs)
261
263
  default_node_attributes = dict(**self.default_node_attributes)
262
264
  if 'default_node_attributes' in kwargs:
263
265
  default_node_attributes.update(kwargs.pop('default_node_attributes') or {})
@@ -278,8 +280,8 @@ class D3Builder(NetworkxBuilder):
278
280
  super().__init__(model, graph_type)
279
281
 
280
282
  def build(self, **kwargs) -> dict:
281
- nx_graph: nx.Graph = super().build(**kwargs)
282
- return self.from_networkx(nx_graph)
283
+ super().build(**kwargs)
284
+ return self.from_networkx(self._graph)
283
285
 
284
286
  @staticmethod
285
287
  def from_networkx(nx_graph: nx.Graph):
@@ -507,12 +509,14 @@ class GraphQLBuilder(NetworkxBuilder):
507
509
 
508
510
  return {k: GraphQLBuilder._graphql_type(k, v) for k, v in graphql_types.items()}
509
511
 
510
- def _graphql_query(self):
512
+ def _graphql_query(self): # noqa: C901
511
513
  # inflect engine to generate Plurals when needed
512
514
  inflection = inflect.engine()
513
515
 
514
- # local references to instance fields in order to "inject" into dynamically generated class methods
515
- graph: nx.Graph = self._graph
516
+ # local reference to instance fields in order to "inject" into dynamically generated class methods
517
+ def get_graph():
518
+ return self._graph
519
+
516
520
  graphql_types = self._graphql_types
517
521
 
518
522
  # region - Defining GraphQL Query Class dict
@@ -520,6 +524,7 @@ class GraphQLBuilder(NetworkxBuilder):
520
524
 
521
525
  # region - Defining GraphQL Query Class dict - graph field
522
526
  def graphql_graph(self) -> GraphQLBuilder.Graph:
527
+ graph = get_graph()
523
528
  return GraphQLBuilder.Graph(
524
529
  graph=graph,
525
530
  name=graph.graph['name'],
@@ -549,6 +554,9 @@ class GraphQLBuilder(NetworkxBuilder):
549
554
 
550
555
  def graph_nodes(self,
551
556
  node_id: Optional[strawberry.ID] = strawberry.UNSET) -> list[GraphQLBuilder.GraphNode]:
557
+
558
+ graph = get_graph()
559
+
552
560
  if graphql_type:
553
561
  nodes = (GraphQLBuilder._graph_node(graphql_type, n, d) for n, d in graph.nodes(data=True))
554
562
  else:
@@ -580,6 +588,8 @@ class GraphQLBuilder(NetworkxBuilder):
580
588
 
581
589
  def graph_edges(self,
582
590
  edge_id: Optional[strawberry.ID] = strawberry.UNSET) -> list[GraphQLBuilder.GraphEdge]:
591
+ graph = get_graph()
592
+
583
593
  edges = (graph_edge((source, target), data) for source, target, data in graph.edges(data=True))
584
594
 
585
595
  def filter_edge(edge):
@@ -607,6 +617,9 @@ class GraphQLBuilder(NetworkxBuilder):
607
617
  # region - Defining GraphQL Query Class dict - field measure for 'GraphMeasure' GraphQL type
608
618
 
609
619
  def graph_measure(self, measure: GraphQLBuilder.GraphMeasure) -> GraphQLBuilder.Measure:
620
+
621
+ graph = get_graph()
622
+
610
623
  if isinstance(measure.value, str):
611
624
  method = measure.value
612
625
  module = nx
@@ -632,17 +645,29 @@ class GraphQLBuilder(NetworkxBuilder):
632
645
 
633
646
  return query_graphql_type
634
647
 
635
- def schema(self) -> strawberry.Schema:
636
- query_graphql_type = self._graphql_query()
637
- graphql_types = self._graphql_types
648
+ def _graphql_mutation(self):
638
649
 
650
+ refresh_graph = functools.partial(super().build, **self._cached_build_kwargs)
651
+
652
+ @strawberry.type
653
+ class Mutation:
654
+
655
+ @strawberry.mutation
656
+ def refresh(self) -> bool:
657
+ refresh_graph()
658
+ return True
659
+
660
+ return Mutation
661
+
662
+ def schema(self) -> strawberry.Schema:
639
663
  # define and return Schema
640
- return strawberry.Schema(query=query_graphql_type, types=graphql_types.values())
664
+ return strawberry.Schema(query=self._graphql_query(),
665
+ mutation=self._graphql_mutation(),
666
+ types=self._graphql_types.values())
641
667
 
642
668
  def build(self, **kwargs) -> strawberry.Schema:
643
669
  super().build(**kwargs)
644
- schema: strawberry.Schema = self.schema()
645
- return schema
670
+ return self.schema()
646
671
 
647
672
 
648
673
  class D3GraphQLBuilder(D3Builder):
@@ -6,7 +6,7 @@ import click
6
6
  from . import builders
7
7
  from .materialize import materialize
8
8
  from .modeling import GraphModel
9
- from .server import run_graphql
9
+ from .server import DEFAULT_PORT, run_graphql
10
10
  from .tools.importer import import_from_string
11
11
 
12
12
 
@@ -28,7 +28,7 @@ def save(model, *args, **kwargs):
28
28
 
29
29
  @cli.command()
30
30
  @click.argument('model')
31
- @click.option('-p', '--port', type=int, default=8072)
31
+ @click.option('-p', '--port', type=int, default=DEFAULT_PORT)
32
32
  def server(model, port, *args, **kwargs):
33
33
  graph_model: GraphModel = import_from_string(model) if isinstance(model, str) else model
34
34
  materialize(title=graph_model.name,
@@ -6,8 +6,10 @@ from strawberry.asgi import GraphQL
6
6
 
7
7
  from .starlette import routes
8
8
 
9
+ DEFAULT_PORT: int = 8072
9
10
 
10
- def run_graphql(graphql_schema: strawberry.Schema, port: int = 8072):
11
+
12
+ def run_graphql(graphql_schema: strawberry.Schema, port: int = DEFAULT_PORT):
11
13
  def open_url():
12
14
  for app_name in ('voyager', 'graphiql', 'viewer'):
13
15
  webbrowser.open(f'http://localhost:{port}/{app_name}')
graphinate-0.0.7/PKG-INFO DELETED
@@ -1,132 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: Graphinate
3
- Version: 0.0.7
4
- Summary: Graphinate. Data to Graphs.
5
- Project-URL: Homepage, https://github.com/erivlis/graphinate
6
- Project-URL: Documentation, https://github.com/erivlis/graphinate#README.md
7
- Project-URL: Bug Tracker, https://github.com/erivlis/graphinate/issues
8
- Project-URL: Source, https://github.com/erivlis/graphinate
9
- Author-email: Eran Rivlis <eran@rivlis.info>
10
- License-File: LICENSE
11
- Keywords: declarative,graph
12
- Classifier: Development Status :: 2 - Pre-Alpha
13
- Classifier: Intended Audience :: Developers
14
- Classifier: Intended Audience :: Information Technology
15
- Classifier: Intended Audience :: Science/Research
16
- Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)
17
- Classifier: Natural Language :: English
18
- Classifier: Operating System :: OS Independent
19
- Classifier: Programming Language :: Python :: 3
20
- Classifier: Programming Language :: Python :: 3 :: Only
21
- Classifier: Programming Language :: Python :: 3.9
22
- Classifier: Programming Language :: Python :: 3.10
23
- Classifier: Programming Language :: Python :: 3.11
24
- Classifier: Programming Language :: Python :: Implementation :: CPython
25
- Classifier: Topic :: Scientific/Engineering
26
- Classifier: Topic :: Software Development :: Libraries
27
- Classifier: Typing :: Typed
28
- Requires-Python: >=3.9
29
- Requires-Dist: click>=8
30
- Requires-Dist: inflect>=7
31
- Requires-Dist: loguru>=0.7
32
- Requires-Dist: matplotlib>=3.7
33
- Requires-Dist: networkx>=3
34
- Requires-Dist: strawberry-graphql[asgi,opentelemetry]
35
- Provides-Extra: dev
36
- Requires-Dist: pip-tools; extra == 'dev'
37
- Requires-Dist: pipdeptree; extra == 'dev'
38
- Provides-Extra: plot
39
- Requires-Dist: matplotlib; extra == 'plot'
40
- Requires-Dist: scipy; extra == 'plot'
41
- Provides-Extra: server
42
- Requires-Dist: starlette-prometheus; extra == 'server'
43
- Requires-Dist: uvicorn[standard]; extra == 'server'
44
- Provides-Extra: testing
45
- Requires-Dist: pytest-asyncio; extra == 'testing'
46
- Requires-Dist: pytest-cov>=4.1.0; extra == 'testing'
47
- Requires-Dist: pytest>=7.3.2; extra == 'testing'
48
- Description-Content-Type: text/markdown
49
-
50
- # Graphinate. Data to Graphs.
51
-
52
- ## ⚠️ **Under Development!** ⚠️
53
-
54
- This library is alpha-quality
55
-
56
- ![PyPI](https://img.shields.io/pypi/v/graphinate)
57
- ![PyPI - Status](https://img.shields.io/pypi/status/graphinate)
58
- ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/graphinate)
59
- ![GitHub](https://img.shields.io/github/license/erivlis/graphinate)
60
- ![PyPI - Downloads](https://img.shields.io/pypi/dd/graphinate)
61
- ![GitHub repo size](https://img.shields.io/github/repo-size/erivlis/graphinate)
62
- [![Contributors](https://img.shields.io/github/contributors/erivlis/graphinate.svg)](https://github.com/erivlis/graphinate/graphs/contributors)
63
- ![GitHub last commit (by committer)](https://img.shields.io/github/last-commit/erivlis/graphinate)
64
-
65
- [![Tests](https://github.com/erivlis/graphinate/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/erivlis/graphinate/actions/workflows/test.yml)
66
- [![Publish](https://github.com/erivlis/graphinate/actions/workflows/publish.yml/badge.svg)](https://github.com/erivlis/graphinate/actions/workflows/publish.yml)
67
-
68
- ## Gallery
69
-
70
- ![d3_graph_ast](https://github.com/erivlis/graphinate/assets/9897520/9e7e1ed2-3a5c-41fe-8c5f-999da4b741ff)
71
- ![repo_graph](https://github.com/erivlis/graphinate/assets/9897520/9c044bbe-1f21-41b8-b879-95b8362ad48d)
72
- ![AST 3D Force animation](https://github.com/erivlis/graphinate/assets/9897520/2e9a53b1-5686-4683-a0e4-fbffa850a27b)
73
-
74
- ## Install
75
-
76
- Graphinate is available on PyPI:
77
-
78
- ```console
79
- python -m pip install graphinate
80
- ```
81
-
82
- Graphinate officially supports Python 3.9+.
83
-
84
- ## Examples
85
-
86
- - [ ] Code
87
- - [ ] Call Graph
88
- - [x] Python AST
89
- - [x] GitHub
90
- - [x] Repository
91
- - [x] Followers
92
- - [ ] Ethernet
93
- - [ ] Traceroute
94
- - [ ] Math
95
- - [x] Graph Atlas
96
- - [ ] Hailstone
97
- - [ ] Text
98
- - [ ] NLP
99
- - [ ] Web
100
- - [ ] Web Graph
101
-
102
- ## API
103
-
104
- ### By Convention
105
-
106
- ### By Configuration
107
-
108
- ## Development
109
-
110
- ### Lint
111
-
112
- ```shell
113
- ruff check src
114
- ```
115
-
116
- ### Docs
117
-
118
- ```shell
119
- python -m mkdocs build
120
- ```
121
-
122
- ### Build
123
-
124
- ```shell
125
- python -m build
126
- ```
127
-
128
- ### Test
129
-
130
- ```shell
131
- python -m pytest ./tests --cov=./src --cov-branch --cov-report=xml --junitxml=test_results.xml
132
- ```
@@ -1,83 +0,0 @@
1
- # Graphinate. Data to Graphs.
2
-
3
- ## ⚠️ **Under Development!** ⚠️
4
-
5
- This library is alpha-quality
6
-
7
- ![PyPI](https://img.shields.io/pypi/v/graphinate)
8
- ![PyPI - Status](https://img.shields.io/pypi/status/graphinate)
9
- ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/graphinate)
10
- ![GitHub](https://img.shields.io/github/license/erivlis/graphinate)
11
- ![PyPI - Downloads](https://img.shields.io/pypi/dd/graphinate)
12
- ![GitHub repo size](https://img.shields.io/github/repo-size/erivlis/graphinate)
13
- [![Contributors](https://img.shields.io/github/contributors/erivlis/graphinate.svg)](https://github.com/erivlis/graphinate/graphs/contributors)
14
- ![GitHub last commit (by committer)](https://img.shields.io/github/last-commit/erivlis/graphinate)
15
-
16
- [![Tests](https://github.com/erivlis/graphinate/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/erivlis/graphinate/actions/workflows/test.yml)
17
- [![Publish](https://github.com/erivlis/graphinate/actions/workflows/publish.yml/badge.svg)](https://github.com/erivlis/graphinate/actions/workflows/publish.yml)
18
-
19
- ## Gallery
20
-
21
- ![d3_graph_ast](https://github.com/erivlis/graphinate/assets/9897520/9e7e1ed2-3a5c-41fe-8c5f-999da4b741ff)
22
- ![repo_graph](https://github.com/erivlis/graphinate/assets/9897520/9c044bbe-1f21-41b8-b879-95b8362ad48d)
23
- ![AST 3D Force animation](https://github.com/erivlis/graphinate/assets/9897520/2e9a53b1-5686-4683-a0e4-fbffa850a27b)
24
-
25
- ## Install
26
-
27
- Graphinate is available on PyPI:
28
-
29
- ```console
30
- python -m pip install graphinate
31
- ```
32
-
33
- Graphinate officially supports Python 3.9+.
34
-
35
- ## Examples
36
-
37
- - [ ] Code
38
- - [ ] Call Graph
39
- - [x] Python AST
40
- - [x] GitHub
41
- - [x] Repository
42
- - [x] Followers
43
- - [ ] Ethernet
44
- - [ ] Traceroute
45
- - [ ] Math
46
- - [x] Graph Atlas
47
- - [ ] Hailstone
48
- - [ ] Text
49
- - [ ] NLP
50
- - [ ] Web
51
- - [ ] Web Graph
52
-
53
- ## API
54
-
55
- ### By Convention
56
-
57
- ### By Configuration
58
-
59
- ## Development
60
-
61
- ### Lint
62
-
63
- ```shell
64
- ruff check src
65
- ```
66
-
67
- ### Docs
68
-
69
- ```shell
70
- python -m mkdocs build
71
- ```
72
-
73
- ### Build
74
-
75
- ```shell
76
- python -m build
77
- ```
78
-
79
- ### Test
80
-
81
- ```shell
82
- python -m pytest ./tests --cov=./src --cov-branch --cov-report=xml --junitxml=test_results.xml
83
- ```
@@ -1 +0,0 @@
1
- PyGithub
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes