kraph 7.1.0__tar.gz → 7.2.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.
Files changed (32) hide show
  1. {kraph-7.1.0 → kraph-7.2.0}/.gitignore +4 -1
  2. {kraph-7.1.0 → kraph-7.2.0}/PKG-INFO +3 -3
  3. kraph-7.2.0/kraph/_tested.json +1 -0
  4. {kraph-7.1.0 → kraph-7.2.0}/kraph/arkitekt.py +6 -1
  5. {kraph-7.1.0 → kraph-7.2.0}/kraph/datalayer.py +2 -6
  6. {kraph-7.1.0 → kraph-7.2.0}/kraph/io/download.py +2 -2
  7. {kraph-7.1.0 → kraph-7.2.0}/kraph/io/obstore.py +12 -0
  8. {kraph-7.1.0 → kraph-7.2.0}/kraph/io/upload.py +2 -2
  9. {kraph-7.1.0 → kraph-7.2.0}/pyproject.toml +6 -2
  10. {kraph-7.1.0 → kraph-7.2.0}/README.md +0 -0
  11. {kraph-7.1.0 → kraph-7.2.0}/kraph/__init__.py +0 -0
  12. {kraph-7.1.0 → kraph-7.2.0}/kraph/api/__init__.py +0 -0
  13. {kraph-7.1.0 → kraph-7.2.0}/kraph/api/project.json +0 -0
  14. {kraph-7.1.0 → kraph-7.2.0}/kraph/api/schema.graphql +0 -0
  15. {kraph-7.1.0 → kraph-7.2.0}/kraph/api/schema.py +0 -0
  16. {kraph-7.1.0 → kraph-7.2.0}/kraph/client.py +0 -0
  17. {kraph-7.1.0 → kraph-7.2.0}/kraph/contrib/fakts/__init__.py +0 -0
  18. {kraph-7.1.0 → kraph-7.2.0}/kraph/errors.py +0 -0
  19. {kraph-7.1.0 → kraph-7.2.0}/kraph/io/__init__.py +0 -0
  20. {kraph-7.1.0 → kraph-7.2.0}/kraph/kraph.py +0 -0
  21. {kraph-7.1.0 → kraph-7.2.0}/kraph/links/__init__.py +0 -0
  22. {kraph-7.1.0 → kraph-7.2.0}/kraph/links/errors.py +0 -0
  23. {kraph-7.1.0 → kraph-7.2.0}/kraph/links/upload.py +0 -0
  24. {kraph-7.1.0 → kraph-7.2.0}/kraph/middleware/__init__.py +0 -0
  25. {kraph-7.1.0 → kraph-7.2.0}/kraph/middleware/base.py +0 -0
  26. {kraph-7.1.0 → kraph-7.2.0}/kraph/middleware/upload.py +0 -0
  27. {kraph-7.1.0 → kraph-7.2.0}/kraph/pairs.py +0 -0
  28. {kraph-7.1.0 → kraph-7.2.0}/kraph/py.typed +0 -0
  29. {kraph-7.1.0 → kraph-7.2.0}/kraph/rath.py +0 -0
  30. {kraph-7.1.0 → kraph-7.2.0}/kraph/refs.py +0 -0
  31. {kraph-7.1.0 → kraph-7.2.0}/kraph/scalars.py +0 -0
  32. {kraph-7.1.0 → kraph-7.2.0}/kraph/traits.py +0 -0
@@ -144,4 +144,7 @@ cython_debug/
144
144
  media
145
145
  export
146
146
  static_collected
147
- data
147
+ data
148
+
149
+ # The server version the integration tests ran against, stamped into a release.
150
+ kraph/_tested.json
@@ -1,14 +1,14 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: kraph
3
- Version: 7.1.0
3
+ Version: 7.2.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>=5.0
8
+ Requires-Dist: arkitekt-spec>=12.9
9
9
  Requires-Dist: dokker>=2.8
10
10
  Requires-Dist: fakts>=6.1
11
- Requires-Dist: obstore>=0.10.0
11
+ Requires-Dist: obstore>=0.11.0
12
12
  Requires-Dist: rath>=4.1.1
