riffsdk 0.22.0__tar.gz → 0.23.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 (72) hide show
  1. {riffsdk-0.22.0 → riffsdk-0.23.0}/CHANGELOG.md +25 -0
  2. {riffsdk-0.22.0 → riffsdk-0.23.0}/PKG-INFO +1 -1
  3. {riffsdk-0.22.0 → riffsdk-0.23.0}/mise.toml +4 -0
  4. {riffsdk-0.22.0 → riffsdk-0.23.0}/pyproject.toml +1 -1
  5. {riffsdk-0.22.0 → riffsdk-0.23.0}/src/riffsdk/_cli.py +58 -9
  6. {riffsdk-0.22.0 → riffsdk-0.23.0}/src/riffsdk/_internal/transport.py +47 -17
  7. {riffsdk-0.22.0 → riffsdk-0.23.0}/src/riffsdk/ai/v0.py +5 -6
  8. {riffsdk-0.22.0 → riffsdk-0.23.0}/src/riffsdk/storage/__init__.py +2 -0
  9. {riffsdk-0.22.0 → riffsdk-0.23.0}/src/riffsdk/storage/_async_client.py +137 -17
  10. {riffsdk-0.22.0 → riffsdk-0.23.0}/src/riffsdk/storage/_client.py +156 -18
  11. {riffsdk-0.22.0 → riffsdk-0.23.0}/src/riffsdk/storage/_common.py +48 -8
  12. {riffsdk-0.22.0 → riffsdk-0.23.0}/src/riffsdk/storage/_http.py +6 -0
  13. {riffsdk-0.22.0 → riffsdk-0.23.0}/src/riffsdk/storage/_upload.py +10 -0
  14. {riffsdk-0.22.0 → riffsdk-0.23.0}/tests/test_ai_v0.py +20 -0
  15. {riffsdk-0.22.0 → riffsdk-0.23.0}/tests/test_async_client.py +27 -13
  16. {riffsdk-0.22.0 → riffsdk-0.23.0}/tests/test_client.py +39 -25
  17. {riffsdk-0.22.0 → riffsdk-0.23.0}/tests/test_http.py +102 -10
  18. riffsdk-0.23.0/tests/test_importance.py +490 -0
  19. {riffsdk-0.22.0 → riffsdk-0.23.0}/uv.lock +7 -7
  20. {riffsdk-0.22.0 → riffsdk-0.23.0}/.github/workflows/ci.yml +0 -0
  21. {riffsdk-0.22.0 → riffsdk-0.23.0}/.github/workflows/pr-comment.yml +0 -0
  22. {riffsdk-0.22.0 → riffsdk-0.23.0}/.github/workflows/release.yml +0 -0
  23. {riffsdk-0.22.0 → riffsdk-0.23.0}/.gitignore +0 -0
  24. {riffsdk-0.22.0 → riffsdk-0.23.0}/.python-version +0 -0
  25. {riffsdk-0.22.0 → riffsdk-0.23.0}/AGENTS.md +0 -0
  26. {riffsdk-0.22.0 → riffsdk-0.23.0}/CLAUDE.md +0 -0
  27. {riffsdk-0.22.0 → riffsdk-0.23.0}/LICENCE +0 -0
  28. {riffsdk-0.22.0 → riffsdk-0.23.0}/LOCAL-TESTING.md +0 -0
  29. {riffsdk-0.22.0 → riffsdk-0.23.0}/README.md +0 -0
  30. {riffsdk-0.22.0 → riffsdk-0.23.0}/USAGE_PROMPT.md +0 -0
  31. {riffsdk-0.22.0 → riffsdk-0.23.0}/examples/async_client.py +0 -0
  32. {riffsdk-0.22.0 → riffsdk-0.23.0}/examples/basic_crud.py +0 -0
  33. {riffsdk-0.22.0 → riffsdk-0.23.0}/examples/email_notice.py +0 -0
  34. {riffsdk-0.22.0 → riffsdk-0.23.0}/examples/file_upload_download.py +0 -0
  35. {riffsdk-0.22.0 → riffsdk-0.23.0}/examples/get_task.py +0 -0
  36. {riffsdk-0.22.0 → riffsdk-0.23.0}/examples/interpret_document.py +0 -0
  37. {riffsdk-0.22.0 → riffsdk-0.23.0}/examples/optimistic_concurrency.py +0 -0
  38. {riffsdk-0.22.0 → riffsdk-0.23.0}/new-sdk-url-schema.md +0 -0
  39. {riffsdk-0.22.0 → riffsdk-0.23.0}/src/riffsdk/__init__.py +0 -0
  40. {riffsdk-0.22.0 → riffsdk-0.23.0}/src/riffsdk/__main__.py +0 -0
  41. {riffsdk-0.22.0 → riffsdk-0.23.0}/src/riffsdk/_internal/__init__.py +0 -0
  42. {riffsdk-0.22.0 → riffsdk-0.23.0}/src/riffsdk/_internal/auth.py +0 -0
  43. {riffsdk-0.22.0 → riffsdk-0.23.0}/src/riffsdk/_internal/config.py +0 -0
  44. {riffsdk-0.22.0 → riffsdk-0.23.0}/src/riffsdk/ai/__init__.py +0 -0
  45. {riffsdk-0.22.0 → riffsdk-0.23.0}/src/riffsdk/client.py +0 -0
  46. {riffsdk-0.22.0 → riffsdk-0.23.0}/src/riffsdk/context.py +0 -0
  47. {riffsdk-0.22.0 → riffsdk-0.23.0}/src/riffsdk/email/__init__.py +0 -0
  48. {riffsdk-0.22.0 → riffsdk-0.23.0}/src/riffsdk/email/v0.py +0 -0
  49. {riffsdk-0.22.0 → riffsdk-0.23.0}/src/riffsdk/storage/_mime.py +0 -0
  50. {riffsdk-0.22.0 → riffsdk-0.23.0}/src/riffsdk/storage/_models.py +0 -0
  51. {riffsdk-0.22.0 → riffsdk-0.23.0}/src/riffsdk/storage/_session.py +0 -0
  52. {riffsdk-0.22.0 → riffsdk-0.23.0}/src/riffsdk/storage/_streaming.py +0 -0
  53. {riffsdk-0.22.0 → riffsdk-0.23.0}/src/riffsdk/storage/exceptions.py +0 -0
  54. {riffsdk-0.22.0 → riffsdk-0.23.0}/src/riffsdk/storage/py.typed +0 -0
  55. {riffsdk-0.22.0 → riffsdk-0.23.0}/src/riffsdk/tasks/__init__.py +0 -0
  56. {riffsdk-0.22.0 → riffsdk-0.23.0}/src/riffsdk/tasks/v0.py +0 -0
  57. {riffsdk-0.22.0 → riffsdk-0.23.0}/tests/__init__.py +0 -0
  58. {riffsdk-0.22.0 → riffsdk-0.23.0}/tests/conftest.py +0 -0
  59. {riffsdk-0.22.0 → riffsdk-0.23.0}/tests/test_auth.py +0 -0
  60. {riffsdk-0.22.0 → riffsdk-0.23.0}/tests/test_cli.py +0 -0
  61. {riffsdk-0.22.0 → riffsdk-0.23.0}/tests/test_config.py +0 -0
  62. {riffsdk-0.22.0 → riffsdk-0.23.0}/tests/test_context.py +0 -0
  63. {riffsdk-0.22.0 → riffsdk-0.23.0}/tests/test_email_v0.py +0 -0
  64. {riffsdk-0.22.0 → riffsdk-0.23.0}/tests/test_exceptions.py +0 -0
  65. {riffsdk-0.22.0 → riffsdk-0.23.0}/tests/test_imports.py +0 -0
  66. {riffsdk-0.22.0 → riffsdk-0.23.0}/tests/test_integration.py +0 -0
  67. {riffsdk-0.22.0 → riffsdk-0.23.0}/tests/test_mime.py +0 -0
  68. {riffsdk-0.22.0 → riffsdk-0.23.0}/tests/test_models.py +0 -0
  69. {riffsdk-0.22.0 → riffsdk-0.23.0}/tests/test_session.py +0 -0
  70. {riffsdk-0.22.0 → riffsdk-0.23.0}/tests/test_streaming.py +0 -0
  71. {riffsdk-0.22.0 → riffsdk-0.23.0}/tests/test_tasks_v0.py +0 -0
  72. {riffsdk-0.22.0 → riffsdk-0.23.0}/tests/test_upload.py +0 -0
