Graphinate 0.2.13__tar.gz → 0.2.15__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 (94) hide show
  1. {graphinate-0.2.13 → graphinate-0.2.15}/PKG-INFO +4 -1
  2. {graphinate-0.2.13 → graphinate-0.2.15}/pyproject.toml +5 -1
  3. {graphinate-0.2.13 → graphinate-0.2.15}/src/graphinate/builders.py +5 -4
  4. {graphinate-0.2.13 → graphinate-0.2.15}/src/graphinate/server/__init__.py +5 -3
  5. graphinate-0.2.15/src/graphinate/server/web/elements/index.html +22 -0
  6. graphinate-0.2.15/src/graphinate/server/web/rapidoc/index.html +15 -0
  7. graphinate-0.2.15/src/graphinate/tools/converters.py +28 -0
  8. {graphinate-0.2.13 → graphinate-0.2.15}/tests/graphinate/test_tools.py +26 -1
  9. graphinate-0.2.13/src/graphinate/server/web/elements/index.html +0 -20
  10. graphinate-0.2.13/src/graphinate/server/web/rapidoc/index.html +0 -14
  11. {graphinate-0.2.13 → graphinate-0.2.15}/.coveragerc +0 -0
  12. {graphinate-0.2.13 → graphinate-0.2.15}/.github/dependabot.yml +0 -0
  13. {graphinate-0.2.13 → graphinate-0.2.15}/.github/workflows/codeql.yml +0 -0
  14. {graphinate-0.2.13 → graphinate-0.2.15}/.github/workflows/publish-docs.yaml +0 -0
  15. {graphinate-0.2.13 → graphinate-0.2.15}/.github/workflows/publish.yml +0 -0
  16. {graphinate-0.2.13 → graphinate-0.2.15}/.github/workflows/test-beta.yml +0 -0
  17. {graphinate-0.2.13 → graphinate-0.2.15}/.github/workflows/test.yml +0 -0
  18. {graphinate-0.2.13 → graphinate-0.2.15}/.gitignore +0 -0
  19. {graphinate-0.2.13 → graphinate-0.2.15}/LICENSE +0 -0
  20. {graphinate-0.2.13 → graphinate-0.2.15}/README.md +0 -0
  21. {graphinate-0.2.13 → graphinate-0.2.15}/STATS.md +0 -0
  22. {graphinate-0.2.13 → graphinate-0.2.15}/docs/acknowledge.md +0 -0
  23. {graphinate-0.2.13 → graphinate-0.2.15}/docs/assets/images/logo-128.png +0 -0
  24. {graphinate-0.2.13 → graphinate-0.2.15}/docs/assets/images/network_graph.png +0 -0
  25. {graphinate-0.2.13 → graphinate-0.2.15}/docs/assets/stylesheets/extra.css +0 -0
  26. {graphinate-0.2.13 → graphinate-0.2.15}/docs/dev.md +0 -0
  27. {graphinate-0.2.13 → graphinate-0.2.15}/docs/examples/code.md +0 -0
  28. {graphinate-0.2.13 → graphinate-0.2.15}/docs/examples/github.md +0 -0
  29. {graphinate-0.2.13 → graphinate-0.2.15}/docs/examples/math.md +0 -0
  30. {graphinate-0.2.13 → graphinate-0.2.15}/docs/examples/web.md +0 -0
  31. {graphinate-0.2.13 → graphinate-0.2.15}/docs/gen_ref_pages.py +0 -0
  32. {graphinate-0.2.13 → graphinate-0.2.15}/docs/index.md +0 -0
  33. {graphinate-0.2.13 → graphinate-0.2.15}/docs/intro.md +0 -0
  34. {graphinate-0.2.13 → graphinate-0.2.15}/docs/start.md +0 -0
  35. {graphinate-0.2.13 → graphinate-0.2.15}/docs/usage/cli.md +0 -0
  36. {graphinate-0.2.13 → graphinate-0.2.15}/docs/usage/lib.md +0 -0
  37. {graphinate-0.2.13 → graphinate-0.2.15}/examples/code/python_ast.py +0 -0
  38. {graphinate-0.2.13 → graphinate-0.2.15}/examples/code/python_dependencies.py +0 -0
  39. {graphinate-0.2.13 → graphinate-0.2.15}/examples/code/requirements.txt +0 -0
  40. {graphinate-0.2.13 → graphinate-0.2.15}/examples/github/_client.py +0 -0
  41. {graphinate-0.2.13 → graphinate-0.2.15}/examples/github/commits_visibilty_graph.py +0 -0
  42. {graphinate-0.2.13 → graphinate-0.2.15}/examples/github/followers.graphql +0 -0
  43. {graphinate-0.2.13 → graphinate-0.2.15}/examples/github/followers.py +0 -0
  44. {graphinate-0.2.13 → graphinate-0.2.15}/examples/github/graphql.config.yml +0 -0
  45. {graphinate-0.2.13 → graphinate-0.2.15}/examples/github/repositories.graphql +0 -0
  46. {graphinate-0.2.13 → graphinate-0.2.15}/examples/github/repositories.py +0 -0
  47. {graphinate-0.2.13 → graphinate-0.2.15}/examples/github/requirements.txt +0 -0
  48. {graphinate-0.2.13 → graphinate-0.2.15}/examples/math/graph_atlas.py +0 -0
  49. {graphinate-0.2.13 → graphinate-0.2.15}/examples/math/polygonal_graph.py +0 -0
  50. {graphinate-0.2.13 → graphinate-0.2.15}/examples/web/page_links.py +0 -0
  51. {graphinate-0.2.13 → graphinate-0.2.15}/examples/web/requirements.txt +0 -0
  52. {graphinate-0.2.13 → graphinate-0.2.15}/mkdocs.yml +0 -0
  53. {graphinate-0.2.13 → graphinate-0.2.15}/playground/ethernet/traceroute.py +0 -0
  54. {graphinate-0.2.13 → graphinate-0.2.15}/playground/genric_graph.graphql +0 -0
  55. {graphinate-0.2.13 → graphinate-0.2.15}/playground/graphql.config.yml +0 -0
  56. {graphinate-0.2.13 → graphinate-0.2.15}/playground/house_of_graphs.py +0 -0
  57. {graphinate-0.2.13 → graphinate-0.2.15}/playground/social/albums.json +0 -0
  58. {graphinate-0.2.13 → graphinate-0.2.15}/playground/social/musicisians.py +0 -0
  59. {graphinate-0.2.13 → graphinate-0.2.15}/playground/text/nlp_graph.py +0 -0
  60. {graphinate-0.2.13 → graphinate-0.2.15}/playground/text/requirements.txt +0 -0
  61. {graphinate-0.2.13 → graphinate-0.2.15}/playground/time_series/requirements.txt +0 -0
  62. {graphinate-0.2.13 → graphinate-0.2.15}/playground/time_series/visibility_graph.py +0 -0
  63. {graphinate-0.2.13 → graphinate-0.2.15}/sonar-project.properties +0 -0
  64. {graphinate-0.2.13 → graphinate-0.2.15}/src/graphinate/__init__.py +0 -0
  65. {graphinate-0.2.13 → graphinate-0.2.15}/src/graphinate/__main__.py +0 -0
  66. {graphinate-0.2.13 → graphinate-0.2.15}/src/graphinate/cli.py +0 -0
  67. {graphinate-0.2.13 → graphinate-0.2.15}/src/graphinate/color.py +0 -0
  68. {graphinate-0.2.13 → graphinate-0.2.15}/src/graphinate/materializers/__init__.py +0 -0
  69. {graphinate-0.2.13 → graphinate-0.2.15}/src/graphinate/materializers/matplotlib.py +0 -0
  70. {graphinate-0.2.13 → graphinate-0.2.15}/src/graphinate/modeling.py +0 -0
  71. {graphinate-0.2.13 → graphinate-0.2.15}/src/graphinate/server/starlette/__init__.py +0 -0
  72. {graphinate-0.2.13 → graphinate-0.2.15}/src/graphinate/server/starlette/views.py +0 -0
  73. {graphinate-0.2.13 → graphinate-0.2.15}/src/graphinate/server/web/__init__.py +0 -0
  74. {graphinate-0.2.13 → graphinate-0.2.15}/src/graphinate/server/web/elements/__init__.py +0 -0
  75. {graphinate-0.2.13 → graphinate-0.2.15}/src/graphinate/server/web/graphiql/__init__.py +0 -0
  76. {graphinate-0.2.13 → graphinate-0.2.15}/src/graphinate/server/web/graphiql/index.html +0 -0
  77. {graphinate-0.2.13 → graphinate-0.2.15}/src/graphinate/server/web/rapidoc/__init__.py +0 -0
  78. {graphinate-0.2.13 → graphinate-0.2.15}/src/graphinate/server/web/static/images/logo-128.png +0 -0
  79. {graphinate-0.2.13 → graphinate-0.2.15}/src/graphinate/server/web/static/images/network_graph.png +0 -0
  80. {graphinate-0.2.13 → graphinate-0.2.15}/src/graphinate/server/web/viewer/__init__.py +0 -0
  81. {graphinate-0.2.13 → graphinate-0.2.15}/src/graphinate/server/web/viewer/index.html +0 -0
  82. {graphinate-0.2.13 → graphinate-0.2.15}/src/graphinate/server/web/voyager/__init__.py +0 -0
  83. {graphinate-0.2.13 → graphinate-0.2.15}/src/graphinate/server/web/voyager/index.html +0 -0
  84. {graphinate-0.2.13 → graphinate-0.2.15}/src/graphinate/tools/__init__.py +0 -0
  85. {graphinate-0.2.13 → graphinate-0.2.15}/src/graphinate/tools/gui.py +0 -0
  86. {graphinate-0.2.13 → graphinate-0.2.15}/src/graphinate/tools/mutators.py +0 -0
  87. {graphinate-0.2.13 → graphinate-0.2.15}/src/graphinate/typing.py +0 -0
  88. {graphinate-0.2.13 → graphinate-0.2.15}/tests/conftest.py +0 -0
  89. {graphinate-0.2.13 → graphinate-0.2.15}/tests/graphinate/test_builders.py +0 -0
  90. {graphinate-0.2.13 → graphinate-0.2.15}/tests/graphinate/test_cli.py +0 -0
  91. {graphinate-0.2.13 → graphinate-0.2.15}/tests/graphinate/test_color.py +0 -0
  92. {graphinate-0.2.13 → graphinate-0.2.15}/tests/graphinate/test_materializers.py +0 -0
  93. {graphinate-0.2.13 → graphinate-0.2.15}/tests/graphinate/test_modeling.py +0 -0
  94. {graphinate-0.2.13 → graphinate-0.2.15}/tests/graphinate/test_server.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: Graphinate