13
13
  Requires-Dist: websockets>=15.0.1
14
14
  Description-Content-Type: text/markdown
@@ -0,0 +1 @@
1
+ {"version": "7.5.0"}
@@ -36,6 +36,7 @@ from rath.links.shrink import ShrinkingLink
36
36
  from rath.links.split import SplitLink
37
37
 
38
38
  from arkitekt_spec.declare.app import AppRegistry
39
+ from arkitekt_spec.declare.tested import tested_against
39
40
  from arkitekt_spec.declare.widgets import SearchWidget
40
41
 
41
42
  from kraph.api.schema import (
@@ -88,6 +89,10 @@ registry = AppRegistry()
88
89
  """What kraph brings to an app: its service, and the types it can send by id."""
89
90
 
90
91
 
92
+ TESTED = tested_against("kraph")
93
+ """The kraph server this release wants: the one its release job tested it against."""
94
+
95
+
91
96
  @registry.service(
92
97
  schema=build_relative_path("api", "schema.graphql"),
93
98
  turms=build_relative_path("api", "project.json"),
@@ -95,7 +100,7 @@ registry = AppRegistry()
95
100
  def kraph(
96
101
  kraph: Annotated[
97
102
  Alias,
98
- Require("live.arkitekt.kraph", "Where the knowledge graph relating entities lives"),
103
+ Require("live.arkitekt.kraph", "Where the knowledge graph relating entities lives", version=TESTED),
99
104
  ],
100
105
  datalayer: Annotated[
101
106
  Alias | None,
@@ -80,12 +80,8 @@ class DataLayer(KoiledModel):
80
80
  Returns:
81
81
  The datalayer, ready to use.
82
82
  """
83
- # kraph reads and writes big files through obstore (rustls), which takes its roots only
84
- # from SSL_CERT_FILE: a pinned store's hub certificate is added there, as in elektro.
85
- if alias.is_pinned():
86
- from arkitekt_spec.declare import tls
87
-
88
- tls.trust_natively(alias.certificates)
83
+ # Every obstore store built for it takes these certificates as its own roots
84
+ # (`create_s3_store(certificates=...)`): nothing process-wide.
89
85
  return cls(
90
86
  endpoint_url=alias.to_http_path(),
91
87
  proxy=alias.proxy,
@@ -25,7 +25,7 @@ def download_bigfile(store_id: str, file_name: str, kraph: "Kraph") -> str:
25
25
  from kraph.api.schema import RequestBigFileAccessInput
26
26
 
27
27
  grant = kraph.request_bigfile_access(input=RequestBigFileAccessInput(store_id=store_id))
28
- store = create_s3_store(kraph.datalayer.endpoint_url, grant, proxy=kraph.datalayer.proxy)
28
+ store = create_s3_store(kraph.datalayer.endpoint_url, grant, proxy=kraph.datalayer.proxy, certificates=kraph.datalayer.certificates)
29
29
  response = obstore.get(store, grant.key)
30
30
  with open(_target(file_name), "wb") as file:
31
31
  for chunk in response.stream():
@@ -38,7 +38,7 @@ async def adownload_bigfile(store_id: str, file_name: str, kraph: "Kraph") -> st
38
38
  from kraph.api.schema import RequestBigFileAccessInput
39
39
 
40
40
  grant = await kraph.arequest_bigfile_access(input=RequestBigFileAccessInput(store_id=store_id))
41
- store = create_s3_store(await kraph.datalayer.get_endpoint_url(), grant, proxy=kraph.datalayer.proxy)
41
+ store = create_s3_store(await kraph.datalayer.get_endpoint_url(), grant, proxy=kraph.datalayer.proxy, certificates=kraph.datalayer.certificates)
42
42
  response = await obstore.get_async(store, grant.key)
43
43
  with open(_target(file_name), "wb") as file:
44
44
  async for chunk in response.stream():
@@ -94,6 +94,7 @@ def create_s3_store(
94
94
  prefix: str | None = None,
95
95
  *,
96
96
  proxy: str | None = None,
97
+ certificates: list[str] | None = None,
97
98
  ) -> S3Store:
98
99
  """Create an obstore S3 client from an kraph grant and endpoint.
99
100
 
@@ -104,12 +105,23 @@ def create_s3_store(
104
105
  ``proxy`` is the HTTP forward proxy the datalayer is only reachable through
105
106
  (see :attr:`DataLayer.proxy`). It is merged into the client options, never
106
107
  replacing them -- dropping ``allow_http`` would break every ``http://`` store.
108
+
109
+ ``certificates`` are a pinned store's hub certificates (:attr:`DataLayer.certificates`):
110
+ the store trusts them and nothing else, as ``Alias.ssl_context()`` does for aiohttp.
111
+ Not through ``SSL_CERT_FILE``: obstore >= 0.11 verifies with the platform's verifier,
112
+ which on macOS and Windows asks the OS trust store and never reads that variable.
113
+ With the system roots disabled, reqwest checks against these roots alone with rustls's
114
+ own verifier, so the OS's rules for server certificates (macOS: at most 825 days) do
115
+ not apply to the hub's long-lived certificate either.
107
116
  """
108
117
  normalized_client_options: dict[str, object] = dict(client_options or {})
109
118
  if endpoint_url.startswith("http://"):
110
119
  normalized_client_options.setdefault("allow_http", True)
111
120
  if proxy:
112
121
  normalized_client_options["proxy_url"] = proxy
122
+ if certificates:
123
+ normalized_client_options["root_certificate"] = "\n".join(pem.strip() for pem in certificates)
124
+ normalized_client_options["disable_system_certificates"] = True
113
125
 
114
126
  store_kwargs: dict[str, object] = {
115
127
  "endpoint": endpoint_url,
@@ -23,7 +23,7 @@ logger = logging.getLogger(__name__)
23
23
 
24
24
  def upload_bigfile(file: BigFile, credentials: "BigFileUploadGrant", datalayer: "DataLayer") -> str:
25
25
  """Write ``file`` to the object its grant names, synchronously. Returns the store id."""
26
- store = create_s3_store(datalayer.endpoint_url, credentials, proxy=datalayer.proxy)
26
+ store = create_s3_store(datalayer.endpoint_url, credentials, proxy=datalayer.proxy, certificates=datalayer.certificates)
27
27
  try:
28
28
  obstore.put(store, credentials.key, file.value)
29
29
  except Exception as e:
@@ -35,7 +35,7 @@ def upload_bigfile(file: BigFile, credentials: "BigFileUploadGrant", datalayer:
35
35
  async def aupload_bigfile(file: BigFile, credentials: "BigFileUploadGrant", datalayer: "DataLayer") -> str:
36
36
  """Write ``file`` to the object its grant names. Returns the store id."""
37
37
  endpoint_url = await datalayer.get_endpoint_url()
38
- store = create_s3_store(endpoint_url, credentials, proxy=datalayer.proxy)
38
+ store = create_s3_store(endpoint_url, credentials, proxy=datalayer.proxy, certificates=datalayer.certificates)
39
39
  try:
40
40
  await obstore.put_async(store, credentials.key, file.value)
41
41
  except Exception as e:
@@ -13,11 +13,11 @@ 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>=5.0",
16
+ "arkitekt-spec>=12.9",
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.
20
- "obstore>=0.10.0",
20
+ "obstore>=0.11.0",
21
21
  ]
22
22
 
23
23
  [project.optional-dependencies]
@@ -79,11 +79,15 @@ extend-ignore = ["UP037", "UP038", "UP042"]
79
79
 
80
80
  [tool.ruff.lint.per-file-ignores]
81
81
  "kraph/api/schema.py" = ["UP035"]
82
+ # `_tested.json` is written by the integration tests (the server version they ran against)
83
+ # and is not in git: named as an artifact, on both, it is shipped all the same.
82
84
  [tool.hatch.build.targets.sdist]
83
85
  include = ["kraph"]
86
+ artifacts = ["kraph/_tested.json"]
84
87
 
85
88
  [tool.hatch.build.targets.wheel]
86
89
  include = ["kraph"]
90
+ artifacts = ["kraph/_tested.json"]
87
91
 
88
92
 
89
93
  [build-system]
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