kraph 7.2.1__tar.gz → 8.0.0__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.
- {kraph-7.2.1 → kraph-8.0.0}/PKG-INFO +8 -8
- {kraph-7.2.1 → kraph-8.0.0}/README.md +6 -6
- kraph-8.0.0/kraph/__init__.py +6 -0
- kraph-8.0.0/kraph/_tested.json +1 -0
- kraph-8.0.0/kraph/connect.py +46 -0
- {kraph-7.2.1 → kraph-8.0.0}/kraph/kraph.py +38 -1
- kraph-7.2.1/kraph/arkitekt.py → kraph-8.0.0/kraph/structures.py +22 -117
- {kraph-7.2.1 → kraph-8.0.0}/pyproject.toml +11 -17
- kraph-7.2.1/kraph/__init__.py +0 -5
- kraph-7.2.1/kraph/_tested.json +0 -1
- {kraph-7.2.1 → kraph-8.0.0}/.gitignore +0 -0
- {kraph-7.2.1 → kraph-8.0.0}/kraph/api/__init__.py +0 -0
- {kraph-7.2.1 → kraph-8.0.0}/kraph/api/project.json +0 -0
- {kraph-7.2.1 → kraph-8.0.0}/kraph/api/schema.graphql +0 -0
- {kraph-7.2.1 → kraph-8.0.0}/kraph/api/schema.py +0 -0
- {kraph-7.2.1 → kraph-8.0.0}/kraph/client.py +0 -0
- {kraph-7.2.1 → kraph-8.0.0}/kraph/contrib/fakts/__init__.py +0 -0
- {kraph-7.2.1 → kraph-8.0.0}/kraph/datalayer.py +0 -0
- {kraph-7.2.1 → kraph-8.0.0}/kraph/errors.py +0 -0
- {kraph-7.2.1 → kraph-8.0.0}/kraph/io/__init__.py +0 -0
- {kraph-7.2.1 → kraph-8.0.0}/kraph/io/download.py +0 -0
- {kraph-7.2.1 → kraph-8.0.0}/kraph/io/obstore.py +0 -0
- {kraph-7.2.1 → kraph-8.0.0}/kraph/io/upload.py +0 -0
- {kraph-7.2.1 → kraph-8.0.0}/kraph/links/__init__.py +0 -0
- {kraph-7.2.1 → kraph-8.0.0}/kraph/links/errors.py +0 -0
- {kraph-7.2.1 → kraph-8.0.0}/kraph/links/upload.py +0 -0
- {kraph-7.2.1 → kraph-8.0.0}/kraph/middleware/__init__.py +0 -0
- {kraph-7.2.1 → kraph-8.0.0}/kraph/middleware/base.py +0 -0
- {kraph-7.2.1 → kraph-8.0.0}/kraph/middleware/upload.py +0 -0
- {kraph-7.2.1 → kraph-8.0.0}/kraph/pairs.py +0 -0
- {kraph-7.2.1 → kraph-8.0.0}/kraph/py.typed +0 -0
- {kraph-7.2.1 → kraph-8.0.0}/kraph/rath.py +0 -0
- {kraph-7.2.1 → kraph-8.0.0}/kraph/refs.py +0 -0
- {kraph-7.2.1 → kraph-8.0.0}/kraph/scalars.py +0 -0
- {kraph-7.2.1 → kraph-8.0.0}/kraph/traits.py +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: kraph
|
|
3
|
-
Version:
|
|
3
|
+
Version: 8.0.0
|
|
4
4
|
Summary: the arkitekt knowledge graph
|
|
5
5
|
Author-email: jhnnsrs <jhnnsrs@gmail.com>
|
|
6
6
|
License-Expression: GPL-3.0-or-later
|
|
7
7
|
Requires-Python: <4.0,>=3.11
|
|
8
|
-
Requires-Dist: arkitekt-spec>=
|
|
8
|
+
Requires-Dist: arkitekt-spec>=14
|
|
9
9
|
Requires-Dist: dokker>=2.8
|
|
10
10
|
Requires-Dist: fakts>=6.1
|
|
11
11
|
Requires-Dist: obstore>=0.11.0
|
|
@@ -46,16 +46,16 @@ the client, so follow-ups from a result go through the same client.
|
|
|
46
46
|
|
|
47
47
|
### In an arkitekt app
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
Ask for `kraph: Kraph`; the client is injected by annotation.
|
|
50
50
|
Graphs, categories, structures, metrics, terms and more travel between actions by id
|
|
51
51
|
(`@kraph/graph`, `@kraph/entitycategory`, `@kraph/structure`, `@kraph/term`, …), so an action can
|
|
52
52
|
take and return them directly:
|
|
53
53
|
|
|
54
54
|
```python
|
|
55
55
|
from arkitekt import App, run
|
|
56
|
-
from kraph import Kraph
|
|
56
|
+
from kraph import Kraph
|
|
57
57
|
|
|
58
|
-
app = App("neuron-claims", "0.1.0"
|
|
58
|
+
app = App("neuron-claims", "0.1.0")
|
|
59
59
|
|
|
60
60
|
|
|
61
61
|
@app.action
|
|
@@ -77,10 +77,10 @@ if __name__ == "__main__":
|
|
|
77
77
|
### From a script
|
|
78
78
|
|
|
79
79
|
```python
|
|
80
|
-
from arkitekt import
|
|
81
|
-
from kraph import
|
|
80
|
+
from arkitekt import connect
|
|
81
|
+
from kraph import Kraph
|
|
82
82
|
|
|
83
|
-
with
|
|
83
|
+
with connect(Kraph) as kraph:
|
|
84
84
|
graph = kraph.create_graph(name="Neurons", backfill=False)
|
|
85
85
|
kraph.create_entity_category(
|
|
86
86
|
key="Neuron",
|
|
@@ -31,16 +31,16 @@ the client, so follow-ups from a result go through the same client.
|
|
|
31
31
|
|
|
32
32
|
### In an arkitekt app
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
Ask for `kraph: Kraph`; the client is injected by annotation.
|
|
35
35
|
Graphs, categories, structures, metrics, terms and more travel between actions by id
|
|
36
36
|
(`@kraph/graph`, `@kraph/entitycategory`, `@kraph/structure`, `@kraph/term`, …), so an action can
|
|
37
37
|
take and return them directly:
|
|
38
38
|
|
|
39
39
|
```python
|
|
40
40
|
from arkitekt import App, run
|
|
41
|
-
from kraph import Kraph
|
|
41
|
+
from kraph import Kraph
|
|
42
42
|
|
|
43
|
-
app = App("neuron-claims", "0.1.0"
|
|
43
|
+
app = App("neuron-claims", "0.1.0")
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
@app.action
|
|
@@ -62,10 +62,10 @@ if __name__ == "__main__":
|
|
|
62
62
|
### From a script
|
|
63
63
|
|
|
64
64
|
```python
|
|
65
|
-
from arkitekt import
|
|
66
|
-
from kraph import
|
|
65
|
+
from arkitekt import connect
|
|
66
|
+
from kraph import Kraph
|
|
67
67
|
|
|
68
|
-
with
|
|
68
|
+
with connect(Kraph) as kraph:
|
|
69
69
|
graph = kraph.create_graph(name="Neurons", backfill=False)
|
|
70
70
|
kraph.create_entity_category(
|
|
71
71
|
key="Neuron",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version": "7.7.2"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"""How ``Kraph`` reaches a resolved deployment: its links and upload middleware."""
|
|
2
|
+
|
|
3
|
+
from arkitekt_spec.declare.wiring import Alias, TokenLoader
|
|
4
|
+
from fakts.contrib.rath.auth import FaktsAuthLink
|
|
5
|
+
from rath.links import compose
|
|
6
|
+
from rath.links.aiohttp import AIOHttpLink
|
|
7
|
+
from rath.links.dictinglink import DictingLink
|
|
8
|
+
from rath.links.graphql_ws import GraphQLWSLink
|
|
9
|
+
from rath.links.shrink import ShrinkingLink
|
|
10
|
+
from rath.links.split import SplitLink
|
|
11
|
+
|
|
12
|
+
from graphql import OperationType
|
|
13
|
+
from kraph.datalayer import DataLayer
|
|
14
|
+
from kraph.links.upload import UploadLink
|
|
15
|
+
from kraph.middleware.upload import UploadMiddleware
|
|
16
|
+
from kraph.rath import KraphRath
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def kraph_rath(kraph: Alias, datalayer: DataLayer, tokens: TokenLoader) -> KraphRath:
|
|
20
|
+
"""The rath over http and ws, uploading files to ``datalayer`` first."""
|
|
21
|
+
return KraphRath(
|
|
22
|
+
# Files in a request (a model's weights) go to the datalayer first, as every service's do.
|
|
23
|
+
middlewares=[UploadMiddleware(datalayer=datalayer)],
|
|
24
|
+
link=compose(
|
|
25
|
+
ShrinkingLink(),
|
|
26
|
+
DictingLink(),
|
|
27
|
+
FaktsAuthLink(token_loader=tokens),
|
|
28
|
+
UploadLink(datalayer=datalayer),
|
|
29
|
+
SplitLink(
|
|
30
|
+
left=AIOHttpLink(
|
|
31
|
+
endpoint_url=kraph.to_http_path("graphql"),
|
|
32
|
+
proxy=kraph.proxy,
|
|
33
|
+
ssl_context=kraph.ssl_context(),
|
|
34
|
+
),
|
|
35
|
+
right=GraphQLWSLink(
|
|
36
|
+
ws_endpoint_url=kraph.to_ws_path("graphql"),
|
|
37
|
+
proxy=kraph.proxy,
|
|
38
|
+
ssl_context=kraph.ssl_context(),
|
|
39
|
+
),
|
|
40
|
+
split=lambda o: o.node.operation != OperationType.SUBSCRIPTION,
|
|
41
|
+
),
|
|
42
|
+
),
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
__all__ = ["kraph_rath"]
|
|
@@ -16,9 +16,13 @@ nullable field in this schema already defaults to null, so omitting and sending
|
|
|
16
16
|
same thing.
|
|
17
17
|
"""
|
|
18
18
|
|
|
19
|
+
import os
|
|
19
20
|
from collections.abc import AsyncGenerator, Generator
|
|
20
|
-
from typing import Any
|
|
21
|
+
from typing import Annotated, Any, Self
|
|
21
22
|
|
|
23
|
+
from arkitekt_spec.declare.client import client
|
|
24
|
+
from arkitekt_spec.declare.tested import tested_against
|
|
25
|
+
from arkitekt_spec.declare.wiring import Alias, Require, TokenLoader
|
|
22
26
|
from koil import unkoil, unkoil_gen
|
|
23
27
|
from koil.composition import Composition
|
|
24
28
|
from rath.origin import origin_context
|
|
@@ -29,7 +33,22 @@ from kraph.api.schema import KraphApi
|
|
|
29
33
|
from kraph.datalayer import DataLayer
|
|
30
34
|
from kraph.rath import KraphRath
|
|
31
35
|
|
|
36
|
+
TESTED = tested_against("kraph")
|
|
37
|
+
"""The kraph server this release wants: the one its release job tested it against."""
|
|
32
38
|
|
|
39
|
+
_API = os.path.join(os.path.dirname(__file__), "api")
|
|
40
|
+
KRAPH = Require(
|
|
41
|
+
"live.arkitekt.kraph",
|
|
42
|
+
"Where the knowledge graph relating entities lives",
|
|
43
|
+
version=TESTED,
|
|
44
|
+
)
|
|
45
|
+
S3 = Require("live.arkitekt.s3", "Where the graph's files are stored", optional=True)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@client(
|
|
49
|
+
schema=os.path.join(_API, "schema.graphql"),
|
|
50
|
+
turms=os.path.join(_API, "project.json"),
|
|
51
|
+
)
|
|
33
52
|
class Kraph(Composition, KraphApi):
|
|
34
53
|
"""The kraph client.
|
|
35
54
|
|
|
@@ -43,6 +62,24 @@ class Kraph(Composition, KraphApi):
|
|
|
43
62
|
rath: KraphRath
|
|
44
63
|
datalayer: DataLayer
|
|
45
64
|
|
|
65
|
+
@classmethod
|
|
66
|
+
def from_fakts(
|
|
67
|
+
cls,
|
|
68
|
+
kraph: Annotated[Alias, KRAPH],
|
|
69
|
+
datalayer: Annotated[Alias | None, S3],
|
|
70
|
+
tokens: TokenLoader,
|
|
71
|
+
) -> Self:
|
|
72
|
+
"""Kraph over the resolved deployment.
|
|
73
|
+
|
|
74
|
+
Without a store the client still works; only uploads do not.
|
|
75
|
+
"""
|
|
76
|
+
from kraph.connect import kraph_rath
|
|
77
|
+
|
|
78
|
+
store = (
|
|
79
|
+
DataLayer.from_alias(datalayer) if datalayer is not None else DataLayer()
|
|
80
|
+
)
|
|
81
|
+
return cls(rath=kraph_rath(kraph, store, tokens), datalayer=store)
|
|
82
|
+
|
|
46
83
|
@staticmethod
|
|
47
84
|
def _serialize(
|
|
48
85
|
operation: type[TOperation], variables: dict[str, Any]
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
"""The kraph
|
|
1
|
+
"""The types kraph sends by id: each expanded by the ``Kraph`` client.
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
ask for the ``Kraph`` it returns. Each type is declared once -- the class, the
|
|
5
|
-
identifier it travels under, the widget a user picks one with, and how to fetch it
|
|
6
|
-
back. An app takes all of it in with ``App(services=[kraph_service])``.
|
|
3
|
+
Imported by ``kraph/__init__``, so each class is marked whenever kraph is.
|
|
7
4
|
|
|
8
5
|
The ``@kraph/…`` identifier strings are a wire contract: other arkitekt services
|
|
9
6
|
resolve against them, so renaming one is a coordinated cross-service change, not a
|
|
@@ -11,7 +8,7 @@ local refactor. Two of them therefore keep their old spelling while pointing at
|
|
|
11
8
|
renamed type — ``@kraph/structurecategory`` now names a :class:`StructureKind`, and
|
|
12
9
|
``@kraph/metriccategory`` a :class:`MetricKind`.
|
|
13
10
|
|
|
14
|
-
One
|
|
11
|
+
One identifier changed meaning and could not keep its type. ``@kraph/entity`` used
|
|
15
12
|
to expand through ``get_node(id)``, but the view-grain readers (``node``/``entity``)
|
|
16
13
|
now require a graph as well as an id, and an expander is handed only the id.
|
|
17
14
|
``instance(id:)`` is the graph-free addressable claim, so that is what the identifier
|
|
@@ -22,22 +19,9 @@ resolves to — visible now in the expander itself rather than in a separate map
|
|
|
22
19
|
table-query surface.
|
|
23
20
|
"""
|
|
24
21
|
|
|
25
|
-
import
|
|
26
|
-
from typing import Annotated
|
|
27
|
-
|
|
28
|
-
from arkitekt_spec.declare.app import AppRegistry
|
|
29
|
-
from arkitekt_spec.declare.tested import tested_against
|
|
22
|
+
from arkitekt_spec.declare.structures.declare import structure
|
|
30
23
|
from arkitekt_spec.declare.widgets import SearchWidget
|
|
31
|
-
|
|
32
|
-
from fakts.contrib.rath.auth import FaktsAuthLink
|
|
33
|
-
from rath.links import compose
|
|
34
|
-
from rath.links.aiohttp import AIOHttpLink
|
|
35
|
-
from rath.links.dictinglink import DictingLink
|
|
36
|
-
from rath.links.graphql_ws import GraphQLWSLink
|
|
37
|
-
from rath.links.shrink import ShrinkingLink
|
|
38
|
-
from rath.links.split import SplitLink
|
|
39
|
-
|
|
40
|
-
from graphql import OperationType
|
|
24
|
+
|
|
41
25
|
from kraph.api.schema import (
|
|
42
26
|
EntityCategory,
|
|
43
27
|
Graph,
|
|
@@ -71,80 +55,7 @@ from kraph.api.schema import (
|
|
|
71
55
|
StructureRelationCategory,
|
|
72
56
|
Term,
|
|
73
57
|
)
|
|
74
|
-
from kraph.datalayer import DataLayer
|
|
75
58
|
from kraph.kraph import Kraph
|
|
76
|
-
from kraph.links.upload import UploadLink
|
|
77
|
-
from kraph.middleware.upload import UploadMiddleware
|
|
78
|
-
from kraph.rath import KraphRath
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
def build_relative_path(*path: str) -> str:
|
|
82
|
-
"""Build a path relative to this file, for the files shipped beside it."""
|
|
83
|
-
return os.path.join(os.path.dirname(__file__), *path)
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
registry = AppRegistry()
|
|
87
|
-
"""What kraph brings to an app: its service, and the types it can send by id."""
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
TESTED = tested_against("kraph")
|
|
91
|
-
"""The kraph server this release wants: the one its release job tested it against."""
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
@registry.service(
|
|
95
|
-
schema=build_relative_path("api", "schema.graphql"),
|
|
96
|
-
turms=build_relative_path("api", "project.json"),
|
|
97
|
-
)
|
|
98
|
-
def kraph(
|
|
99
|
-
kraph: Annotated[
|
|
100
|
-
Alias,
|
|
101
|
-
Require(
|
|
102
|
-
"live.arkitekt.kraph",
|
|
103
|
-
"Where the knowledge graph relating entities lives",
|
|
104
|
-
version=TESTED,
|
|
105
|
-
),
|
|
106
|
-
],
|
|
107
|
-
datalayer: Annotated[
|
|
108
|
-
Alias | None,
|
|
109
|
-
Require(
|
|
110
|
-
"live.arkitekt.s3", "Where the graph's files are stored", optional=True
|
|
111
|
-
),
|
|
112
|
-
],
|
|
113
|
-
tokens: TokenLoader,
|
|
114
|
-
) -> Kraph:
|
|
115
|
-
"""Kraph: the knowledge graph relating entities.
|
|
116
|
-
|
|
117
|
-
The datalayer is optional, so a deployment that offers no store still gets a
|
|
118
|
-
working client -- uploads are what stop working, not the graph.
|
|
119
|
-
"""
|
|
120
|
-
store = DataLayer.from_alias(datalayer) if datalayer is not None else DataLayer()
|
|
121
|
-
|
|
122
|
-
return Kraph(
|
|
123
|
-
rath=KraphRath(
|
|
124
|
-
# Files in a request (a model's weights) go to the datalayer first, as every service's do.
|
|
125
|
-
middlewares=[UploadMiddleware(datalayer=store)],
|
|
126
|
-
link=compose(
|
|
127
|
-
ShrinkingLink(),
|
|
128
|
-
DictingLink(),
|
|
129
|
-
FaktsAuthLink(token_loader=tokens),
|
|
130
|
-
UploadLink(datalayer=store),
|
|
131
|
-
SplitLink(
|
|
132
|
-
left=AIOHttpLink(
|
|
133
|
-
endpoint_url=kraph.to_http_path("graphql"),
|
|
134
|
-
proxy=kraph.proxy,
|
|
135
|
-
ssl_context=kraph.ssl_context(),
|
|
136
|
-
),
|
|
137
|
-
right=GraphQLWSLink(
|
|
138
|
-
ws_endpoint_url=kraph.to_ws_path("graphql"),
|
|
139
|
-
proxy=kraph.proxy,
|
|
140
|
-
ssl_context=kraph.ssl_context(),
|
|
141
|
-
),
|
|
142
|
-
split=lambda o: o.node.operation != OperationType.SUBSCRIPTION,
|
|
143
|
-
),
|
|
144
|
-
),
|
|
145
|
-
),
|
|
146
|
-
datalayer=store,
|
|
147
|
-
)
|
|
148
59
|
|
|
149
60
|
|
|
150
61
|
def _search(query: object) -> SearchWidget:
|
|
@@ -155,21 +66,19 @@ def _search(query: object) -> SearchWidget:
|
|
|
155
66
|
# --- views and their declarations ------------------------------------------------
|
|
156
67
|
|
|
157
68
|
|
|
158
|
-
@
|
|
69
|
+
@structure("@kraph/graph", widget=_search(SearchGraphsQuery))
|
|
159
70
|
async def expand_graph(id: str, kraph: Kraph) -> Graph:
|
|
160
71
|
"""A graph, by id."""
|
|
161
72
|
return await kraph.aget_graph(id)
|
|
162
73
|
|
|
163
74
|
|
|
164
|
-
@
|
|
165
|
-
"@kraph/entitycategory", widget=_search(SearchEntityCategoriesQuery)
|
|
166
|
-
)
|
|
75
|
+
@structure("@kraph/entitycategory", widget=_search(SearchEntityCategoriesQuery))
|
|
167
76
|
async def expand_entity_category(id: str, kraph: Kraph) -> EntityCategory:
|
|
168
77
|
"""An entity category, by id."""
|
|
169
78
|
return await kraph.aget_entity_category(id)
|
|
170
79
|
|
|
171
80
|
|
|
172
|
-
@
|
|
81
|
+
@structure(
|
|
173
82
|
"@kraph/relationcategory",
|
|
174
83
|
widget=_search(SearchRelationCategoriesQuery),
|
|
175
84
|
)
|
|
@@ -178,7 +87,7 @@ async def expand_relation_category(id: str, kraph: Kraph) -> RelationCategory:
|
|
|
178
87
|
return await kraph.aget_relation_category(id)
|
|
179
88
|
|
|
180
89
|
|
|
181
|
-
@
|
|
90
|
+
@structure(
|
|
182
91
|
"@kraph/measurementcategory",
|
|
183
92
|
widget=_search(SearchMeasurementCategoriesQuery),
|
|
184
93
|
)
|
|
@@ -187,7 +96,7 @@ async def expand_measurement_category(id: str, kraph: Kraph) -> MeasurementCateg
|
|
|
187
96
|
return await kraph.aget_measurement_category(id)
|
|
188
97
|
|
|
189
98
|
|
|
190
|
-
@
|
|
99
|
+
@structure(
|
|
191
100
|
"@kraph/structurerelationcategory",
|
|
192
101
|
widget=_search(SearchStructureRelationCategoriesQuery),
|
|
193
102
|
)
|
|
@@ -198,7 +107,7 @@ async def expand_structure_relation_category(
|
|
|
198
107
|
return await kraph.aget_structure_relation_category(id)
|
|
199
108
|
|
|
200
109
|
|
|
201
|
-
@
|
|
110
|
+
@structure(
|
|
202
111
|
"@kraph/naturaleventcategory",
|
|
203
112
|
widget=_search(SearchNaturalEventCategoriesQuery),
|
|
204
113
|
)
|
|
@@ -207,7 +116,7 @@ async def expand_natural_event_category(id: str, kraph: Kraph) -> NaturalEventCa
|
|
|
207
116
|
return await kraph.aget_natural_event_category(id)
|
|
208
117
|
|
|
209
118
|
|
|
210
|
-
@
|
|
119
|
+
@structure(
|
|
211
120
|
"@kraph/protocoleventcategory",
|
|
212
121
|
widget=_search(SearchProtocolEventCategoriesQuery),
|
|
213
122
|
)
|
|
@@ -223,25 +132,25 @@ async def expand_protocol_event_category(
|
|
|
223
132
|
|
|
224
133
|
# `Instance` has no scalar label -- its name lives at `term { key }` -- so it gets no
|
|
225
134
|
# search widget: a two-field `value`/`label` projection cannot reach it.
|
|
226
|
-
@
|
|
135
|
+
@structure("@kraph/entity")
|
|
227
136
|
async def expand_entity(id: str, kraph: Kraph) -> Instance:
|
|
228
137
|
"""The graph-free addressable claim an `@kraph/entity` names, by id."""
|
|
229
138
|
return await kraph.aget_instance(id)
|
|
230
139
|
|
|
231
140
|
|
|
232
|
-
@
|
|
141
|
+
@structure("@kraph/link")
|
|
233
142
|
async def expand_link(id: str, kraph: Kraph) -> Link:
|
|
234
143
|
"""A link, by id."""
|
|
235
144
|
return await kraph.aget_link(id)
|
|
236
145
|
|
|
237
146
|
|
|
238
|
-
@
|
|
147
|
+
@structure("@kraph/structure", widget=_search(SearchStructuresQuery))
|
|
239
148
|
async def expand_structure(id: str, kraph: Kraph) -> Structure:
|
|
240
149
|
"""A structure, by id."""
|
|
241
150
|
return await kraph.aget_structure(id)
|
|
242
151
|
|
|
243
152
|
|
|
244
|
-
@
|
|
153
|
+
@structure("@kraph/metric")
|
|
245
154
|
async def expand_metric(id: str, kraph: Kraph) -> Metric:
|
|
246
155
|
"""A metric, by id."""
|
|
247
156
|
return await kraph.aget_metric(id)
|
|
@@ -250,23 +159,21 @@ async def expand_metric(id: str, kraph: Kraph) -> Metric:
|
|
|
250
159
|
# --- vocabulary ------------------------------------------------------------------
|
|
251
160
|
|
|
252
161
|
|
|
253
|
-
@
|
|
162
|
+
@structure("@kraph/term", widget=_search(SearchTermsQuery))
|
|
254
163
|
async def expand_term(id: str, kraph: Kraph) -> Term:
|
|
255
164
|
"""A term, by id."""
|
|
256
165
|
return await kraph.aget_term(id)
|
|
257
166
|
|
|
258
167
|
|
|
259
168
|
# Identifier kept for wire compatibility; the type behind it is now StructureKind.
|
|
260
|
-
@
|
|
261
|
-
"@kraph/structurecategory", widget=_search(SearchStructureKindsQuery)
|
|
262
|
-
)
|
|
169
|
+
@structure("@kraph/structurecategory", widget=_search(SearchStructureKindsQuery))
|
|
263
170
|
async def expand_structure_kind(id: str, kraph: Kraph) -> StructureKind:
|
|
264
171
|
"""A structure kind, by id -- it travels as `@kraph/structurecategory`."""
|
|
265
172
|
return await kraph.aget_structure_kind(id)
|
|
266
173
|
|
|
267
174
|
|
|
268
175
|
# Identifier kept for wire compatibility; the type behind it is now MetricKind.
|
|
269
|
-
@
|
|
176
|
+
@structure("@kraph/metriccategory", widget=_search(SearchMetricKindsQuery))
|
|
270
177
|
async def expand_metric_kind(id: str, kraph: Kraph) -> MetricKind:
|
|
271
178
|
"""A metric kind, by id -- it travels as `@kraph/metriccategory`."""
|
|
272
179
|
return await kraph.aget_metric_kind(id)
|
|
@@ -287,7 +194,7 @@ def describe_pairs_query(query: GraphPairsQuery) -> dict:
|
|
|
287
194
|
|
|
288
195
|
# The search widgets forward a port's `requires` ($requires), so a picker for a typed port
|
|
289
196
|
# offers only the queries and runs that port accepts.
|
|
290
|
-
@
|
|
197
|
+
@structure(
|
|
291
198
|
"@kraph/pairsquery",
|
|
292
199
|
widget=_search(SearchGraphPairsQueriesQuery),
|
|
293
200
|
describe=describe_pairs_query,
|
|
@@ -302,7 +209,7 @@ def describe_pairs_run(run: PairsQueryRun) -> dict:
|
|
|
302
209
|
return dict(run.descriptors or {})
|
|
303
210
|
|
|
304
211
|
|
|
305
|
-
@
|
|
212
|
+
@structure(
|
|
306
213
|
"@kraph/pairsrun",
|
|
307
214
|
widget=_search(SearchPairsQueryRunsQuery),
|
|
308
215
|
describe=describe_pairs_run,
|
|
@@ -322,9 +229,7 @@ def describe_model(model: Model) -> dict:
|
|
|
322
229
|
return dict(model.descriptors or {})
|
|
323
230
|
|
|
324
231
|
|
|
325
|
-
@
|
|
326
|
-
"@kraph/model", widget=_search(SearchModelsQuery), describe=describe_model
|
|
327
|
-
)
|
|
232
|
+
@structure("@kraph/model", widget=_search(SearchModelsQuery), describe=describe_model)
|
|
328
233
|
async def expand_model(id: str, kraph: Kraph) -> Model:
|
|
329
234
|
"""A trained model, by id: its weights and the pairs query run it learned from."""
|
|
330
235
|
return await kraph.aget_model(id)
|
|
@@ -13,7 +13,7 @@ dependencies = [
|
|
|
13
13
|
"rath>=4.1.1",
|
|
14
14
|
"websockets>=15.0.1",
|
|
15
15
|
# The service and structures are declared with arkitekt-spec (5.0: a service reads its scopes off its client).
|
|
16
|
-
"arkitekt-spec>=
|
|
16
|
+
"arkitekt-spec>=14",
|
|
17
17
|
# The service wiring (Alias, Require, FaktsAuthLink); it came through rekuest before.
|
|
18
18
|
"fakts>=6.1",
|
|
19
19
|
# The datalayer: big files (a model's weights) go to S3 through obstore, as in mikro and elektro.
|
|
@@ -23,22 +23,6 @@ dependencies = [
|
|
|
23
23
|
[project.optional-dependencies]
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
[tool.uv]
|
|
27
|
-
dev-dependencies = [
|
|
28
|
-
"pytest-asyncio>=0.26.0",
|
|
29
|
-
"pytest-cov>=6.1.1",
|
|
30
|
-
"pytest>=8.3.5",
|
|
31
|
-
"python-semantic-release>=9.21.0",
|
|
32
|
-
"autoflake>=1.7.7,<2",
|
|
33
|
-
"aiohttp>=3.8.3,<4",
|
|
34
|
-
"black>=23.1.0,<24",
|
|
35
|
-
"pytest-aiohttp>=1.0.4,<2",
|
|
36
|
-
"turms>=3.0",
|
|
37
|
-
"dokker>=2.8",
|
|
38
|
-
]
|
|
39
|
-
|
|
40
|
-
# `_tested.json` is written by the integration tests (the server version they ran against)
|
|
41
|
-
# and is not in git: named as an artifact, on both, it is shipped all the same.
|
|
42
26
|
[tool.hatch.build.targets.sdist]
|
|
43
27
|
include = ["kraph"]
|
|
44
28
|
artifacts = ["kraph/_tested.json"]
|
|
@@ -119,4 +103,14 @@ exclude_commit_patterns = [
|
|
|
119
103
|
dev = [
|
|
120
104
|
"ruff==0.17.6",
|
|
121
105
|
"basedpyright==1.40.2",
|
|
106
|
+
"pytest-asyncio>=0.26.0",
|
|
107
|
+
"pytest-cov>=6.1.1",
|
|
108
|
+
"pytest>=8.3.5",
|
|
109
|
+
"python-semantic-release>=9.21.0",
|
|
110
|
+
"autoflake>=1.7.7,<2",
|
|
111
|
+
"aiohttp>=3.8.3,<4",
|
|
112
|
+
"black>=23.1.0,<24",
|
|
113
|
+
"pytest-aiohttp>=1.0.4,<2",
|
|
114
|
+
"turms>=3.0",
|
|
115
|
+
"dokker>=2.8",
|
|
122
116
|
]
|
kraph-7.2.1/kraph/__init__.py
DELETED
kraph-7.2.1/kraph/_tested.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version": "7.7.1"}
|
|
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
|