3
- Version: 0.2.13
3
+ Version: 0.2.15
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
@@ -33,6 +33,9 @@ Requires-Dist: loguru==0.7.2
33
33
  Requires-Dist: matplotlib==3.8.3
34
34
  Requires-Dist: networkx==3.2.1
35
35
  Requires-Dist: strawberry-graphql[asgi,opentelemetry]==0.219.2
36
+ Provides-Extra: dbs
37
+ Requires-Dist: neo4j>=5.17.0; extra == 'dbs'
38
+ Requires-Dist: pydgraph>=23.0.2; extra == 'dbs'
36
39
  Provides-Extra: dev
37
40
  Requires-Dist: pipdeptree; extra == 'dev'
38
41
  Requires-Dist: ruff; extra == 'dev'
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "Graphinate"
3
- version = "0.2.13"
3
+ version = "0.2.15"
4
4
  authors = [
5
5
  { name = "Eran Rivlis", email = "eran@rivlis.info" },
6
6
  ]
@@ -66,6 +66,10 @@ test = [
66
66
  "pytest-randomly>=3.15.0",
67
67
  "pytest-xdist>=3.5.0"
68
68
  ]
69
+ dbs = [
70
+ "pydgraph>=23.0.2",
71
+ "neo4j>=5.17.0"
72
+ ]
69
73
  plot = [
70
74
  "scipy>=1.12.0"
71
75
  ]
