Graphinate 0.2.11__tar.gz → 0.2.13__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.
- {graphinate-0.2.11 → graphinate-0.2.13}/PKG-INFO +8 -8
- graphinate-0.2.13/docs/assets/images/logo-128.png +0 -0
- graphinate-0.2.13/docs/intro.md +110 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/docs/usage/lib.md +4 -4
- {graphinate-0.2.11 → graphinate-0.2.13}/examples/code/python_dependencies.py +1 -1
- {graphinate-0.2.11 → graphinate-0.2.13}/mkdocs.yml +2 -2
- {graphinate-0.2.11 → graphinate-0.2.13}/pyproject.toml +14 -13
- graphinate-0.2.13/src/graphinate/server/__init__.py +108 -0
- graphinate-0.2.13/src/graphinate/server/web/elements/index.html +20 -0
- graphinate-0.2.13/src/graphinate/server/web/rapidoc/index.html +14 -0
- graphinate-0.2.13/src/graphinate/server/web/static/images/logo-128.png +0 -0
- graphinate-0.2.13/src/graphinate/server/web/voyager/__init__.py +0 -0
- graphinate-0.2.13/src/graphinate/tools/__init__.py +0 -0
- graphinate-0.2.11/docs/assets/images/logo-128.png +0 -0
- graphinate-0.2.11/docs/intro.md +0 -74
- graphinate-0.2.11/src/graphinate/server/__init__.py +0 -48
- graphinate-0.2.11/src/graphinate/server/web/static/images/logo-128.png +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/.coveragerc +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/.github/dependabot.yml +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/.github/workflows/codeql.yml +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/.github/workflows/publish-docs.yaml +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/.github/workflows/publish.yml +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/.github/workflows/test-beta.yml +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/.github/workflows/test.yml +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/.gitignore +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/LICENSE +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/README.md +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/STATS.md +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/docs/acknowledge.md +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/docs/assets/images/network_graph.png +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/docs/assets/stylesheets/extra.css +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/docs/dev.md +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/docs/examples/code.md +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/docs/examples/github.md +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/docs/examples/math.md +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/docs/examples/web.md +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/docs/gen_ref_pages.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/docs/index.md +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/docs/start.md +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/docs/usage/cli.md +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/examples/code/python_ast.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/examples/code/requirements.txt +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/examples/github/_client.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/examples/github/commits_visibilty_graph.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/examples/github/followers.graphql +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/examples/github/followers.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/examples/github/graphql.config.yml +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/examples/github/repositories.graphql +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/examples/github/repositories.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/examples/github/requirements.txt +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/examples/math/graph_atlas.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/examples/math/polygonal_graph.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/examples/web/page_links.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/examples/web/requirements.txt +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/playground/ethernet/traceroute.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/playground/genric_graph.graphql +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/playground/graphql.config.yml +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/playground/house_of_graphs.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/playground/social/albums.json +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/playground/social/musicisians.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/playground/text/nlp_graph.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/playground/text/requirements.txt +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/playground/time_series/requirements.txt +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/playground/time_series/visibility_graph.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/sonar-project.properties +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/src/graphinate/__init__.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/src/graphinate/__main__.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/src/graphinate/builders.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/src/graphinate/cli.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/src/graphinate/color.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/src/graphinate/materializers/__init__.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/src/graphinate/materializers/matplotlib.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/src/graphinate/modeling.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/src/graphinate/server/starlette/__init__.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/src/graphinate/server/starlette/views.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/src/graphinate/server/web/__init__.py +0 -0
- {graphinate-0.2.11/src/graphinate/server/web/graphiql → graphinate-0.2.13/src/graphinate/server/web/elements}/__init__.py +0 -0
- {graphinate-0.2.11/src/graphinate/server/web/viewer → graphinate-0.2.13/src/graphinate/server/web/graphiql}/__init__.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/src/graphinate/server/web/graphiql/index.html +0 -0
- {graphinate-0.2.11/src/graphinate/server/web/voyager → graphinate-0.2.13/src/graphinate/server/web/rapidoc}/__init__.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/src/graphinate/server/web/static/images/network_graph.png +0 -0
- {graphinate-0.2.11/src/graphinate/tools → graphinate-0.2.13/src/graphinate/server/web/viewer}/__init__.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/src/graphinate/server/web/viewer/index.html +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/src/graphinate/server/web/voyager/index.html +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/src/graphinate/tools/gui.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/src/graphinate/tools/mutators.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/src/graphinate/typing.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/tests/conftest.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/tests/graphinate/test_builders.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/tests/graphinate/test_cli.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/tests/graphinate/test_color.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/tests/graphinate/test_materializers.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/tests/graphinate/test_modeling.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/tests/graphinate/test_server.py +0 -0
- {graphinate-0.2.11 → graphinate-0.2.13}/tests/graphinate/test_tools.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: Graphinate
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.13
|
|
4
4
|
Summary: Graphinate. Data to Graphs.
|
|
5
5
|
Project-URL: Homepage, https://erivlis.github.io/graphinate
|
|
6
6
|
Project-URL: Documentation, https://erivlis.github.io/graphinate
|
|
@@ -30,9 +30,9 @@ Requires-Python: >=3.9
|
|
|
30
30
|
Requires-Dist: click==8.1.7
|
|
31
31
|
Requires-Dist: inflect==7.0.0
|
|
32
32
|
Requires-Dist: loguru==0.7.2
|
|
33
|
-
Requires-Dist: matplotlib==3.8.
|
|
33
|
+
Requires-Dist: matplotlib==3.8.3
|
|
34
34
|
Requires-Dist: networkx==3.2.1
|
|
35
|
-
Requires-Dist: strawberry-graphql[asgi,opentelemetry]==0.
|
|
35
|
+
Requires-Dist: strawberry-graphql[asgi,opentelemetry]==0.219.2
|
|
36
36
|
Provides-Extra: dev
|
|
37
37
|
Requires-Dist: pipdeptree; extra == 'dev'
|
|
38
38
|
Requires-Dist: ruff; extra == 'dev'
|
|
@@ -45,17 +45,17 @@ Requires-Dist: mkdocs-material; extra == 'docs'
|
|
|
45
45
|
Requires-Dist: mkdocs-section-index; extra == 'docs'
|
|
46
46
|
Requires-Dist: mkdocstrings-python; extra == 'docs'
|
|
47
47
|
Provides-Extra: plot
|
|
48
|
-
Requires-Dist: scipy>=1.
|
|
48
|
+
Requires-Dist: scipy>=1.12.0; extra == 'plot'
|
|
49
49
|
Provides-Extra: server
|
|
50
50
|
Requires-Dist: starlette-prometheus; extra == 'server'
|
|
51
|
-
Requires-Dist: uvicorn[standard]>=0.
|
|
51
|
+
Requires-Dist: uvicorn[standard]>=0.27.0; extra == 'server'
|
|
52
52
|
Provides-Extra: test
|
|
53
|
-
Requires-Dist: faker>=
|
|
54
|
-
Requires-Dist: pytest-asyncio>=0.
|
|
53
|
+
Requires-Dist: faker>=23.2.1; extra == 'test'
|
|
54
|
+
Requires-Dist: pytest-asyncio>=0.23.4; extra == 'test'
|
|
55
55
|
Requires-Dist: pytest-cov>=4.1.0; extra == 'test'
|
|
56
56
|
Requires-Dist: pytest-randomly>=3.15.0; extra == 'test'
|
|
57
57
|
Requires-Dist: pytest-xdist>=3.5.0; extra == 'test'
|
|
58
|
-
Requires-Dist: pytest>=7.4.
|
|
58
|
+
Requires-Dist: pytest>=7.4.4; extra == 'test'
|
|
59
59
|
Description-Content-Type: text/markdown
|
|
60
60
|
|
|
61
61
|
# [Graphinate. Data to Graphs.](https://erivlis.github.io/graphinate/)
|
|
Binary file
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Introduction
|
|
2
|
+
|
|
3
|
+
## What?
|
|
4
|
+
|
|
5
|
+
### What is Graphinate?
|
|
6
|
+
|
|
7
|
+
**Graphinate** is a python library that aims to simplify the generation of Graph Data Structures from Data Sources.
|
|
8
|
+
|
|
9
|
+
It can help create an efficient retrieval pipeline from a given data source, while also enabling the developer to map
|
|
10
|
+
data payloads and hierarchies to a Graph.
|
|
11
|
+
|
|
12
|
+
In addition, there are several modes of output to enable examination of the Graph and its content.
|
|
13
|
+
|
|
14
|
+
**Graphinate** utilizes and builds upon the excellent [**_NetworkX_**](https://networkx.org/).
|
|
15
|
+
|
|
16
|
+
### What is a Graph?
|
|
17
|
+
|
|
18
|
+
“In a mathematician's terminology, a graph is a collection of points and lines connecting some (possibly empty) subset
|
|
19
|
+
of them.
|
|
20
|
+
The points of a graph are most commonly known as graph *vertices*, but may also be called *nodes* or *points*.
|
|
21
|
+
Similarly, the lines connecting the vertices of a graph are most commonly known as graph *edges*, but may also
|
|
22
|
+
be called *arcs* or *lines*.”
|
|
23
|
+
|
|
24
|
+
— [https://mathworld.wolfram.com/Graph.html](https://mathworld.wolfram.com/Graph.html)
|
|
25
|
+
|
|
26
|
+
### What is Data?
|
|
27
|
+
|
|
28
|
+
“...data is a collection of discrete or continuous values that convey information, describing the quantity, quality,
|
|
29
|
+
fact, statistics, other basic units of meaning, or simply sequences of symbols that may be further interpreted
|
|
30
|
+
formally.”
|
|
31
|
+
|
|
32
|
+
— [https://en.wikipedia.org/wiki/Data](https://en.wikipedia.org/wiki/Data)
|
|
33
|
+
|
|
34
|
+
## How?
|
|
35
|
+
|
|
36
|
+
### A Graph as a Data Structure
|
|
37
|
+
|
|
38
|
+
A Graph is a quite useful data structure.
|
|
39
|
+
It is perhaps the simplest data structure, that is a bit more than just a
|
|
40
|
+
simple collection of "things".
|
|
41
|
+
As such, it can be used to model all data sources that have structure.
|
|
42
|
+
|
|
43
|
+
### Graph Elements
|
|
44
|
+
|
|
45
|
+
A Graph consists of two types of elements:
|
|
46
|
+
|
|
47
|
+
#### Nodes
|
|
48
|
+
|
|
49
|
+
A Graph Node can be any Python Hashable object. Usually it will be a primitive type such as an integer or a string,
|
|
50
|
+
in particular when the node in itself has no special meaning.
|
|
51
|
+
One can also add attributes to the node to describe additional information.
|
|
52
|
+
This information can include anything. Often they are used to store scalar dimensions (e.g., weight, area, width, age etc.)
|
|
53
|
+
or stylistic information (e.g., color, size, shape, label etc.).
|
|
54
|
+
|
|
55
|
+
#### Edges
|
|
56
|
+
|
|
57
|
+
A Graph Edge is a tuple of two node values. It can also have additional attributes in the same vain as a Graph Node.
|
|
58
|
+
|
|
59
|
+
### Defining a Graph
|
|
60
|
+
|
|
61
|
+
One can define a Graph in two general ways:
|
|
62
|
+
|
|
63
|
+
#### Edge First
|
|
64
|
+
|
|
65
|
+
The most straight forward way to generate a Graph is to supply a list of edges. The simplest definition of an edge is a
|
|
66
|
+
tuple of two values. Each value represents a node (or vertex) in the graph. Attributes may be added to the edge
|
|
67
|
+
definition to convey additional characteristics.
|
|
68
|
+
|
|
69
|
+
In this case, one defines the **edges explicitly** and the **nodes implicitly**.
|
|
70
|
+
|
|
71
|
+
Such a graph is focused more on the _relationships_ between nodes or the _structure_ of the graph than on the nodes themselves.
|
|
72
|
+
|
|
73
|
+
#### Node First
|
|
74
|
+
|
|
75
|
+
Alternatively, one can first add nodes (vertices) to a graph without defining edges. Attributes may be added
|
|
76
|
+
to the node definitions to convey additional characteristics. After that, edge definitions are added to generate the
|
|
77
|
+
relationships between the nodes.
|
|
78
|
+
|
|
79
|
+
In this case, **both nodes and the edges** are defined **explicitly**.
|
|
80
|
+
|
|
81
|
+
Such a graph has focus, first on the nodes, and then on the relationship between them.
|
|
82
|
+
|
|
83
|
+
### Graphinate
|
|
84
|
+
|
|
85
|
+
"Hydrate" a Graph from a Data Source.
|
|
86
|
+
Using Graphinate enables generating graphs from data sources.
|
|
87
|
+
It supports both *Edge First* and *Node First* creation scenarios.
|
|
88
|
+
|
|
89
|
+
This is achieved following these steps:
|
|
90
|
+
|
|
91
|
+
#### Source
|
|
92
|
+
|
|
93
|
+
It is required to represent the Data sources as an Iterable of items that will be transformed to graph edges
|
|
94
|
+
and/or nodes.
|
|
95
|
+
It is recommended to use Generators as the items Iterables.
|
|
96
|
+
|
|
97
|
+
#### Model
|
|
98
|
+
|
|
99
|
+
Using Graphinate GraphMode decorators, we can define how to transform the items supplied by the data source generators,
|
|
100
|
+
to graph elements.
|
|
101
|
+
|
|
102
|
+
#### Build
|
|
103
|
+
A Graph Model can be used to generate an actual instance of a Graph.
|
|
104
|
+
It is achieved by using a GraphBuilder to both retrieve the data and assemble the Graph.
|
|
105
|
+
Several formats are available.
|
|
106
|
+
|
|
107
|
+
#### Materialize
|
|
108
|
+
|
|
109
|
+
Finally, we can use the builders to Materialize the graph in several ways that support different use cases
|
|
110
|
+
(i.e., visualizing, querying, reporting, etc.)
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
## SDK
|
|
20
20
|
|
|
21
|
-
###
|
|
21
|
+
### Model
|
|
22
22
|
|
|
23
23
|
* [`graphinate.GraphModel`](/reference/graphinate/modeling/#graphinate.modeling.GraphModel)
|
|
24
24
|
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
|
|
29
29
|
* [`graphinate.NodeModel`](/reference/graphinate/modeling/#graphinate.modeling.NodeModel) - TBD
|
|
30
30
|
|
|
31
|
-
###
|
|
31
|
+
### Build
|
|
32
32
|
|
|
33
33
|
* [`graphinate.builders.NetworkxBuilder`](/reference/graphinate/builders/#graphinate.builders.NetworkxBuilder) -
|
|
34
34
|
Generates a NetworkX Graph instance.
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
* [`graphinate.builders.GraphQLBuilder`](/reference/graphinate/builders/#graphinate.builders.GraphQLBuilder) - Generates
|
|
40
40
|
a Strawberry GraphQL Schema instance
|
|
41
41
|
|
|
42
|
-
###
|
|
42
|
+
### Actualize
|
|
43
43
|
|
|
44
44
|
> TBD
|
|
45
45
|
|
|
46
|
-
###
|
|
46
|
+
### Materialize
|
|
47
47
|
|
|
48
48
|
> TBD
|
|
@@ -68,8 +68,8 @@ markdown_extensions:
|
|
|
68
68
|
use_pygments: true
|
|
69
69
|
pygments_lang_class: true
|
|
70
70
|
- pymdownx.emoji:
|
|
71
|
-
emoji_index: !!python/name:
|
|
72
|
-
emoji_generator: !!python/name:
|
|
71
|
+
emoji_index: !!python/name:material.extensions.emoji.twemoji
|
|
72
|
+
emoji_generator: !!python/name:material.extensions.emoji.to_svg
|
|
73
73
|
- pymdownx.inlinehilite
|
|
74
74
|
- pymdownx.snippets
|
|
75
75
|
- pymdownx.superfences
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "Graphinate"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.13"
|
|
4
4
|
authors = [
|
|
5
5
|
{ name = "Eran Rivlis", email = "eran@rivlis.info" },
|
|
6
6
|
]
|
|
@@ -31,9 +31,9 @@ dependencies = [
|
|
|
31
31
|
"click==8.1.7",
|
|
32
32
|
"inflect==7.0.0",
|
|
33
33
|
"loguru==0.7.2",
|
|
34
|
-
"matplotlib==3.8.
|
|
34
|
+
"matplotlib==3.8.3",
|
|
35
35
|
"networkx==3.2.1",
|
|
36
|
-
"strawberry-graphql[asgi,opentelemetry]==0.
|
|
36
|
+
"strawberry-graphql[asgi,opentelemetry]==0.219.2"
|
|
37
37
|
]
|
|
38
38
|
|
|
39
39
|
|
|
@@ -59,19 +59,19 @@ docs = [
|
|
|
59
59
|
"mkdocs-section-index",
|
|
60
60
|
]
|
|
61
61
|
test = [
|
|
62
|
-
"faker>=
|
|
63
|
-
"pytest>=7.4.
|
|
64
|
-
"pytest-asyncio>=0.
|
|
62
|
+
"faker>=23.2.1",
|
|
63
|
+
"pytest>=7.4.4",
|
|
64
|
+
"pytest-asyncio>=0.23.4",
|
|
65
65
|
"pytest-cov>=4.1.0",
|
|
66
66
|
"pytest-randomly>=3.15.0",
|
|
67
67
|
"pytest-xdist>=3.5.0"
|
|
68
68
|
]
|
|
69
69
|
plot = [
|
|
70
|
-
"scipy>=1.
|
|
70
|
+
"scipy>=1.12.0"
|
|
71
71
|
]
|
|
72
72
|
server = [
|
|
73
73
|
"starlette-prometheus",
|
|
74
|
-
"uvicorn[standard]>=0.
|
|
74
|
+
"uvicorn[standard]>=0.27.0"
|
|
75
75
|
]
|
|
76
76
|
|
|
77
77
|
|
|
@@ -102,15 +102,17 @@ exclude_also = [
|
|
|
102
102
|
"if TYPE_CHECKING:",
|
|
103
103
|
"class .*\\bProtocol\\):",
|
|
104
104
|
"@(abc\\.)?abstractmethod"
|
|
105
|
-
|
|
105
|
+
]
|
|
106
106
|
|
|
107
107
|
|
|
108
108
|
[tool.black]
|
|
109
109
|
line-length = 120
|
|
110
110
|
#extend-exclude = ''
|
|
111
111
|
|
|
112
|
-
|
|
113
112
|
[tool.ruff]
|
|
113
|
+
line-length = 120
|
|
114
|
+
|
|
115
|
+
[tool.ruff.lint]
|
|
114
116
|
select = [
|
|
115
117
|
"E",
|
|
116
118
|
"F",
|
|
@@ -154,15 +156,14 @@ exclude = [
|
|
|
154
156
|
]
|
|
155
157
|
# Allow unused variables when underscore-prefixed.
|
|
156
158
|
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
|
|
157
|
-
line-length = 120
|
|
158
159
|
|
|
159
160
|
|
|
160
|
-
[tool.ruff.flake8-quotes]
|
|
161
|
+
[tool.ruff.lint.flake8-quotes]
|
|
161
162
|
docstring-quotes = "double"
|
|
162
163
|
inline-quotes = "single"
|
|
163
164
|
multiline-quotes = "single"
|
|
164
165
|
|
|
165
166
|
|
|
166
|
-
[tool.ruff.mccabe]
|
|
167
|
+
[tool.ruff.lint.mccabe]
|
|
167
168
|
# Unlike Flake8, default to a complexity level of 10.
|
|
168
169
|
max-complexity = 15
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import contextlib
|
|
2
|
+
import webbrowser
|
|
3
|
+
|
|
4
|
+
import strawberry
|
|
5
|
+
from starlette.applications import Starlette
|
|
6
|
+
from starlette.schemas import SchemaGenerator
|
|
7
|
+
from strawberry.asgi import GraphQL
|
|
8
|
+
from strawberry.extensions.tracing import OpenTelemetryExtension
|
|
9
|
+
|
|
10
|
+
from .starlette import routes
|
|
11
|
+
|
|
12
|
+
DEFAULT_PORT: int = 8072
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def openapi_schema(request):
|
|
16
|
+
schema = SchemaGenerator(
|
|
17
|
+
{
|
|
18
|
+
"openapi": "3.0.0",
|
|
19
|
+
"info": {"title": "Graphinate API", "version": "1.0"},
|
|
20
|
+
"paths": {
|
|
21
|
+
"/graphql": {
|
|
22
|
+
"get": {
|
|
23
|
+
"responses": {
|
|
24
|
+
200: {
|
|
25
|
+
"description": "GraphQL"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"/graphiql": {
|
|
31
|
+
"get": {
|
|
32
|
+
"responses": {
|
|
33
|
+
200: {
|
|
34
|
+
"description": "GraphiQL UI."
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"/metrics": {
|
|
40
|
+
"get": {
|
|
41
|
+
"responses": {
|
|
42
|
+
200: {
|
|
43
|
+
"description": "Prometheus metrics."
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"/viewer": {
|
|
49
|
+
"get": {
|
|
50
|
+
"responses": {
|
|
51
|
+
200: {
|
|
52
|
+
"description": "3D Force-Directed Graph Viewer"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"/voyager": {
|
|
58
|
+
"get": {
|
|
59
|
+
"responses": {
|
|
60
|
+
200: {
|
|
61
|
+
"description": "Voyager GraphQL Schema Viewer"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
return schema.OpenAPIResponse(request=request)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def graphql(graphql_schema: strawberry.Schema, port: int = DEFAULT_PORT):
|
|
73
|
+
"""
|
|
74
|
+
|
|
75
|
+
Args:
|
|
76
|
+
graphql_schema:
|
|
77
|
+
port:
|
|
78
|
+
|
|
79
|
+
Returns:
|
|
80
|
+
|
|
81
|
+
"""
|
|
82
|
+
graphql_schema.extensions.append(OpenTelemetryExtension)
|
|
83
|
+
|
|
84
|
+
@contextlib.asynccontextmanager
|
|
85
|
+
async def lifespan(app: Starlette): # pragma: no cover
|
|
86
|
+
def open_url():
|
|
87
|
+
for app_name in ('voyager', 'graphiql', 'viewer'):
|
|
88
|
+
webbrowser.open(f'http://localhost:{port}/{app_name}')
|
|
89
|
+
|
|
90
|
+
open_url()
|
|
91
|
+
yield
|
|
92
|
+
|
|
93
|
+
graphql_app: GraphQL = GraphQL(graphql_schema)
|
|
94
|
+
app = Starlette(
|
|
95
|
+
lifespan=lifespan,
|
|
96
|
+
routes=routes()
|
|
97
|
+
)
|
|
98
|
+
app.add_route("/graphql", graphql_app)
|
|
99
|
+
app.add_websocket_route("/graphql", graphql_app)
|
|
100
|
+
|
|
101
|
+
from starlette_prometheus import PrometheusMiddleware, metrics
|
|
102
|
+
app.add_middleware(PrometheusMiddleware)
|
|
103
|
+
app.add_route("/metrics", metrics)
|
|
104
|
+
|
|
105
|
+
app.add_route("/schema", route=openapi_schema, include_in_schema=False)
|
|
106
|
+
|
|
107
|
+
import uvicorn
|
|
108
|
+
uvicorn.run(app, host='0.0.0.0', port=port)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
|
6
|
+
<title>Elements in HTML</title>
|
|
7
|
+
<!-- Embed elements Elements via Web Component -->
|
|
8
|
+
<script src="https://unpkg.com/@stoplight/elements/web-components.min.js"></script>
|
|
9
|
+
<link rel="stylesheet" href="https://unpkg.com/@stoplight/elements/styles.min.css">
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
|
|
13
|
+
<elements-api
|
|
14
|
+
apiDescriptionUrl="/schema"
|
|
15
|
+
router="hash"
|
|
16
|
+
layout="sidebar"
|
|
17
|
+
/>
|
|
18
|
+
|
|
19
|
+
</body>
|
|
20
|
+
</html>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!doctype html> <!-- Important: must specify -->
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8"> <!-- Important: rapi-doc uses utf8 characters -->
|
|
5
|
+
<script type="module" src="https://unpkg.com/rapidoc/dist/rapidoc-min.js"></script>
|
|
6
|
+
<title>Graphinate OpenAPI</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<rapi-doc
|
|
10
|
+
spec-url="/schema"
|
|
11
|
+
theme = "dark"
|
|
12
|
+
> </rapi-doc>
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
Binary file
|
graphinate-0.2.11/docs/intro.md
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
# Introduction
|
|
2
|
-
|
|
3
|
-
## What?
|
|
4
|
-
|
|
5
|
-
### What is Graphinate?
|
|
6
|
-
|
|
7
|
-
**Graphinate** is a python library that aims to simplify the generation of Graph Data Structures from Data Sources.
|
|
8
|
-
|
|
9
|
-
It can help create an efficient retrieval pipeline from a given data source, while also enabling the developer to easily
|
|
10
|
-
map data payloads and hierarchies to a Graph.
|
|
11
|
-
|
|
12
|
-
In addition, there are several modes of output to enable examination of the Graph, and it's content.
|
|
13
|
-
|
|
14
|
-
**Graphinate** utilizes and builds upon the excellent [**_NetworkX_**](https://networkx.org/).
|
|
15
|
-
|
|
16
|
-
### What is a Graph?
|
|
17
|
-
|
|
18
|
-
“In a mathematician's terminology, a graph is a collection of points and lines connecting some (possibly empty) subset
|
|
19
|
-
of them. The points of a graph are most commonly known as graph vertices, but may also be called "nodes" or simply "
|
|
20
|
-
points." Similarly, the lines connecting the vertices of a graph are most commonly known as graph edges, but may also
|
|
21
|
-
be called "arcs" or "lines."”
|
|
22
|
-
|
|
23
|
-
— [https://mathworld.wolfram.com/Graph.html](https://mathworld.wolfram.com/Graph.html)
|
|
24
|
-
|
|
25
|
-
### What is Data?
|
|
26
|
-
|
|
27
|
-
“...data is a collection of discrete or continuous values that convey information, describing the quantity, quality,
|
|
28
|
-
fact, statistics, other basic units of meaning, or simply sequences of symbols that may be further interpreted
|
|
29
|
-
formally.”
|
|
30
|
-
|
|
31
|
-
— [https://en.wikipedia.org/wiki/Data](https://en.wikipedia.org/wiki/Data)
|
|
32
|
-
|
|
33
|
-
## How?
|
|
34
|
-
|
|
35
|
-
### A Graph as a Data Structure
|
|
36
|
-
|
|
37
|
-
A Graph is a quite useful data structure.
|
|
38
|
-
It is perhaps the simplest data structure, that is a bit more than just a
|
|
39
|
-
simple collection of "things".
|
|
40
|
-
As such, it can be used to model all data sources that have structure.
|
|
41
|
-
|
|
42
|
-
### Define a Graph
|
|
43
|
-
|
|
44
|
-
One can define a Graph in two general ways:
|
|
45
|
-
|
|
46
|
-
#### Edge first
|
|
47
|
-
|
|
48
|
-
The most straight forward way to Generate a Graph is to supply a list of edges. The simplest definition of an edge is a
|
|
49
|
-
tuple of two values. Each value represents a node (or vertex) in the graph. Additional attributes may be added to the edge
|
|
50
|
-
definition to convey additional characteristics.
|
|
51
|
-
|
|
52
|
-
In this case, one defines the **edges explicitly** and the **nodes implicitly**.
|
|
53
|
-
|
|
54
|
-
Such graph is focused more on the _relationships_ or the _structure_ of the Graph than on the nodes themselves.
|
|
55
|
-
|
|
56
|
-
!!! Example
|
|
57
|
-
TBD
|
|
58
|
-
|
|
59
|
-
#### Node first
|
|
60
|
-
|
|
61
|
-
Alternatively, one can first add nodes (vertices) to a graph without defining edges. Additional attributes may be added
|
|
62
|
-
to the node definitions to convey additional characteristics. After that, edge definitions are added to generate the
|
|
63
|
-
relationships between the nodes.
|
|
64
|
-
|
|
65
|
-
In this case, **both nodes and the edges** are defined **explicitly**.
|
|
66
|
-
|
|
67
|
-
Such a graph has focus, first on the nodes, and then on the relationship between them.
|
|
68
|
-
|
|
69
|
-
!!! Example
|
|
70
|
-
TBD
|
|
71
|
-
|
|
72
|
-
### Graphinate - "Hydrate" a Graph from a Data Source
|
|
73
|
-
|
|
74
|
-
> TBD
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import contextlib
|
|
2
|
-
import webbrowser
|
|
3
|
-
|
|
4
|
-
import strawberry
|
|
5
|
-
from starlette.applications import Starlette
|
|
6
|
-
from strawberry.asgi import GraphQL
|
|
7
|
-
from strawberry.extensions.tracing import OpenTelemetryExtension
|
|
8
|
-
|
|
9
|
-
from .starlette import routes
|
|
10
|
-
|
|
11
|
-
DEFAULT_PORT: int = 8072
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def graphql(graphql_schema: strawberry.Schema, port: int = DEFAULT_PORT):
|
|
15
|
-
"""
|
|
16
|
-
|
|
17
|
-
Args:
|
|
18
|
-
graphql_schema:
|
|
19
|
-
port:
|
|
20
|
-
|
|
21
|
-
Returns:
|
|
22
|
-
|
|
23
|
-
"""
|
|
24
|
-
graphql_schema.extensions.append(OpenTelemetryExtension)
|
|
25
|
-
|
|
26
|
-
@contextlib.asynccontextmanager
|
|
27
|
-
async def lifespan(app: Starlette): # pragma: no cover
|
|
28
|
-
def open_url():
|
|
29
|
-
for app_name in ('voyager', 'graphiql', 'viewer'):
|
|
30
|
-
webbrowser.open(f'http://localhost:{port}/{app_name}')
|
|
31
|
-
|
|
32
|
-
open_url()
|
|
33
|
-
yield
|
|
34
|
-
|
|
35
|
-
graphql_app: GraphQL = GraphQL(graphql_schema)
|
|
36
|
-
app = Starlette(
|
|
37
|
-
lifespan=lifespan,
|
|
38
|
-
routes=routes()
|
|
39
|
-
)
|
|
40
|
-
app.add_route("/graphql", graphql_app)
|
|
41
|
-
app.add_websocket_route("/graphql", graphql_app)
|
|
42
|
-
|
|
43
|
-
from starlette_prometheus import PrometheusMiddleware, metrics
|
|
44
|
-
app.add_middleware(PrometheusMiddleware)
|
|
45
|
-
app.add_route("/metrics", metrics)
|
|
46
|
-
|
|
47
|
-
import uvicorn
|
|
48
|
-
uvicorn.run(app, host='0.0.0.0', port=port)
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{graphinate-0.2.11 → graphinate-0.2.13}/src/graphinate/server/web/static/images/network_graph.png
RENAMED
|
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
|