@@ -2,6 +2,31 @@
2
2
 
3
3
  <!-- version list -->
4
4
 
5
+ ## v0.23.0 (2026-10-16)
6
+
7
+ ### Features
8
+
9
+ - Tag files as important with importance/importance_note
10
+ ([#50](https://github.com/databutton/riff-sdk-python/pull/50),
11
+ [`76e6876`](https://github.com/databutton/riff-sdk-python/commit/76e687674be46e7cd93ab085a8d1caf041eb310f))
12
+
13
+
14
+ ## v0.22.1 (2026-09-23)
15
+
16
+ ### Bug Fixes
17
+
18
+ - Add mise setup task ([#46](https://github.com/databutton/riff-sdk-python/pull/46),
19
+ [`360e57b`](https://github.com/databutton/riff-sdk-python/commit/360e57b48e96063300be73c4650d7572fbf9a40e))
20
+
21
+ - Default client could pick up task and session ids from first instantiation
22
+ ([#46](https://github.com/databutton/riff-sdk-python/pull/46),
23
+ [`360e57b`](https://github.com/databutton/riff-sdk-python/commit/360e57b48e96063300be73c4650d7572fbf9a40e))
24
+
25
+ - Resolve session/task headers per request from the bound RiffContext
26
+ ([#46](https://github.com/databutton/riff-sdk-python/pull/46),
27
+ [`360e57b`](https://github.com/databutton/riff-sdk-python/commit/360e57b48e96063300be73c4650d7572fbf9a40e))
28
+
29
+
5
30
  ## v0.22.0 (2026-09-18)
6
31
 
7
32
  ### Features
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: riffsdk
3
- Version: 0.22.0
3
+ Version: 0.23.0
4
4
  Summary: Python SDK for the Riff Storage API
5
5
  Project-URL: Homepage, https://riff.ai
6
6
  Author-email: Martin Sandve Alnæs <msa@databutton.io>
@@ -2,6 +2,10 @@
2
2
  python = "3.11"
3
3
  uv = "latest"
4
4
 
5
+ [tasks.setup]
6
+ description = "Initial package installs etc"
7
+ run = "uv sync --locked --all-groups"
8
+
5
9
  [tasks.test]
6
10
  description = "Run tests"
7
11
  run = "uv run pytest"
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "riffsdk"
7
- version = "0.22.0"
7
+ version = "0.23.0"
8
8
  description = "Python SDK for the Riff Storage API"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -6,9 +6,10 @@ import logging
6
6
  import os
7
7
  import stat
8
8
  import sys
9
- from typing import BinaryIO
9
+ from typing import Any, BinaryIO, get_args
10
10
 
11
11
  from riffsdk.storage._client import StorageClient
12
+ from riffsdk.storage._common import ImportanceCategory, importance_headers
12
13
  from riffsdk.storage._models import Scope
13
14
  from riffsdk.storage.exceptions import (
14
15
  AlreadyExistsError,
@@ -23,6 +24,20 @@ def _die(msg: str, code: int = 1) -> None:
23
24
  sys.exit(code)
24
25
 
25
26
 
27
+ def _importance_kwargs(args: argparse.Namespace) -> dict[str, Any]:
28
+ """The ``importance``/``importance_note`` client kwargs from the CLI flags.
29
+
30
+ Validates up front so a bad combination fails before any transfer starts.
31
+ """
32
+ importance = getattr(args, "importance", None)
33
+ note = getattr(args, "importance_note", None)
34
+ try:
35
+ importance_headers(importance, note)
36
+ except ValueError as e:
37
+ _die(str(e))
38
+ return {"importance": importance, "importance_note": note}
39
+
40
+
26
41
  def _resolve_key(args: argparse.Namespace) -> str:
27
42
  """Resolve a storage key from positional ``key`` or ``-k/--key`` flag.
28
43
 
@@ -150,7 +165,9 @@ def cmd_download(client: StorageClient, args: argparse.Namespace) -> None:
150
165
  if args.stream:
151
166
  if args.output:
152
167
  _die("--output and --stream are mutually exclusive")
153
- for chunk in client.download_stream(key, scope=scope):
168
+ for chunk in client.download_stream(
169
+ key, scope=scope, **_importance_kwargs(args)
170
+ ):
154
171
  sys.stdout.buffer.write(chunk)
155
172
  sys.stdout.buffer.flush()
156
173
  else:
@@ -159,7 +176,13 @@ def cmd_download(client: StorageClient, args: argparse.Namespace) -> None:
159
176
  if parent:
160
177
  os.makedirs(parent, exist_ok=True)
161
178
  progress = _make_progress(os.path.basename(key))
162
- result = client.download_file(key, output, on_progress=progress, scope=scope)
179
+ result = client.download_file(
180
+ key,
181
+ output,
182
+ on_progress=progress,
183
+ scope=scope,
184
+ **_importance_kwargs(args),
185
+ )
163
186
  if args.verbose:
164
187
  sys.stderr.write(
165
188
  f"Downloaded {result.key} ({_format_size(result.size)}, "
@@ -200,6 +223,7 @@ def cmd_upload(client: StorageClient, args: argparse.Namespace) -> None:
200
223
  if_not_exists=if_not_exists,
201
224
  on_progress=progress,
202
225
  scope=scope,
226
+ **_importance_kwargs(args),
203
227
  )
204
228
  if args.verbose:
205
229
  sys.stderr.write(
@@ -227,6 +251,7 @@ def cmd_upload(client: StorageClient, args: argparse.Namespace) -> None:
227
251
  if_not_exists=if_not_exists,
228
252
  on_progress=progress,
229
253
  scope=scope,
254
+ **_importance_kwargs(args),
230
255
  )
231
256
  if args.verbose:
232
257
  sys.stderr.write(
@@ -254,7 +279,13 @@ def cmd_download_dir(client: StorageClient, args: argparse.Namespace) -> None:
254
279
  if parent:
255
280
  os.makedirs(parent, exist_ok=True)
256
281
  progress = _make_progress(rel) if args.verbose else None
257
- client.download_file(obj.key, local_path, on_progress=progress, scope=scope)
282
+ client.download_file(
283
+ obj.key,
284
+ local_path,
285
+ on_progress=progress,
286
+ scope=scope,
287
+ **_importance_kwargs(args),
288
+ )
258
289
  count += 1
259
290
  sys.stderr.write(f" {rel} ({_format_size(obj.size)})\n")
260
291
 
@@ -287,6 +318,7 @@ def cmd_upload_dir(client: StorageClient, args: argparse.Namespace) -> None:
287
318
  content_type=ct,
288
319
  on_progress=progress,
289
320
  scope=scope,
321
+ **_importance_kwargs(args),
290
322
  )
291
323
  count += 1
292
324
  sys.stderr.write(f" {rel}\n")
@@ -346,6 +378,7 @@ def cmd_copy(client: StorageClient, args: argparse.Namespace) -> None:
346
378
  source_scope=source_scope,
347
379
  destination_scope=destination_scope,
348
380
  if_not_exists=if_not_exists,
381
+ **_importance_kwargs(args),
349
382
  )
350
383
  sys.stderr.write(
351
384
  f"Copied {source} -> {meta.key} ({_format_size(meta.size)}, v{meta.version})\n"
@@ -460,12 +493,28 @@ def _build_parser() -> argparse.ArgumentParser:
460
493
  )
461
494
  global_opts.add_argument("--scope", default=None, help="storage scope")
462
495
 
496
+ # Tags the session resource riff-api records for the transfer. Only on the
497
+ # commands that read or write file content.
498
+ importance_opts = argparse.ArgumentParser(add_help=False)
499
+ importance_opts.add_argument(
500
+ "--importance",
501
+ choices=get_args(ImportanceCategory),
502
+ default=None,
503
+ help="mark the file as important to the session: an original input, "
504
+ "a key file during processing, or an output",
505
+ )
506
+ importance_opts.add_argument(
507
+ "--importance-note",
508
+ default=None,
509
+ help='completes "This file is important because ..." (needs --importance)',
510
+ )
511
+
463
512
  sub = parser.add_subparsers(dest="command")
464
513
 
465
514
  # download
466
515
  p = sub.add_parser(
467
516
  "download",
468
- parents=[global_opts],
517
+ parents=[global_opts, importance_opts],
469
518
  help="download a file from storage",
470
519
  )
471
520
  p.add_argument(
@@ -484,7 +533,7 @@ def _build_parser() -> argparse.ArgumentParser:
484
533
  # upload
485
534
  p = sub.add_parser(
486
535
  "upload",
487
- parents=[global_opts],
536
+ parents=[global_opts, importance_opts],
488
537
  help="upload a file to storage",
489
538
  )
490
539
  p.add_argument(
@@ -522,7 +571,7 @@ def _build_parser() -> argparse.ArgumentParser:
522
571
  # download-dir
523
572
  p = sub.add_parser(
524
573
  "download-dir",
525
- parents=[global_opts],
574
+ parents=[global_opts, importance_opts],
526
575
  help="download a directory from storage",
527
576
  )
528
577
  p.add_argument(
@@ -544,7 +593,7 @@ def _build_parser() -> argparse.ArgumentParser:
544
593
  # upload-dir
545
594
  p = sub.add_parser(
546
595
  "upload-dir",
547
- parents=[global_opts],
596
+ parents=[global_opts, importance_opts],
548
597
  help="upload a directory to storage",
549
598
  )
550
599
  p.add_argument(
@@ -591,7 +640,7 @@ def _build_parser() -> argparse.ArgumentParser:
591
640
  # copy
592
641
  p = sub.add_parser(
593
642
  "copy",
594
- parents=[global_opts],
643
+ parents=[global_opts, importance_opts],
595
644
  help="copy a file (server-side, across scopes)",
596
645
  )
597
646
  p.add_argument("source", help="source storage key")
@@ -71,22 +71,16 @@ def resolve_connection_params(
71
71
  task_id: str | None,
72
72
  uds: str | None,
73
73
  ) -> ConnectionParams:
74
+ """Resolve construction-time connection settings.
75
+
76
+ ``session_id``/``task_id`` stay exactly as passed (explicit or ``None``):
77
+ the ambient ids are resolved per request by :func:`resolve_tracking_ids`,
78
+ so a long-lived client (e.g. ``RiffClient.default()``) follows whatever
79
+ context is bound at call time instead of the one bound when it was built.
80
+ """
74
81
  auth, uds = resolve_auth_and_uds(auth, uds)
75
82
  if base_url is None:
76
83
  base_url = default_base_url()
77
- if session_id is None:
78
- session_id = os.environ.get("RIFF_SESSION_ID")
79
- if task_id is None:
80
- task_id = os.environ.get("RIFF_TASK_ID")
81
-
82
- if session_id is None or task_id is None:
83
- ctx = get_context_or_none()
84
- if ctx is not None:
85
- if session_id is None:
86
- session_id = ctx.session_id
87
- if task_id is None:
88
- task_id = ctx.task_id
89
-
90
84
  return ConnectionParams(
91
85
  auth=auth,
92
86
  base_url=base_url,
@@ -96,6 +90,26 @@ def resolve_connection_params(
96
90
  )
97
91
 
98
92
 
93
+ def resolve_tracking_ids(
94
+ session_id: str | None, task_id: str | None
95
+ ) -> tuple[str | None, str | None]:
96
+ """Resolve the session/task id for one request.
97
+
98
+ Precedence per id: the explicit value (a client constructor argument) >
99
+ the bound :class:`~riffsdk.context.RiffContext` > ``RIFF_SESSION_ID``/
100
+ ``RIFF_TASK_ID``. The context beats env because a server binds it per
101
+ call (devx binds the MCP call's session), while env is process-wide.
102
+ """
103
+ ctx = get_context_or_none()
104
+ if session_id is None:
105
+ session_id = (ctx.session_id if ctx else None) or os.environ.get(
106
+ "RIFF_SESSION_ID"
107
+ )
108
+ if task_id is None:
109
+ task_id = (ctx.task_id if ctx else None) or os.environ.get("RIFF_TASK_ID")
110
+ return session_id, task_id
111
+
112
+
99
113
  def tracking_headers(
100
114
  session_id: str | None,
101
115
  task_id: str | None,
@@ -159,7 +173,9 @@ class Transport:
159
173
  self._auth = auth
160
174
  self._base_url = base_url.rstrip("/")
161
175
  self._max_retries = max_retries
162
- headers = tracking_headers(session_id, task_id, client_version=client_version)
176
+ self._session_id = session_id
177
+ self._task_id = task_id
178
+ headers = tracking_headers(None, None, client_version=client_version)
163
179
  transport = httpx.HTTPTransport(uds=uds) if uds else None
164
180
  self._client = httpx.Client(
165
181
  timeout=timeout, headers=headers, transport=transport
@@ -181,6 +197,10 @@ class Transport:
181
197
  def auth(self) -> httpx.Auth | None:
182
198
  return self._auth
183
199
 
200
+ def tracking_ids(self) -> tuple[str | None, str | None]:
201
+ """The session/task id the next request sends, resolved now."""
202
+ return resolve_tracking_ids(self._session_id, self._task_id)
203
+
184
204
  def close(self) -> None:
185
205
  self._client.close()
186
206
 
@@ -207,7 +227,9 @@ class Transport:
207
227
  wrap_transport_error: Callable[[str], Exception] = RetryableTransportError,
208
228
  ) -> httpx.Response:
209
229
  url = f"{self._base_url}{path}"
210
- req_headers = dict(headers) if headers else {}
230
+ # Per-request tracking headers first, so a caller's explicit header
231
+ # (e.g. interpret_document's X-Riff-Session-Id) still wins.
232
+ req_headers = {**tracking_headers(*self.tracking_ids()), **(headers or {})}
211
233
 
212
234
  _log.debug(
213
235
  "%s %s auth=%s",
@@ -265,7 +287,9 @@ class AsyncTransport:
265
287
  self._auth = auth
266
288
  self._base_url = base_url.rstrip("/")
267
289
  self._max_retries = max_retries
268
- headers = tracking_headers(session_id, task_id, client_version=client_version)
290
+ self._session_id = session_id
291
+ self._task_id = task_id
292
+ headers = tracking_headers(None, None, client_version=client_version)
269
293
  transport = httpx.AsyncHTTPTransport(uds=uds) if uds else None
270
294
  self._client = httpx.AsyncClient(
271
295
  timeout=timeout, headers=headers, transport=transport
@@ -287,6 +311,10 @@ class AsyncTransport:
287
311
  def auth(self) -> httpx.Auth | None:
288
312
  return self._auth
289
313
 
314
+ def tracking_ids(self) -> tuple[str | None, str | None]:
315
+ """The session/task id the next request sends, resolved now."""
316
+ return resolve_tracking_ids(self._session_id, self._task_id)
317
+
290
318
  async def close(self) -> None:
291
319
  await self._client.aclose()
292
320
 
@@ -313,7 +341,9 @@ class AsyncTransport:
313
341
  wrap_transport_error: Callable[[str], Exception] = RetryableTransportError,
314
342
  ) -> httpx.Response:
315
343
  url = f"{self._base_url}{path}"
316
- req_headers = dict(headers) if headers else {}
344
+ # Per-request tracking headers first, so a caller's explicit header
345
+ # (e.g. interpret_document's X-Riff-Session-Id) still wins.
346
+ req_headers = {**tracking_headers(*self.tracking_ids()), **(headers or {})}
317
347
 
318
348
  _log.debug(
319
349
  "%s %s auth=%s",
@@ -29,12 +29,10 @@ nothing to share beyond the key::
29
29
 
30
30
  from __future__ import annotations
31
31
 
32
- import os
33
-
34
32
  import httpx
35
33
 
36
34
  from riffsdk._internal.config import sdk_domain_path
37
- from riffsdk._internal.transport import RetryableTransportError
35
+ from riffsdk._internal.transport import RetryableTransportError, resolve_tracking_ids
38
36
  from riffsdk.client import AsyncRiffClient, RiffClient
39
37
  from riffsdk.storage._models import Scope
40
38
 
@@ -89,11 +87,12 @@ def _resolve_scope(scope: Scope) -> tuple[str, str | None]:
89
87
  effective = scope or "project"
90
88
  if effective == "session" or effective.startswith("session:"):
91
89
  _, _, explicit_session_id = effective.partition(":")
92
- session_id = explicit_session_id or os.environ.get("RIFF_SESSION_ID")
90
+ session_id = explicit_session_id or resolve_tracking_ids(None, None)[0]
93
91
  if not session_id:
94
92
  raise ValueError(
95
- "session_id is required when using session scope — "
96
- "pass a session id to session_scope() or set RIFF_SESSION_ID"
93
+ "session_id is required when using session scope — pass a "
94
+ "session id to session_scope(), bind a RiffContext with a "
95
+ "session_id, or set RIFF_SESSION_ID"
97
96
  )
98
97
  return "session", session_id
99
98
  return effective, None
@@ -1,6 +1,7 @@
1
1
  from riffsdk._internal.auth import RiffAuth
2
2
  from riffsdk.storage._async_client import AsyncLease, AsyncStorageClient
3
3
  from riffsdk.storage._client import Lease, StorageClient
4
+ from riffsdk.storage._common import ImportanceCategory
4
5
  from riffsdk.storage._models import (
5
6
  DownloadResult,
6
7
  ListPage,
@@ -36,6 +37,7 @@ __all__ = [
36
37
  "RiffAuth",
37
38
  "AsyncStorageClient",
38
39
  "DownloadResult",
40
+ "ImportanceCategory",
39
41
  "Lease",
40
42
  "ResumableUpload",
41
43
  "Scope",