@@ -27,7 +27,7 @@ from strawberry.extensions import ParserCache, QueryDepthLimiter, ValidationCach
27
27
 
28
28
  from . import color
29
29
  from .modeling import UNIVERSE_NODE, GraphModel
30
- from .tools import mutators
30
+ from .tools import converters, mutators
31
31
  from .typing import NodeTypeAbsoluteId
32
32
 
33
33
  DEFAULT_NODE_DELIMITER = ' ∋ '
@@ -353,9 +353,10 @@ class GraphQLBuilder(NetworkxBuilder):
353
353
  # region Strawberry Types
354
354
 
355
355
  InfNumber = strawberry.scalar(
356
- NewType("InfInt", Union[float, int, decimal.Decimal]),
357
- serialize=lambda v: 'Infinity' if v == math.inf else ('-Infinity' if v == -math.inf else v),
358
- parse_value=lambda v: math.inf if v == 'Infinity' else (-math.inf if v == '-Infinity' else v),
356
+ converters.InfNumber,
357
+ description='Integer, Decimal or Float including Infinity and -Infinity',
358
+ serialize=converters.infnum_to_value,
359
+ parse_value=converters.value_to_infnum,
359
360
  )
360
361
 
361
362
  @strawberry.type
@@ -11,6 +11,8 @@ from .starlette import routes
11
11
 
12
12
  DEFAULT_PORT: int = 8072
13
13
 
14
+ GRAPHQL_ROUTE_PATH = "/graphql"
15
+
14
16
 
15
17
  def openapi_schema(request):
