kraph 7.1.0__tar.gz → 7.1.1__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 (31) hide show
  1. {kraph-7.1.0 → kraph-7.1.1}/PKG-INFO +2 -2
  2. {kraph-7.1.0 → kraph-7.1.1}/kraph/datalayer.py +2 -6
  3. {kraph-7.1.0 → kraph-7.1.1}/kraph/io/download.py +2 -2
  4. {kraph-7.1.0 → kraph-7.1.1}/kraph/io/obstore.py +12 -0
  5. {kraph-7.1.0 → kraph-7.1.1}/kraph/io/upload.py +2 -2
  6. {kraph-7.1.0 → kraph-7.1.1}/pyproject.toml +1 -1
  7. {kraph-7.1.0 → kraph-7.1.1}/.gitignore +0 -0
  8. {kraph-7.1.0 → kraph-7.1.1}/README.md +0 -0
  9. {kraph-7.1.0 → kraph-7.1.1}/kraph/__init__.py +0 -0
  10. {kraph-7.1.0 → kraph-7.1.1}/kraph/api/__init__.py +0 -0
  11. {kraph-7.1.0 → kraph-7.1.1}/kraph/api/project.json +0 -0
  12. {kraph-7.1.0 → kraph-7.1.1}/kraph/api/schema.graphql +0 -0
  13. {kraph-7.1.0 → kraph-7.1.1}/kraph/api/schema.py +0 -0
  14. {kraph-7.1.0 → kraph-7.1.1}/kraph/arkitekt.py +0 -0
  15. {kraph-7.1.0 → kraph-7.1.1}/kraph/client.py +0 -0
  16. {kraph-7.1.0 → kraph-7.1.1}/kraph/contrib/fakts/__init__.py +0 -0
  17. {kraph-7.1.0 → kraph-7.1.1}/kraph/errors.py +0 -0
  18. {kraph-7.1.0 → kraph-7.1.1}/kraph/io/__init__.py +0 -0
  19. {kraph-7.1.0 → kraph-7.1.1}/kraph/kraph.py +0 -0
  20. {kraph-7.1.0 → kraph-7.1.1}/kraph/links/__init__.py +0 -0
  21. {kraph-7.1.0 → kraph-7.1.1}/kraph/links/errors.py +0 -0
  22. {kraph-7.1.0 → kraph-7.1.1}/kraph/links/upload.py +0 -0
  23. {kraph-7.1.0 → kraph-7.1.1}/kraph/middleware/__init__.py +0 -0
  24. {kraph-7.1.0 → kraph-7.1.1}/kraph/middleware/base.py +0 -0
  25. {kraph-7.1.0 → kraph-7.1.1}/kraph/middleware/upload.py +0 -0
  26. {kraph-7.1.0 → kraph-7.1.1}/kraph/pairs.py +0 -0
  27. {kraph-7.1.0 → kraph-7.1.1}/kraph/py.typed +0 -0
  28. {kraph-7.1.0 → kraph-7.1.1}/kraph/rath.py +0 -0
  29. {kraph-7.1.0 → kraph-7.1.1}/kraph/refs.py +0 -0
  30. {kraph-7.1.0 → kraph-7.1.1}/kraph/scalars.py +0 -0
  31. {kraph-7.1.0 → kraph-7.1.1}/kraph/traits.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: kraph
3
- Version: 7.1.0
3
+ Version: 7.1.1
4
4
  Summary: the arkitekt knowledge graph
5
5
  Author-email: jhnnsrs <jhnnsrs@gmail.com>
6
6
  License-Expression: GPL-3.0-or-later
@@ -8,7 +8,7 @@ Requires-Python: <4.0,>=3.11
8
8
  Requires-Dist: arkitekt-spec>=5.0
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
@@ -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:
@@ -17,7 +17,7 @@ dependencies = [
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]
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