Graphinate 0.12.0__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.
- graphinate/__init__.py +18 -0
- graphinate/__main__.py +4 -0
- graphinate/builders/__init__.py +55 -0
- graphinate/builders/_builder.py +58 -0
- graphinate/builders/_d3.py +61 -0
- graphinate/builders/_graphql.py +521 -0
- graphinate/builders/_mermaid.py +45 -0
- graphinate/builders/_networkx.py +227 -0
- graphinate/cli.py +123 -0
- graphinate/color.py +100 -0
- graphinate/constants.py +4 -0
- graphinate/converters.py +94 -0
- graphinate/enums.py +44 -0
- graphinate/modeling.py +337 -0
- graphinate/renderers/__init__.py +5 -0
- graphinate/renderers/graphql.py +111 -0
- graphinate/renderers/matplotlib.py +82 -0
- graphinate/server/__init__.py +0 -0
- graphinate/server/starlette/__init__.py +31 -0
- graphinate/server/starlette/views.py +17 -0
- graphinate/server/web/__init__.py +25 -0
- graphinate/server/web/elements/index.html +23 -0
- graphinate/server/web/graphiql/index.html +160 -0
- graphinate/server/web/rapidoc/index.html +17 -0
- graphinate/server/web/static/images/logo-128.png +0 -0
- graphinate/server/web/static/images/logo.svg +50 -0
- graphinate/server/web/static/images/network_graph.png +0 -0
- graphinate/server/web/viewer/index.html +719 -0
- graphinate/server/web/voyager/index.html +55 -0
- graphinate/tools.py +7 -0
- graphinate/typing.py +83 -0
- graphinate-0.12.0.dist-info/METADATA +284 -0
- graphinate-0.12.0.dist-info/RECORD +36 -0
- graphinate-0.12.0.dist-info/WHEEL +4 -0
- graphinate-0.12.0.dist-info/entry_points.txt +2 -0
- graphinate-0.12.0.dist-info/licenses/LICENSE +165 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<title>Graphinate - GraphQL Voyager</title>
|
|
5
|
+
<style>
|
|
6
|
+
body {
|
|
7
|
+
height: 100%;
|
|
8
|
+
margin: 0;
|
|
9
|
+
width: 100%;
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
}
|
|
12
|
+
#voyager {
|
|
13
|
+
height: 100vh;
|
|
14
|
+
}
|
|
15
|
+
</style>
|
|
16
|
+
|
|
17
|
+
<!--
|
|
18
|
+
These two files are served from jsdelivr CDN, however you may wish to
|
|
19
|
+
copy them directly into your environment, or perhaps include them in your
|
|
20
|
+
favored resource bundler.
|
|
21
|
+
-->
|
|
22
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/graphql-voyager@2.1.0/dist/voyager.min.css"
|
|
23
|
+
integrity="sha384-vmH7DGotMxRpiyCozw3vBUhhRegQ+95ffgla9zXAPkysqRrrTbnP6tXtCaaZ0xOh"
|
|
24
|
+
crossorigin="anonymous"/>
|
|
25
|
+
<script src="https://cdn.jsdelivr.net/npm/graphql-voyager@2.1.0/dist/voyager.standalone.min.js"
|
|
26
|
+
integrity="sha384-mk0ZutpNRnjwlDdrlmHl3kTRcjBmge8wx4x0GE26f1xPsXpkxKvR2MV11i+yYlyF"
|
|
27
|
+
crossorigin="anonymous"
|
|
28
|
+
|
|
29
|
+
></script>
|
|
30
|
+
</head>
|
|
31
|
+
<body>
|
|
32
|
+
<div id="voyager">Loading...</div>
|
|
33
|
+
<script type="module">
|
|
34
|
+
const { init, voyagerIntrospectionQuery: query } = GraphQLVoyager;
|
|
35
|
+
const response = await fetch(
|
|
36
|
+
'/graphql',
|
|
37
|
+
{
|
|
38
|
+
method: 'post',
|
|
39
|
+
headers: {
|
|
40
|
+
Accept: 'application/json',
|
|
41
|
+
'Content-Type': 'application/json',
|
|
42
|
+
},
|
|
43
|
+
body: JSON.stringify({ query }),
|
|
44
|
+
credentials: 'omit',
|
|
45
|
+
},
|
|
46
|
+
);
|
|
47
|
+
const introspection = await response.json();
|
|
48
|
+
|
|
49
|
+
// Render <Voyager /> into the body.
|
|
50
|
+
GraphQLVoyager.renderVoyager(document.getElementById('voyager'), {
|
|
51
|
+
introspection,
|
|
52
|
+
});
|
|
53
|
+
</script>
|
|
54
|
+
</body>
|
|
55
|
+
</html>
|
graphinate/tools.py
ADDED
graphinate/typing.py
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Typing Module
|
|
3
|
+
|
|
4
|
+
Attributes:
|
|
5
|
+
Node (Node): Node Type
|
|
6
|
+
Edge (Edge): Edge Type
|
|
7
|
+
Element (Element): Element Type
|
|
8
|
+
Extractor (Extractor): Source of data for an Element
|
|
9
|
+
UniverseNode (UniverseNode): The Universe Node Type. All Node Types are the implicit children of UniverseNodeType.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from collections.abc import Callable, Iterable
|
|
13
|
+
from typing import Any, NamedTuple, NewType, Protocol, TypeAlias, TypeVar, Union
|
|
14
|
+
|
|
15
|
+
import networkx as nx
|
|
16
|
+
import networkx_mermaid as nxm
|
|
17
|
+
import strawberry
|
|
18
|
+
|
|
19
|
+
NodeTuple: TypeAlias = tuple[str, Any]
|
|
20
|
+
EdgeTuple: TypeAlias = tuple[str, str, Any]
|
|
21
|
+
|
|
22
|
+
IdentifierStr = NewType('IdentifierStr', str)
|
|
23
|
+
IdentifierStr.__doc__ = 'A string that is a valid Python identifier (i.e., `isidentifier()` is True).'
|
|
24
|
+
|
|
25
|
+
NodeTypeAbsoluteId = NewType('NodeTypeAbsoluteId', tuple[str, str])
|
|
26
|
+
NodeTypeAbsoluteId.__doc__ = 'A unique identifier for a node type.'
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class UniverseNode:
|
|
30
|
+
"""The UniverseNode Type. All Node Types are the implicit children of the Universe Node Type."""
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# A node in a graph.
|
|
34
|
+
Node = Union[type[NamedTuple], NodeTuple] # noqa: UP007
|
|
35
|
+
|
|
36
|
+
# An edge in a graph.
|
|
37
|
+
Edge = Union[type[NamedTuple], EdgeTuple] # noqa: UP007
|
|
38
|
+
|
|
39
|
+
# An element in a graph.
|
|
40
|
+
Element = Union[Node, Edge] # noqa: UP007
|
|
41
|
+
|
|
42
|
+
# A source of data for an element.
|
|
43
|
+
Extractor = Union[str, Callable[[Any], str]] # noqa: UP007
|
|
44
|
+
|
|
45
|
+
T = TypeVar('T')
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class Items(Protocol):
|
|
49
|
+
"""Protocol for callable objects that return an iterable of items."""
|
|
50
|
+
|
|
51
|
+
def __call__(self, **kwargs: Any) -> Iterable[T]: # pragma: no cover
|
|
52
|
+
...
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class Nodes(Protocol):
|
|
56
|
+
"""Protocol for callable objects that return an iterable of nodes."""
|
|
57
|
+
|
|
58
|
+
def __call__(self, **kwargs: Any) -> Iterable[Node]: # pragma: no cover
|
|
59
|
+
...
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class Edges(Protocol):
|
|
63
|
+
"""Protocol for callable objects that return an iterable of edges."""
|
|
64
|
+
|
|
65
|
+
def __call__(self, **kwargs: Any) -> Iterable[Edge]: # pragma: no cover
|
|
66
|
+
...
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class Predicate(Protocol):
|
|
70
|
+
"""Protocol for callable objects that evaluate a condition."""
|
|
71
|
+
|
|
72
|
+
def __call__(self, **kwargs: Any) -> bool: # pragma: no cover
|
|
73
|
+
...
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class Supplier(Protocol):
|
|
77
|
+
"""Protocol for callable objects that supply a value."""
|
|
78
|
+
|
|
79
|
+
def __call__(self) -> Any: # pragma: no cover
|
|
80
|
+
...
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
GraphRepresentation = Union[dict, nx.Graph, strawberry.Schema, nxm.typing.MermaidDiagram, str] # noqa: UP007
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: Graphinate
|
|
3
|
+
Version: 0.12.0
|
|
4
|
+
Summary: Graphinate. Data to Graphs.
|
|
5
|
+
Project-URL: Homepage, https://erivlis.github.io/graphinate
|
|
6
|
+
Project-URL: Documentation, https://erivlis.github.io/graphinate
|
|
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 :: 4 - Beta
|
|
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.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
26
|
+
Classifier: Topic :: Scientific/Engineering
|
|
27
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
28
|
+
Classifier: Typing :: Typed
|
|
29
|
+
Requires-Python: <3.14,>=3.10
|
|
30
|
+
Requires-Dist: click
|
|
31
|
+
Requires-Dist: inflect
|
|
32
|
+
Requires-Dist: loguru
|
|
33
|
+
Requires-Dist: mappingtools
|
|
34
|
+
Requires-Dist: matplotlib
|
|
35
|
+
Requires-Dist: networkx
|
|
36
|
+
Requires-Dist: networkx-mermaid
|
|
37
|
+
Requires-Dist: networkx-query
|
|
38
|
+
Requires-Dist: numpy
|
|
39
|
+
Requires-Dist: strawberry-graphql[asgi,opentelemetry]
|
|
40
|
+
Provides-Extra: plot
|
|
41
|
+
Requires-Dist: scipy; extra == 'plot'
|
|
42
|
+
Provides-Extra: server
|
|
43
|
+
Requires-Dist: starlette-prometheus; extra == 'server'
|
|
44
|
+
Requires-Dist: uvicorn[standard]; extra == 'server'
|
|
45
|
+
Description-Content-Type: text/markdown
|
|
46
|
+
|
|
47
|
+
# [Graphinate. Data to Graphs.](https://erivlis.github.io/graphinate/)
|
|
48
|
+
|
|
49
|
+
<img height="360" src="https://github.com/erivlis/graphinate/assets/9897520/dae41f9f-69e5-4eb5-a488-87ce7f51fa32" alt="Graphinate. Data to Graphs.">
|
|
50
|
+
|
|
51
|
+
<table>
|
|
52
|
+
<tr style="vertical-align: middle;">
|
|
53
|
+
<td>Package</td>
|
|
54
|
+
<td>
|
|
55
|
+
<img alt="PyPI - version" src="https://img.shields.io/pypi/v/graphinate.svg?logo=pypi&logoColor=lightblue">
|
|
56
|
+
<img alt="PyPI - Status" src="https://img.shields.io/pypi/status/graphinate.svg?logo=pypi&logoColor=lightblue">
|
|
57
|
+
<img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/graphinate.svg?logo=python&label=Python&logoColor=lightblue">
|
|
58
|
+
<img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dd/graphinate.svg?logo=pypi&logoColor=lightblue">
|
|
59
|
+
<img alt="PyPI - Dependents" src="https://dependents.info/erivlis/graphinate/badge?logo=pypi&logoColor=lightblue">
|
|
60
|
+
<img alt="Libraries.io SourceRank" src="https://img.shields.io/librariesio/sourcerank/pypi/Graphinate.svg?logo=Libraries.io&label=SourceRank">
|
|
61
|
+
</td>
|
|
62
|
+
</tr>
|
|
63
|
+
<tr style="vertical-align: middle;">
|
|
64
|
+
<td>Code</td>
|
|
65
|
+
<td>
|
|
66
|
+
<img alt="GitHub" src="https://img.shields.io/github/license/erivlis/graphinate">
|
|
67
|
+
<img alt="GitHub repo size" src="https://img.shields.io/github/repo-size/erivlis/graphinate.svg?label=Size&logo=git">
|
|
68
|
+
<img alt="GitHub last commit (by committer)" src="https://img.shields.io/github/last-commit/erivlis/graphinate.svg?&logo=git">
|
|
69
|
+
<a href="https://github.com/erivlis/graphinate/graphs/contributors"><img alt="Contributors" src="https://img.shields.io/github/contributors/erivlis/graphinate.svg?&logo=git"></a>
|
|
70
|
+
</td>
|
|
71
|
+
</tr>
|
|
72
|
+
<tr style="vertical-align: middle;">
|
|
73
|
+
<td>Tools</td>
|
|
74
|
+
<td>
|
|
75
|
+
<a href="https://www.jetbrains.com/pycharm/"><img alt="PyCharm" src="https://img.shields.io/badge/PyCharm-FCF84A.svg?logo=PyCharm&logoColor=black&labelColor=21D789&color=FCF84A"></a>
|
|
76
|
+
<a href="https://github.com/astral-sh/uv"><img alt="uv" src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json" style="max-width:100%;"></a>
|
|
77
|
+
<a href="https://github.com/astral-sh/ruff"><img alt="ruff" src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" style="max-width:100%;"></a>
|
|
78
|
+
<a href="https://squidfunk.github.io/mkdocs-material/"><img alt="mkdocs-material" src="https://img.shields.io/badge/Material_for_MkDocs-526CFE?&logo=MaterialForMkDocs&logoColor=white&labelColor=grey"></a>
|
|
79
|
+
<a href="https://github.com/hukkin/mdformat"><img alt="mdformat" src="https://img.shields.io/badge/mdformat-526CFE?&logo=markdown&logoColor=white&labelColor=grey"></a>
|
|
80
|
+
<a href="https://hatch.pypa.io"><img alt="Hatch project" class="off-glb" loading="lazy" src="https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg"></a>
|
|
81
|
+
<a href="https://commitizen-tools.github.io/commitizen"><img alt="commitizen" src="https://custom-icon-badges.demolab.com/badge/commitizen-7e56c2?logo=commitizen&labelColor=grey"></a>
|
|
82
|
+
</td>
|
|
83
|
+
</tr>
|
|
84
|
+
<tr style="vertical-align: middle;">
|
|
85
|
+
<td>CI/CD</td>
|
|
86
|
+
<td>
|
|
87
|
+
<a href="https://github.com/erivlis/graphinate/actions/workflows/test.yml"><img alt="Test" src="https://github.com/erivlis/graphinate/actions/workflows/test.yml/badge.svg"></a>
|
|
88
|
+
<a href="https://github.com/erivlis/graphinate/actions/workflows/test-beta.yml"><img alt="Test (Beta)" src="https://github.com/erivlis/graphinate/actions/workflows/test-beta.yml/badge.svg"></a>
|
|
89
|
+
<a href="https://github.com/erivlis/graphinate/actions/workflows/publish.yml"><img alt="Publish" src="https://github.com/erivlis/graphinate/actions/workflows/publish.yml/badge.svg"></a>
|
|
90
|
+
<a href="https://github.com/erivlis/graphinate/actions/workflows/publish-docs.yaml"><img alt="Publish Docs" src="https://github.com/erivlis/graphinate/actions/workflows/publish-docs.yaml/badge.svg"></a>
|
|
91
|
+
</td>
|
|
92
|
+
</tr>
|
|
93
|
+
<tr style="vertical-align: middle;">
|
|
94
|
+
<td>Scans</td>
|
|
95
|
+
<td>
|
|
96
|
+
<a href="https://codecov.io/gh/erivlis/graphinate"><img alt="Coverage" src="https://codecov.io/gh/erivlis/graphinate/graph/badge.svg?token=POODT8M9NV"/></a>
|
|
97
|
+
<a href="https://sonarcloud.io/summary/new_code?id=erivlis_graphinate"><img alt="Quality Gate Status" src="https://sonarcloud.io/api/project_badges/measure?project=erivlis_graphinate&metric=alert_status"></a>
|
|
98
|
+
<a href="https://sonarcloud.io/summary/new_code?id=erivlis_graphinate"><img alt="Security Rating" src="https://sonarcloud.io/api/project_badges/measure?project=erivlis_graphinate&metric=security_rating"></a>
|
|
99
|
+
<a href="https://sonarcloud.io/summary/new_code?id=erivlis_graphinate"><img alt="Maintainability Rating" src="https://sonarcloud.io/api/project_badges/measure?project=erivlis_graphinate&metric=sqale_rating"></a>
|
|
100
|
+
<a href="https://sonarcloud.io/summary/new_code?id=erivlis_graphinate"><img alt="Reliability Rating" src="https://sonarcloud.io/api/project_badges/measure?project=erivlis_graphinate&metric=reliability_rating"></a>
|
|
101
|
+
<a href="https://sonarcloud.io/summary/new_code?id=erivlis_graphinate"><img alt="Lines of Code" src="https://sonarcloud.io/api/project_badges/measure?project=erivlis_graphinate&metric=ncloc"></a>
|
|
102
|
+
<a href="https://sonarcloud.io/summary/new_code?id=erivlis_graphinate"><img alt="Vulnerabilities" src="https://sonarcloud.io/api/project_badges/measure?project=erivlis_graphinate&metric=vulnerabilities"></a>
|
|
103
|
+
<a href="https://sonarcloud.io/summary/new_code?id=erivlis_graphinate"><img alt="Bugs" src="https://sonarcloud.io/api/project_badges/measure?project=erivlis_graphinate&metric=bugs"></a>
|
|
104
|
+
<a href="https://app.codacy.com/gh/erivlis/graphinate/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade"><img alt="Codacy Badge" src="https://app.codacy.com/project/badge/Grade/54b33c3f7313448f9471d01e2a06f037"></a>
|
|
105
|
+
<a href="https://app.codacy.com/gh/erivlis/graphinate/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage"><img alt="Codacy Coverage" src="https://app.codacy.com/project/badge/Coverage/54b33c3f7313448f9471d01e2a06f037"/></a>
|
|
106
|
+
<a href="https://www.codefactor.io/repository/github/erivlis/graphinate"><img src="https://www.codefactor.io/repository/github/erivlis/graphinate/badge" alt="CodeFactor" /></a>
|
|
107
|
+
<a href="https://app.deepsource.com/gh/erivlis/graphinate/" target="_blank"><img alt="DeepSource" title="DeepSource" src="https://app.deepsource.com/gh/erivlis/graphinate.svg/?label=active+issues&show_trend=true&token=5n11jDEmcZB-6eyGR34rQaxF"/></a>
|
|
108
|
+
<a href="https://app.deepsource.com/gh/erivlis/graphinate/" target="_blank"><img alt="DeepSource" title="DeepSource" src="https://app.deepsource.com/gh/erivlis/graphinate.svg/?label=resolved+issues&show_trend=true&token=5n11jDEmcZB-6eyGR34rQaxF"/></a>
|
|
109
|
+
<a href="https://snyk.io/test/github/erivlis/graphinate"><img alt="Snyk" src="https://snyk.io/test/github/erivlis/Graphinate/badge.svg"></a>
|
|
110
|
+
</td>
|
|
111
|
+
</tr>
|
|
112
|
+
<tr>
|
|
113
|
+
<td>Mentions</td>
|
|
114
|
+
<td>
|
|
115
|
+
<a href="https://www.youtube.com/live/k01G0b0Y0Jg?si=030OT8sK3BqPyy8r&t=1028"><img alt="PythonBytes Podcast" src="https://img.shields.io/badge/Python_Bytes-Ep. 361-D7F9FF?logo=applepodcasts&labelColor=blue"></a>
|
|
116
|
+
<a href="https://pythonhub.dev/digest/2024-03-10/"><img alt="Static Badge" src="https://img.shields.io/badge/PythonHub-2024.03.10-gold?labelColor=blue"></a>
|
|
117
|
+
</td>
|
|
118
|
+
</tr>
|
|
119
|
+
<tr>
|
|
120
|
+
<td>Badge</td>
|
|
121
|
+
<td>
|
|
122
|
+
<a href="https://img.shields.io/badge/%F0%9D%94%BE%3D%7B%F0%9D%95%8D%2C%F0%9D%94%BC%7D-Graphinate-darkviolet"><img alt="Graphinate" src="https://img.shields.io/badge/%F0%9D%94%BE%3D%7B%F0%9D%95%8D%2C%F0%9D%94%BC%7D-Graphinate-darkviolet"></a>
|
|
123
|
+
</td>
|
|
124
|
+
</tr>
|
|
125
|
+
</table>
|
|
126
|
+
|
|
127
|
+
## Table of Contents
|
|
128
|
+
|
|
129
|
+
- [Introduction](#introduction)
|
|
130
|
+
- [What is Graphinate?](#what-is-graphinate)
|
|
131
|
+
- [Links](#links)
|
|
132
|
+
- [Quick Start](#quick-start)
|
|
133
|
+
- [Install](#install)
|
|
134
|
+
- [Example](#example)
|
|
135
|
+
- [CLI](#cli)
|
|
136
|
+
- [Gallery](#gallery)
|
|
137
|
+
- [Development](#development)
|
|
138
|
+
- [Acknowledgements](#acknowledgements)
|
|
139
|
+
|
|
140
|
+
## Introduction
|
|
141
|
+
|
|
142
|
+
### What is Graphinate?
|
|
143
|
+
|
|
144
|
+
**Graphinate** is a python library that can be used to generate Graph Data Structures from Data Sources.
|
|
145
|
+
|
|
146
|
+
It can help create an efficient retrieval pipeline from a given data source, while also enabling the developer to map
|
|
147
|
+
data payloads and hierarchies to a Graph.
|
|
148
|
+
|
|
149
|
+
In addition, there are several modes of output to enable examination of the Graph and its content.
|
|
150
|
+
|
|
151
|
+
**Graphinate** uses and builds upon the excellent [**_NetworkX_**](https://networkx.org/).
|
|
152
|
+
|
|
153
|
+
### Links
|
|
154
|
+
|
|
155
|
+
- Website (including documentation): <https://erivlis.github.io/graphinate>
|
|
156
|
+
- Source: <https://github.com/erivlis/graphinate>
|
|
157
|
+
- Package: <https://pypi.org/project/graphinate>
|
|
158
|
+
|
|
159
|
+
## Quick Start
|
|
160
|
+
|
|
161
|
+
### Install
|
|
162
|
+
|
|
163
|
+
**Graphinate** is available on PyPI:
|
|
164
|
+
|
|
165
|
+
```shell
|
|
166
|
+
pip install graphinate
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
or
|
|
170
|
+
|
|
171
|
+
```shell
|
|
172
|
+
uv add graphinate
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
To install with server support
|
|
176
|
+
|
|
177
|
+
```shell
|
|
178
|
+
pip install graphinate[server]
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
or
|
|
182
|
+
|
|
183
|
+
```shell
|
|
184
|
+
uv add graphinate[server]
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
**Graphinate** officially supports Python >= 3.10.
|
|
188
|
+
|
|
189
|
+
### Example
|
|
190
|
+
|
|
191
|
+
```python title="Octagonal Graph"
|
|
192
|
+
import graphinate
|
|
193
|
+
|
|
194
|
+
N: int = 8
|
|
195
|
+
|
|
196
|
+
# First Define a GraphModel instance.
|
|
197
|
+
# It will be used to hold the graph definitions
|
|
198
|
+
graph_model: graphinate.GraphModel = graphinate.model(name="Octagonal Graph")
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
# Register in the Graph Model the edges' supplier generator function
|
|
202
|
+
@graph_model.edge()
|
|
203
|
+
def edge():
|
|
204
|
+
for i in range(N):
|
|
205
|
+
yield {'source': i, 'target': i + 1}
|
|
206
|
+
yield {'source': N, 'target': 0}
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
# Use the NetworkX Builder
|
|
210
|
+
builder = graphinate.builders.NetworkxBuilder(graph_model)
|
|
211
|
+
|
|
212
|
+
# build the NetworkX GraphRepresentation
|
|
213
|
+
# the output in this case is a nx.Graph instance
|
|
214
|
+
graph = builder.build()
|
|
215
|
+
|
|
216
|
+
# this supplied plot method uses matplotlib to display the graph
|
|
217
|
+
graphinate.matplotlib.plot(graph, with_edge_labels=True)
|
|
218
|
+
|
|
219
|
+
# or use the Mermaid Builder
|
|
220
|
+
builder = graphinate.builders.MermaidBuilder(graph_model)
|
|
221
|
+
|
|
222
|
+
# to create a Mermaid diagram
|
|
223
|
+
diagram: str = builder.build()
|
|
224
|
+
|
|
225
|
+
# and get Markdown or single page HTML to display it
|
|
226
|
+
mermaid_markdown: str = graphinate.mermaid.markdown(diagram)
|
|
227
|
+
mermaid_html: str = graphinate.mermaid.html(diagram, title=graph_model.name)
|
|
228
|
+
|
|
229
|
+
# or use the GraphQL Builder
|
|
230
|
+
builder = graphinate.builders.GraphQLBuilder(graph_model)
|
|
231
|
+
|
|
232
|
+
# to create a Strawberry GraphQL schema
|
|
233
|
+
schema = builder.build()
|
|
234
|
+
|
|
235
|
+
# and serve it using Uvicorn web server
|
|
236
|
+
graphinate.graphql.server(schema)
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## CLI
|
|
240
|
+
|
|
241
|
+
For detailed information on the command-line interface, please see
|
|
242
|
+
the [CLI Usage Guide](https://erivlis.github.io/graphinate/usage/cli/) in the official documentation.
|
|
243
|
+
|
|
244
|
+
## Gallery
|
|
245
|
+
|
|
246
|
+
### Python Class AST
|
|
247
|
+
|
|
248
|
+
#### matplotlib
|
|
249
|
+
|
|
250
|
+

|
|
251
|
+
|
|
252
|
+
#### 3D Force-Directed Animation
|
|
253
|
+
|
|
254
|
+
<video width="400" controls>
|
|
255
|
+
<source src="https://github.com/erivlis/graphinate/assets/9897520/2e9a53b1-5686-4683-a0e4-fbffa850a27b" type="video/mp4">
|
|
256
|
+
</video>
|
|
257
|
+
|
|
258
|
+
### GitHub Repository
|
|
259
|
+
|
|
260
|
+

|
|
261
|
+
|
|
262
|
+
### Web Links
|
|
263
|
+
|
|
264
|
+

|
|
265
|
+
|
|
266
|
+
## Development
|
|
267
|
+
|
|
268
|
+
For instructions on how to set up your development environment, run tests, and contribute to the project, please see
|
|
269
|
+
the [Development Guide](https://erivlis.github.io/graphinate/development/) in the official documentation.
|
|
270
|
+
|
|
271
|
+
## Acknowledgements
|
|
272
|
+
|
|
273
|
+
For a list of the dependencies and tools that make Graphinate possible, please see
|
|
274
|
+
the [Acknowledgements](https://erivlis.github.io/graphinate/acknowledgements/) page in the official documentation.
|
|
275
|
+
|
|
276
|
+
______________________________________________________________________
|
|
277
|
+
|
|
278
|
+

|
|
279
|
+
|
|
280
|
+
______________________________________________________________________
|
|
281
|
+
|
|
282
|
+
<img alt="Work on my Machine" src="https://forthebadge.com/images/badges/works-on-my-machine.svg">
|
|
283
|
+
|
|
284
|
+
Copyright © 2023-2025 Eran Rivlis
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
graphinate/__init__.py,sha256=To1M8Ln-YDYFNGuWLImqRqZD_W5wKgRJOxvppeF8_As,373
|
|
2
|
+
graphinate/__main__.py,sha256=RQmNNODuh6MXstyEQhSx9kunpacQRRj3Som67wTEruM,99
|
|
3
|
+
graphinate/cli.py,sha256=_BO4JN48vwmxizqZmO5sRp5EnS8JmUnB8wxSYct0aPo,5429
|
|
4
|
+
graphinate/color.py,sha256=JP91jrQJuY3mQjXz4DJBR2QO5vgZQDbcQLzVTNBUq-0,3453
|
|
5
|
+
graphinate/constants.py,sha256=utp-SMdFdp2F0m4lPBEjsqKZIIAdxfo8w-755eY1L6o,130
|
|
6
|
+
graphinate/converters.py,sha256=8foNxvJNoq60r728b9eTKP9uE5EEuXcK14qLSec17aI,2631
|
|
7
|
+
graphinate/enums.py,sha256=8333QbAvNhGVKjEI3He3ciyLH1wE8vjtShHw5odopIU,1557
|
|
8
|
+
graphinate/modeling.py,sha256=YrdCowkF0T1gZFj_OGJ8xa2_4kl2RhdPvym0HnZFYNg,10933
|
|
9
|
+
graphinate/tools.py,sha256=sOq0ACFFycxbDJ__OgrSqvARMqvDPGjPALcOjUyWkoc,120
|
|
10
|
+
graphinate/typing.py,sha256=ckK_YnvXZ7tIAFWFAAxujqGPP1iSW0PaM4l-xVTQJwY,2334
|
|
11
|
+
graphinate/builders/__init__.py,sha256=vab8Hce1ZkOAOgG4315UsNa91BS_7D_sx9EI1MRvymE,2095
|
|
12
|
+
graphinate/builders/_builder.py,sha256=sPQC_SlyVB0xD7bD9LDKoivwU6_V9NZY3k6wamed1mw,1864
|
|
13
|
+
graphinate/builders/_d3.py,sha256=3XP-ufark3_effOKeK3DZObS9kEJorGDZwsp-1jxeZg,1889
|
|
14
|
+
graphinate/builders/_graphql.py,sha256=IBCo6jtSSMKsAzxRNV62O46V2IPGB2FOoP32ZMb3mhY,19385
|
|
15
|
+
graphinate/builders/_mermaid.py,sha256=mFkVwyrcztHd8oYWdrLzmEW4yBU1YvXKFdqmKjHrGgU,1700
|
|
16
|
+
graphinate/builders/_networkx.py,sha256=_Vi78VSWCGwoE5LDKxqWx2DMuFdJABjvkLe2EPNpmEw,10217
|
|
17
|
+
graphinate/renderers/__init__.py,sha256=PcGGlfs2fYNoSqOgmZbjCiZzdFoN92RVn-M7BzFFuKE,129
|
|
18
|
+
graphinate/renderers/graphql.py,sha256=nXhKoqxu5qU3QPd5blquh_wWYnhCj1PEEGRs_bcDcmM,3416
|
|
19
|
+
graphinate/renderers/matplotlib.py,sha256=1EZbxJCfLUe_7sKKu4XSSbNNd8D0S7syE1LttsecVIE,2573
|
|
20
|
+
graphinate/server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
21
|
+
graphinate/server/starlette/__init__.py,sha256=izm55DcTE56VBRioXI6AGbr3qn4rKWCdaJFzhqiSU_c,865
|
|
22
|
+
graphinate/server/starlette/views.py,sha256=iV806Zz8EreU7SK0wachABU2PjrW5kJRXgGFDsXniWU,449
|
|
23
|
+
graphinate/server/web/__init__.py,sha256=83KwuvzmA8GAk_gih9oNXJy_ve0W6g_nIsXZFDvxtrY,760
|
|
24
|
+
graphinate/server/web/elements/index.html,sha256=8nEUS8zXvD5lZWP6T9YKLeoyVYG6wQBxA48P6-qN6Ew,764
|
|
25
|
+
graphinate/server/web/graphiql/index.html,sha256=FN1pWOKeOOsIpL2PZZ7xEWa-YLB-i7PlDtmpysgAOh4,4465
|
|
26
|
+
graphinate/server/web/rapidoc/index.html,sha256=dq1YRUTQbbUetMDdbEYDDA87PGdXpiPNM4Aq8oh-7Y4,559
|
|
27
|
+
graphinate/server/web/static/images/logo-128.png,sha256=k6ZEXNydkZvhiSZfJT2G-nJzzeybgW_n3GxJ3bmUrlo,37556
|
|
28
|
+
graphinate/server/web/static/images/logo.svg,sha256=dVE5EJFe-xlw8C56lltwgpBPrSmEYNx5yt5G577_d8A,1627
|
|
29
|
+
graphinate/server/web/static/images/network_graph.png,sha256=gYNiaMGKQ8IzVxGwQlQpfnksMoVKQ2tFhKL33IHaLd0,32663
|
|
30
|
+
graphinate/server/web/viewer/index.html,sha256=ZtkGfEAHIrkGEa0St-bN5QkJTmNlFJvQ8kbikqKDlk8,28747
|
|
31
|
+
graphinate/server/web/voyager/index.html,sha256=k0dQmEvtj9ly0yHoBdTwEZc-eeVO1bzh-8VNnTCWQNs,1623
|
|
32
|
+
graphinate-0.12.0.dist-info/METADATA,sha256=dFpLbrZrsefo-ROELq0RCGoK1xjXbT6cdHNNdPCL5SA,14007
|
|
33
|
+
graphinate-0.12.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
34
|
+
graphinate-0.12.0.dist-info/entry_points.txt,sha256=dLSCVvpLQyRocLe6CYbcZ_Mf1aA3Pl3Od27gmi5k_eo,50
|
|
35
|
+
graphinate-0.12.0.dist-info/licenses/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
|
|
36
|
+
graphinate-0.12.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 29 June 2007
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
6
|
+
of this license document, but changing it is not allowed.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
|
11
|
+
License, supplemented by the additional permissions listed below.
|
|
12
|
+
|
|
13
|
+
0. Additional Definitions.
|
|
14
|
+
|
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
|
17
|
+
General Public License.
|
|
18
|
+
|
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
|
20
|
+
other than an Application or a Combined Work as defined below.
|
|
21
|
+
|
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
|
25
|
+
of using an interface provided by the Library.
|
|
26
|
+
|
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
|
28
|
+
Application with the Library. The particular version of the Library
|
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
|
30
|
+
Version".
|
|
31
|
+
|
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
|
35
|
+
based on the Application, and not on the Linked Version.
|
|
36
|
+
|
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
|
38
|
+
object code and/or source code for the Application, including any data
|
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
|
41
|
+
|
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
|
43
|
+
|
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
|
46
|
+
|
|
47
|
+
2. Conveying Modified Versions.
|
|
48
|
+
|
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
|
51
|
+
that uses the facility (other than as an argument passed when the
|
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
|
53
|
+
version:
|
|
54
|
+
|
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
|
56
|
+
ensure that, in the event an Application does not supply the
|
|
57
|
+
function or data, the facility still operates, and performs
|
|
58
|
+
whatever part of its purpose remains meaningful, or
|
|
59
|
+
|
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
|
61
|
+
this License applicable to that copy.
|
|
62
|
+
|
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
|
64
|
+
|
|
65
|
+
The object code form of an Application may incorporate material from
|
|
66
|
+
a header file that is part of the Library. You may convey such object
|
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
|
68
|
+
material is not limited to numerical parameters, data structure
|
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
|
71
|
+
|
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
|
73
|
+
Library is used in it and that the Library and its use are
|
|
74
|
+
covered by this License.
|
|
75
|
+
|
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
|
77
|
+
document.
|
|
78
|
+
|
|
79
|
+
4. Combined Works.
|
|
80
|
+
|
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
|
82
|
+
taken together, effectively do not restrict modification of the
|
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
|
85
|
+
the following:
|
|
86
|
+
|
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
|
88
|
+
the Library is used in it and that the Library and its use are
|
|
89
|
+
covered by this License.
|
|
90
|
+
|
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
|
92
|
+
document.
|
|
93
|
+
|
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
|
95
|
+
execution, include the copyright notice for the Library among
|
|
96
|
+
these notices, as well as a reference directing the user to the
|
|
97
|
+
copies of the GNU GPL and this license document.
|
|
98
|
+
|
|
99
|
+
d) Do one of the following:
|
|
100
|
+
|
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
|
102
|
+
License, and the Corresponding Application Code in a form
|
|
103
|
+
suitable for, and under terms that permit, the user to
|
|
104
|
+
recombine or relink the Application with a modified version of
|
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
|
107
|
+
Corresponding Source.
|
|
108
|
+
|
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
|
111
|
+
a copy of the Library already present on the user's computer
|
|
112
|
+
system, and (b) will operate properly with a modified version
|
|
113
|
+
of the Library that is interface-compatible with the Linked
|
|
114
|
+
Version.
|
|
115
|
+
|
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
|
117
|
+
be required to provide such information under section 6 of the
|
|
118
|
+
GNU GPL, and only to the extent that such information is
|
|
119
|
+
necessary to install and execute a modified version of the
|
|
120
|
+
Combined Work produced by recombining or relinking the
|
|
121
|
+
Application with a modified version of the Linked Version. (If
|
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
|
126
|
+
for conveying Corresponding Source.)
|
|
127
|
+
|
|
128
|
+
5. Combined Libraries.
|
|
129
|
+
|
|
130
|
+
You may place library facilities that are a work based on the
|
|
131
|
+
Library side by side in a single library together with other library
|
|
132
|
+
facilities that are not Applications and are not covered by this
|
|
133
|
+
License, and convey such a combined library under terms of your
|
|
134
|
+
choice, if you do both of the following:
|
|
135
|
+
|
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
|
137
|
+
on the Library, uncombined with any other library facilities,
|
|
138
|
+
conveyed under the terms of this License.
|
|
139
|
+
|
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
|
141
|
+
is a work based on the Library, and explaining where to find the
|
|
142
|
+
accompanying uncombined form of the same work.
|
|
143
|
+
|
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
|
145
|
+
|
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
|
148
|
+
versions will be similar in spirit to the present version, but may
|
|
149
|
+
differ in detail to address new problems or concerns.
|
|
150
|
+
|
|
151
|
+
Each version is given a distinguishing version number. If the
|
|
152
|
+
Library as you received it specifies that a certain numbered version
|
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
|
154
|
+
applies to it, you have the option of following the terms and
|
|
155
|
+
conditions either of that published version or of any later version
|
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
|
160
|
+
|
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
|
164
|
+
permanent authorization for you to choose that version for the
|
|
165
|
+
Library.
|