16
18
  schema = SchemaGenerator(
@@ -18,7 +20,7 @@ def openapi_schema(request):
18
20
  "openapi": "3.0.0",
19
21
  "info": {"title": "Graphinate API", "version": "1.0"},
20
22
  "paths": {
21
- "/graphql": {
23
+ GRAPHQL_ROUTE_PATH: {
22
24
  "get": {
23
25
  "responses": {
24
26
  200: {
@@ -95,8 +97,8 @@ def graphql(graphql_schema: strawberry.Schema, port: int = DEFAULT_PORT):
95
97
  lifespan=lifespan,
96
98
  routes=routes()
97
99
  )
98
- app.add_route("/graphql", graphql_app)
99
- app.add_websocket_route("/graphql", graphql_app)
100
+ app.add_route(GRAPHQL_ROUTE_PATH, graphql_app)
101
+ app.add_websocket_route(GRAPHQL_ROUTE_PATH, graphql_app)
100
102
 
101
103
  from starlette_prometheus import PrometheusMiddleware, metrics
102
104
  app.add_middleware(PrometheusMiddleware)
@@ -0,0 +1,22 @@
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>Graphinate OpenAPI Elements UI</title>
7
+ <!-- Embed elements Elements via Web Component -->
8
+ <script src="https://unpkg.com/@stoplight/elements/web-components.min.js"
9
+ integrity="sha384-yR4p7dGVb43Z+zDGOg8xyIj71nVRZvN/IpUbptwjAtxcq+IcVQ+mNMiL7ppakjKc"></script>
10
+ <link rel="stylesheet" href="https://unpkg.com/@stoplight/elements/styles.min.css"
11
+ integrity="sha384-fgRmJCkCe8Qyv2rSIDjIvkm779dv+HZbSa/ptwSeufq8qJZo/xsi79N8Rb6xTIMO">
12
+ </head>
13
+ <body>
14
+
15
+ <elements-api
16
+ apiDescriptionUrl="/schema"
17
+ router="hash"
18
+ layout="sidebar"
19
+ />
20
+
21
+ </body>
22
+ </html>
@@ -0,0 +1,15 @@
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"
6
+ integrity="sha384-x8lk+1kqb32UOR4ETiOR+bpfZZtNri15JJdU7sXAKtHk2m9yMRVvITZcxS0ILJpC"></script>
7
+ <title>Graphinate OpenAPI RapiDoc UI</title>
8
+ </head>
9
+ <body>
10
+ <rapi-doc
11
+ spec-url="/schema"
12
+ theme="dark"
13
+ ></rapi-doc>
14
+ </body>
15
+ </html>
@@ -0,0 +1,28 @@
1
+ import decimal
2
+ import math
3
+ from types import MappingProxyType
4
+ from typing import NewType, Union
5
+
6
+ InfNumber = NewType("InfNumber", Union[float, int, decimal.Decimal])
7
+
8
+ INFINITY_MAPPER = MappingProxyType({
9
+ 'Infinity': math.inf,
10
+ '+Infinity': math.inf,
11
+ '-Infinity': -math.inf
12
+ })
13
+
14
+ MATH_INF_MAPPER = MappingProxyType({
15
+ math.inf: 'Infinity',
16
+ -math.inf: '-Infinity'
17
+ })
18
+
19
+
20
+ def value_to_infnum(value: any) -> InfNumber:
21
+ return INFINITY_MAPPER.get(value, value)
22
+
23
+
24
+ def infnum_to_value(value: InfNumber):
25
+ return MATH_INF_MAPPER.get(value, value)
26
+
27
+
28
+ __all__ = ['InfNumber', 'infnum_to_value', 'value_to_infnum']
@@ -1,8 +1,11 @@
1
1
  import dataclasses
2
+ import math
2
3
 
3
- import graphinate.tools.mutators
4
4
  import pytest
5
5
 
6
+ import graphinate.tools.mutators
7
+ from graphinate.tools import converters
8
+
6
9
 
7
10
  @dataclasses.dataclass
8
11
  class Data:
@@ -38,3 +41,25 @@ dictify_value_as_str_cases = [
38
41
  def test_dictify__value_to_str(case, expected):
39
42
  actual = graphinate.tools.mutators.dictify(case, value_converter=str)
40
43
  assert actual == expected
44
+
45
+
46
+ @pytest.mark.parametrize(('case', 'expected'),
47
+ [('1', '1'), ('1.1', '1.1'), (1, 1), (1.1, 1.1), (0, 0), (True, True), ('Infinity', math.inf),
48
+ ('-Infinity', -math.inf), ('+Infinity', math.inf)])
49
+ def test_value_to_infnum(case, expected):
50
+ # act
51
+ actual = converters.value_to_infnum(case)
52
+
53
+ # assert
54
+ assert actual == expected
55
+
56
+
57
+ @pytest.mark.parametrize(('case', 'expected'),
58
+ [('1', '1'), ('1.1', '1.1'), (1, 1), (1.1, 1.1), (0, 0), (True, True), (math.inf, 'Infinity'),
59
+ (-math.inf, '-Infinity')])
60
+ def test_infnum_to_value(case, expected):
61
+ # act
62
+ actual = converters.infnum_to_value(case)
63
+
64
+ # assert
65
+ assert actual == expected
@@ -1,20 +0,0 @@
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>
@@ -1,14 +0,0 @@
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>
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