capo-keyspacesstreams 0.6.0__tar.gz → 0.8.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 (95) hide show
  1. {capo_keyspacesstreams-0.6.0/src/capo_keyspacesstreams.egg-info → capo_keyspacesstreams-0.8.0}/PKG-INFO +10 -2
  2. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/README.md +5 -1
  3. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/pyproject.toml +7 -1
  4. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/__init__.py +12 -0
  5. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/_auth/_providers.py +118 -19
  6. capo_keyspacesstreams-0.8.0/src/capo_keyspacesstreams/types/_unknown.py +34 -0
  7. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/get_records_input.py +1 -3
  8. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/get_shard_iterator_input.py +7 -5
  9. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/get_stream_input.py +1 -3
  10. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/get_stream_output.py +18 -10
  11. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/keyspaces_cell_value.py +12 -1
  12. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/stream.py +4 -6
  13. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0/src/capo_keyspacesstreams.egg-info}/PKG-INFO +10 -2
  14. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams.egg-info/SOURCES.txt +1 -0
  15. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/LICENSE +0 -0
  16. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/setup.cfg +0 -0
  17. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/_async.py +0 -0
  18. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/_auth/_identity.py +0 -0
  19. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/_auth/_signers.py +0 -0
  20. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/_auth/_sigv4.py +0 -0
  21. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/_auth/_zapros_handler.py +0 -0
  22. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/_aws.py +0 -0
  23. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/_body.py +0 -0
  24. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/_iter.py +0 -0
  25. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/_operations/keyspaces_streams/get_records.py +0 -0
  26. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/_operations/keyspaces_streams/get_shard_iterator.py +0 -0
  27. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/_operations/keyspaces_streams/get_stream.py +0 -0
  28. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/_operations/keyspaces_streams/list_streams.py +0 -0
  29. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/_pagination.py +0 -0
  30. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/_protocol/__init__.py +0 -0
  31. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/_protocol/errors.py +0 -0
  32. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/_protocol/eventstream.py +0 -0
  33. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/_protocol/serialize.py +0 -0
  34. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/_protocol/xml.py +0 -0
  35. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/_rule_engine/__init__.py +0 -0
  36. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/_rule_engine/_aws_partition.py +0 -0
  37. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/_rule_engine/_endpoint_rule_set.py +0 -0
  38. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/_rule_engine/_endpoint_runtime.py +0 -0
  39. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/_services/_aws_config.py +0 -0
  40. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/_services/_pipeline.py +0 -0
  41. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/_services/async_keyspaces_streams.py +0 -0
  42. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/_services/keyspaces_streams.py +0 -0
  43. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/errors/__init__.py +0 -0
  44. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/errors/_base.py +0 -0
  45. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/errors/access_denied_exception.py +0 -0
  46. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/errors/internal_server_exception.py +0 -0
  47. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/errors/resource_not_found_exception.py +0 -0
  48. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/errors/throttling_exception.py +0 -0
  49. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/errors/validation_exception.py +0 -0
  50. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/py.typed +0 -0
  51. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/_prelude/blob.py +0 -0
  52. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/_prelude/timestamp.py +0 -0
  53. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/date.py +0 -0
  54. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/get_records_output.py +0 -0
  55. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/get_shard_iterator_output.py +0 -0
  56. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/iterator_description.py +0 -0
  57. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/iterator_position.py +0 -0
  58. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/keyspace_name.py +0 -0
  59. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/keyspaces_cell.py +0 -0
  60. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/keyspaces_cell_list.py +0 -0
  61. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/keyspaces_cell_map.py +0 -0
  62. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/keyspaces_cell_map_definition.py +0 -0
  63. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/keyspaces_cells.py +0 -0
  64. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/keyspaces_keys_map.py +0 -0
  65. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/keyspaces_metadata.py +0 -0
  66. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/keyspaces_row.py +0 -0
  67. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/keyspaces_udt_map.py +0 -0
  68. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/list_streams_input.py +0 -0
  69. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/list_streams_output.py +0 -0
  70. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/origin_type.py +0 -0
  71. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/record.py +0 -0
  72. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/record_list.py +0 -0
  73. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/sequence_number.py +0 -0
  74. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/sequence_number_range.py +0 -0
  75. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/shard.py +0 -0
  76. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/shard_description_list.py +0 -0
  77. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/shard_filter.py +0 -0
  78. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/shard_filter_type.py +0 -0
  79. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/shard_id.py +0 -0
  80. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/shard_id_list.py +0 -0
  81. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/shard_id_token.py +0 -0
  82. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/shard_iterator.py +0 -0
  83. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/shard_iterator_type.py +0 -0
  84. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/stream_arn.py +0 -0
  85. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/stream_arn_token.py +0 -0
  86. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/stream_list.py +0 -0
  87. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/stream_status.py +0 -0
  88. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/stream_view_type.py +0 -0
  89. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/table_name.py +0 -0
  90. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams/types/validation_exception_type.py +0 -0
  91. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams.egg-info/dependency_links.txt +0 -0
  92. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams.egg-info/requires.txt +0 -0
  93. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/src/capo_keyspacesstreams.egg-info/top_level.txt +0 -0
  94. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/tests/test_body.py +0 -0
  95. {capo_keyspacesstreams-0.6.0 → capo_keyspacesstreams-0.8.0}/tests/test_sigv4.py +0 -0
@@ -1,7 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: capo-keyspacesstreams
3
- Version: 0.6.0
3
+ Version: 0.8.0
4
4
  Summary: Python SDK for AWS Keyspacesstreams.
5
+ Project-URL: Homepage, https://capo-sdk.dev/
6
+ Project-URL: Documentation, https://capo-sdk.dev/services/keyspacesstreams/
7
+ Project-URL: Repository, https://github.com/kap-sh/capo/tree/main/services/keyspacesstreams
8
+ Project-URL: Changelog, https://github.com/kap-sh/capo/blob/main/services/keyspacesstreams/CHANGELOG.md
5
9
  Classifier: Development Status :: 4 - Beta
6
10
  Classifier: Intended Audience :: Developers
7
11
  Classifier: License :: OSI Approved :: MIT License
@@ -26,7 +30,11 @@ Requires-Dist: capo-sso-oidc>=0.2.0; extra == "sso"
26
30
  Requires-Dist: capo-sts>=0.3.0; extra == "sso"
27
31
  Dynamic: license-file
28
32
 
29
- # Getting Started
33
+ # capo-keyspacesstreams: typed, async Python SDK for AWS Keyspacesstreams
34
+
35
+ `capo-keyspacesstreams` is a typed Python SDK for AWS Keyspacesstreams. It has an async client, `AsyncKeyspacesStreamsClient`, for asyncio and trio, and a sync client, `KeyspacesStreamsClient`, with the same methods. Requests and responses are typed with TypedDicts, so your editor and type checker know every field.
36
+
37
+ It is part of [capo](https://capo-sdk.dev/), a community-driven alternative to boto3 and aioboto3, built on its own HTTP stack instead of botocore and generated from the official AWS Smithy models. Documentation: [https://capo-sdk.dev/services/keyspacesstreams/](https://capo-sdk.dev/services/keyspacesstreams/)
30
38
 
31
39
  ## Installation
32
40
 
@@ -1,4 +1,8 @@
1
- # Getting Started
1
+ # capo-keyspacesstreams: typed, async Python SDK for AWS Keyspacesstreams
2
+
3
+ `capo-keyspacesstreams` is a typed Python SDK for AWS Keyspacesstreams. It has an async client, `AsyncKeyspacesStreamsClient`, for asyncio and trio, and a sync client, `KeyspacesStreamsClient`, with the same methods. Requests and responses are typed with TypedDicts, so your editor and type checker know every field.
4
+
5
+ It is part of [capo](https://capo-sdk.dev/), a community-driven alternative to boto3 and aioboto3, built on its own HTTP stack instead of botocore and generated from the official AWS Smithy models. Documentation: [https://capo-sdk.dev/services/keyspacesstreams/](https://capo-sdk.dev/services/keyspacesstreams/)
2
6
 
3
7
  ## Installation
4
8
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "capo-keyspacesstreams"
3
- version = "0.6.0"
3
+ version = "0.8.0"
4
4
  description = "Python SDK for AWS Keyspacesstreams."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -22,6 +22,12 @@ dependencies = [
22
22
  "zapros>=0.21.0",
23
23
  ]
24
24
 
25
+ [project.urls]
26
+ Homepage = "https://capo-sdk.dev/"
27
+ Documentation = "https://capo-sdk.dev/services/keyspacesstreams/"
28
+ Repository = "https://github.com/kap-sh/capo/tree/main/services/keyspacesstreams"
29
+ Changelog = "https://github.com/kap-sh/capo/blob/main/services/keyspacesstreams/CHANGELOG.md"
30
+
25
31
  [project.optional-dependencies]
26
32
  # Async file request bodies via Body.async_from_path
27
33
  anyio = ["anyio>=3.0"]
@@ -16,6 +16,9 @@ from ._auth._providers import (
16
16
  from ._auth._providers import (
17
17
  ChainedProvider as ChainedProvider,
18
18
  )
19
+ from ._auth._providers import (
20
+ CredentialProcessError as CredentialProcessError,
21
+ )
19
22
  from ._auth._providers import (
20
23
  CredentialsProvider as CredentialsProvider,
21
24
  )
@@ -31,6 +34,9 @@ from ._auth._providers import (
31
34
  from ._auth._providers import (
32
35
  MissingDependencyError as MissingDependencyError,
33
36
  )
37
+ from ._auth._providers import (
38
+ ProcessCredentialsProvider as ProcessCredentialsProvider,
39
+ )
34
40
  from ._auth._providers import (
35
41
  ProfileCredentialsProvider as ProfileCredentialsProvider,
36
42
  )
@@ -73,3 +79,9 @@ from ._services.async_keyspaces_streams import (
73
79
  from ._services.keyspaces_streams import (
74
80
  KeyspacesStreamsClient as KeyspacesStreamsClient,
75
81
  )
82
+ from .types._unknown import (
83
+ UnknownEvent as UnknownEvent,
84
+ )
85
+ from .types._unknown import (
86
+ UnknownUnionMember as UnknownUnionMember,
87
+ )
@@ -4,6 +4,7 @@ import configparser
4
4
  import hashlib
5
5
  import json
6
6
  import os
7
+ import subprocess
7
8
  import time
8
9
  from abc import abstractmethod
9
10
  from dataclasses import dataclass
@@ -59,6 +60,10 @@ class IdentityNotFound(Exception):
59
60
  """Raised when a provider cannot resolve an identity. Chain continues."""
60
61
 
61
62
 
63
+ class CredentialProcessError(Exception):
64
+ """Raised when a profile's `credential_process` fails or prints unusable output. Chain stops."""
65
+
66
+
62
67
  class MissingDependencyError(Exception):
63
68
  """Raised when a provider needs the `sso` extra but it is not installed."""
64
69
 
@@ -186,13 +191,27 @@ class ProfileCredentialsProvider(CredentialsProvider):
186
191
  self, credentials_file: Path | None = None, profile: str | None = None
187
192
  ) -> None:
188
193
  self._profile = profile or active_profile()
189
- self._cred_file = credentials_file or Path(
190
- os.environ.get("AWS_SHARED_CREDENTIALS_FILE")
191
- or Path.home() / ".aws" / "credentials"
192
- )
194
+ self._cred_file = credentials_file or _shared_credentials_file()
193
195
 
194
196
  def resolve_identity(self) -> Credentials:
195
- section = self._load_section()
197
+ from_config, _ = _load_profile(self._profile)
198
+ from_credentials_file = _credentials_file_section(
199
+ self._profile, self._cred_file
200
+ )
201
+ section = {**from_config, **from_credentials_file}
202
+ if not section:
203
+ raise IdentityNotFound(
204
+ f"profile {self._profile!r} not found in credentials/config files"
205
+ )
206
+ # botocore's order: keys from the credentials file, then credential_process, then keys from the
207
+ # config file, so a profile with a process only takes its keys from the credentials file
208
+ if "credential_process" in section and not (
209
+ from_credentials_file.get("aws_access_key_id")
210
+ and from_credentials_file.get("aws_secret_access_key")
211
+ ):
212
+ raise IdentityNotFound(
213
+ f"profile {self._profile!r}: credential_process comes before the keys in the config file"
214
+ )
196
215
  ak = section.get("aws_access_key_id")
197
216
  sk = section.get("aws_secret_access_key")
198
217
  if not ak or not sk:
@@ -205,19 +224,94 @@ class ProfileCredentialsProvider(CredentialsProvider):
205
224
  out["session_token"] = token
206
225
  return out
207
226
 
208
- def _load_section(self) -> dict[str, str]:
209
- # config-file profile reuses the loader from _services/_aws_config
210
- merged, _ = _load_profile(self._profile)
211
- if self._cred_file.is_file():
212
- cfg = configparser.ConfigParser(interpolation=None)
213
- cfg.read(self._cred_file)
214
- if cfg.has_section(self._profile):
215
- merged.update(dict(cfg.items(self._profile)))
216
- if not merged:
217
- raise IdentityNotFound(
218
- f"profile {self._profile!r} not found in credentials/config files"
227
+
228
+ class ProcessCredentialsProvider(CredentialsProvider):
229
+ """Run the profile's ``credential_process`` command and read the credentials it prints.
230
+
231
+ This is how helpers such as ``aws-sso-cli`` hand out short-term credentials. The command
232
+ runs through the system shell, as in the Rust, Kotlin and Swift SDKs, so a quoted Windows path
233
+ works as written, and it must print the JSON document the AWS SDKs define (``Version`` 1).
234
+ The key is read from the credentials file as well as the config file. A profile without
235
+ ``credential_process`` is skipped; a command that fails or outlives the timeout stops the chain.
236
+ """
237
+
238
+ def __init__(
239
+ self,
240
+ credentials_file: Path | None = None,
241
+ profile: str | None = None,
242
+ timeout: float = 60.0,
243
+ ) -> None:
244
+ self._profile = profile or active_profile()
245
+ self._cred_file = credentials_file or _shared_credentials_file()
246
+ self._timeout = timeout
247
+
248
+ def resolve_identity(self) -> Credentials:
249
+ section = _load_merged_profile(self._profile, self._cred_file)
250
+ command = section.get("credential_process")
251
+ if not command:
252
+ raise IdentityNotFound(f"profile {self._profile!r}: no credential_process")
253
+ try:
254
+ # the shell is sh -c on POSIX and cmd.exe /c on Windows, which parses the path natively
255
+ result = subprocess.run(
256
+ command,
257
+ shell=True,
258
+ capture_output=True,
259
+ text=True,
260
+ check=False,
261
+ timeout=self._timeout,
262
+ )
263
+ except subprocess.TimeoutExpired:
264
+ raise CredentialProcessError(
265
+ f"profile {self._profile!r}: credential_process did not finish within {self._timeout} seconds"
266
+ ) from None
267
+ except OSError as e:
268
+ raise CredentialProcessError(f"profile {self._profile!r}: {e}") from e
269
+ # stdout carries the secret, so only stderr ever goes into an error message
270
+ if result.returncode != 0:
271
+ raise CredentialProcessError(
272
+ f"profile {self._profile!r}: credential_process exited with {result.returncode}: {result.stderr.strip()}"
273
+ )
274
+ try:
275
+ data = json.loads(result.stdout)
276
+ except ValueError:
277
+ raise CredentialProcessError(
278
+ f"profile {self._profile!r}: credential_process did not print JSON"
279
+ ) from None
280
+ if not isinstance(data, dict) or data.get("Version") != 1:
281
+ raise CredentialProcessError(
282
+ f"profile {self._profile!r}: credential_process output must be a JSON object with Version 1"
219
283
  )
220
- return merged
284
+ try:
285
+ return _credentials_from_json(data, token_key="SessionToken")
286
+ except IdentityNotFound as e:
287
+ raise CredentialProcessError(f"profile {self._profile!r}: {e}") from None
288
+ except ValueError:
289
+ raise CredentialProcessError(
290
+ f"profile {self._profile!r}: credential_process printed an invalid Expiration"
291
+ ) from None
292
+
293
+
294
+ def _shared_credentials_file() -> Path:
295
+ return Path(
296
+ os.environ.get("AWS_SHARED_CREDENTIALS_FILE")
297
+ or Path.home() / ".aws" / "credentials"
298
+ )
299
+
300
+
301
+ def _load_merged_profile(profile: str, credentials_file: Path) -> dict[str, str]:
302
+ """The profile's keys from the config file, overlaid by the credentials file, as the AWS SDKs merge them."""
303
+ # config-file profile reuses the loader from _services/_aws_config
304
+ merged, _ = _load_profile(profile)
305
+ merged.update(_credentials_file_section(profile, credentials_file))
306
+ return merged
307
+
308
+
309
+ def _credentials_file_section(profile: str, credentials_file: Path) -> dict[str, str]:
310
+ if not credentials_file.is_file():
311
+ return {}
312
+ cfg = configparser.ConfigParser(interpolation=None)
313
+ cfg.read(credentials_file)
314
+ return dict(cfg.items(profile)) if cfg.has_section(profile) else {}
221
315
 
222
316
 
223
317
  class EcsContainerCredentialsProvider(CredentialsProvider):
@@ -721,6 +815,7 @@ class AssumeRoleCredentialsProvider(CredentialsProvider):
721
815
  ),
722
816
  SsoCredentialsProvider(self._client, source_profile),
723
817
  ProfileCredentialsProvider(profile=source_profile),
818
+ ProcessCredentialsProvider(profile=source_profile),
724
819
  )
725
820
 
726
821
 
@@ -853,7 +948,10 @@ def _parse_iso8601(value: str) -> datetime:
853
948
  return datetime.fromisoformat(value.replace("Z", "+00:00"))
854
949
 
855
950
 
856
- def _credentials_from_json(data: dict[str, object]) -> Credentials:
951
+ def _credentials_from_json(
952
+ data: dict[str, object], *, token_key: str = "Token"
953
+ ) -> Credentials:
954
+ # ECS and IMDS name the session token Token; credential_process names it SessionToken
857
955
  ak = data.get("AccessKeyId")
858
956
  sk = data.get("SecretAccessKey")
859
957
  if not isinstance(ak, str) or not isinstance(sk, str):
@@ -861,7 +959,7 @@ def _credentials_from_json(data: dict[str, object]) -> Credentials:
861
959
  "credentials response missing AccessKeyId/SecretAccessKey"
862
960
  )
863
961
  out: Credentials = {"access_key": ak, "secret_key": sk}
864
- token = data.get("Token")
962
+ token = data.get(token_key)
865
963
  if isinstance(token, str):
866
964
  out["session_token"] = token
867
965
  exp = data.get("Expiration")
@@ -880,6 +978,7 @@ def default_aws_credentials_chain(
880
978
  WebIdentityCredentialsProvider(client),
881
979
  SsoCredentialsProvider(client),
882
980
  ProfileCredentialsProvider(),
981
+ ProcessCredentialsProvider(),
883
982
  EcsContainerCredentialsProvider(client),
884
983
  Ec2InstanceMetadataProvider(client),
885
984
  )
@@ -0,0 +1,34 @@
1
+ """Stand-ins for union variants and events this client doesn't know about.
2
+
3
+ A service may add a union member or an event after the client was generated.
4
+ Smithy asks clients not to fail on those, so deserialization returns one of
5
+ these instead of raising.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ from dataclasses import dataclass
11
+
12
+ from .._protocol.eventstream import Message
13
+
14
+
15
+ @dataclass(frozen=True)
16
+ class UnknownUnionMember:
17
+ """A union variant the service sent that this client has no member for."""
18
+
19
+ name: str
20
+ """The variant's name on the wire."""
21
+
22
+
23
+ @dataclass(frozen=True)
24
+ class UnknownEvent:
25
+ """An event-stream event whose ``:event-type`` this client doesn't know."""
26
+
27
+ event_type: str
28
+ """The event's ``:event-type`` header."""
29
+
30
+ message: Message
31
+ """The raw message, headers and undecoded payload."""
32
+
33
+
34
+ __all__ = ["UnknownEvent", "UnknownUnionMember"]
@@ -4,8 +4,6 @@ from typing import TYPE_CHECKING
4
4
 
5
5
  from typing_extensions import NotRequired, TypedDict
6
6
 
7
- from capo_keyspacesstreams.errors import DeserializationError
8
-
9
7
  if TYPE_CHECKING:
10
8
  import capo_keyspacesstreams.types.shard_iterator
11
9
 
@@ -31,7 +29,7 @@ def deserialize_aws_json_1_0(data: dict) -> GetRecordsInput:
31
29
  if data.get("shardIterator") is not None:
32
30
  out["shard_iterator"] = data["shardIterator"]
33
31
  else:
34
- raise DeserializationError("GetRecordsInput.shard_iterator required")
32
+ out["shard_iterator"] = ""
35
33
  if data.get("maxResults") is not None:
36
34
  out["max_results"] = data["maxResults"]
37
35
  return out
@@ -4,8 +4,6 @@ from typing import TYPE_CHECKING
4
4
 
5
5
  from typing_extensions import NotRequired, TypedDict
6
6
 
7
- from capo_keyspacesstreams.errors import DeserializationError
8
-
9
7
  if TYPE_CHECKING:
10
8
  import capo_keyspacesstreams.types.sequence_number
11
9
  import capo_keyspacesstreams.types.shard_id
@@ -50,11 +48,11 @@ def deserialize_aws_json_1_0(data: dict) -> GetShardIteratorInput:
50
48
  if data.get("streamArn") is not None:
51
49
  out["stream_arn"] = data["streamArn"]
52
50
  else:
53
- raise DeserializationError("GetShardIteratorInput.stream_arn required")
51
+ out["stream_arn"] = ""
54
52
  if data.get("shardId") is not None:
55
53
  out["shard_id"] = data["shardId"]
56
54
  else:
57
- raise DeserializationError("GetShardIteratorInput.shard_id required")
55
+ out["shard_id"] = ""
58
56
  if data.get("shardIteratorType") is not None:
59
57
  import capo_keyspacesstreams.types.shard_iterator_type
60
58
 
@@ -64,7 +62,11 @@ def deserialize_aws_json_1_0(data: dict) -> GetShardIteratorInput:
64
62
  )
65
63
  )
66
64
  else:
67
- raise DeserializationError("GetShardIteratorInput.shard_iterator_type required")
65
+ import typing
66
+
67
+ out["shard_iterator_type"] = typing.cast(
68
+ "capo_keyspacesstreams.types.shard_iterator_type.ShardIteratorType", ""
69
+ )
68
70
  if data.get("sequenceNumber") is not None:
69
71
  out["sequence_number"] = data["sequenceNumber"]
70
72
  return out
@@ -4,8 +4,6 @@ from typing import TYPE_CHECKING
4
4
 
5
5
  from typing_extensions import NotRequired, TypedDict
6
6
 
7
- from capo_keyspacesstreams.errors import DeserializationError
8
-
9
7
  if TYPE_CHECKING:
10
8
  import capo_keyspacesstreams.types.shard_filter
11
9
  import capo_keyspacesstreams.types.shard_id_token
@@ -47,7 +45,7 @@ def deserialize_aws_json_1_0(data: dict) -> GetStreamInput:
47
45
  if data.get("streamArn") is not None:
48
46
  out["stream_arn"] = data["streamArn"]
49
47
  else:
50
- raise DeserializationError("GetStreamInput.stream_arn required")
48
+ out["stream_arn"] = ""
51
49
  if data.get("maxResults") is not None:
52
50
  out["max_results"] = data["maxResults"]
53
51
  if data.get("shardFilter") is not None:
@@ -4,8 +4,6 @@ from typing import TYPE_CHECKING
4
4
 
5
5
  from typing_extensions import NotRequired, TypedDict
6
6
 
7
- from capo_keyspacesstreams.errors import DeserializationError
8
-
9
7
  if TYPE_CHECKING:
10
8
  import capo_keyspacesstreams.types.date
11
9
  import capo_keyspacesstreams.types.keyspace_name
@@ -86,11 +84,11 @@ def deserialize_aws_json_1_0(data: dict) -> GetStreamOutput:
86
84
  if data.get("streamArn") is not None:
87
85
  out["stream_arn"] = data["streamArn"]
88
86
  else:
89
- raise DeserializationError("GetStreamOutput.stream_arn required")
87
+ out["stream_arn"] = ""
90
88
  if data.get("streamLabel") is not None:
91
89
  out["stream_label"] = data["streamLabel"]
92
90
  else:
93
- raise DeserializationError("GetStreamOutput.stream_label required")
91
+ out["stream_label"] = ""
94
92
  if data.get("streamStatus") is not None:
95
93
  import capo_keyspacesstreams.types.stream_status
96
94
 
@@ -100,7 +98,11 @@ def deserialize_aws_json_1_0(data: dict) -> GetStreamOutput:
100
98
  )
101
99
  )
102
100
  else:
103
- raise DeserializationError("GetStreamOutput.stream_status required")
101
+ import typing
102
+
103
+ out["stream_status"] = typing.cast(
104
+ "capo_keyspacesstreams.types.stream_status.StreamStatus", ""
105
+ )
104
106
  if data.get("streamViewType") is not None:
105
107
  import capo_keyspacesstreams.types.stream_view_type
106
108
 
@@ -110,7 +112,11 @@ def deserialize_aws_json_1_0(data: dict) -> GetStreamOutput:
110
112
  )
111
113
  )
112
114
  else:
113
- raise DeserializationError("GetStreamOutput.stream_view_type required")
115
+ import typing
116
+
117
+ out["stream_view_type"] = typing.cast(
118
+ "capo_keyspacesstreams.types.stream_view_type.StreamViewType", ""
119
+ )
114
120
  if data.get("creationRequestDateTime") is not None:
115
121
  import capo_keyspacesstreams.types.date
116
122
 
@@ -120,17 +126,19 @@ def deserialize_aws_json_1_0(data: dict) -> GetStreamOutput:
120
126
  )
121
127
  )
122
128
  else:
123
- raise DeserializationError(
124
- "GetStreamOutput.creation_request_date_time required"
129
+ import datetime
130
+
131
+ out["creation_request_date_time"] = datetime.datetime.fromtimestamp(
132
+ 0, tz=datetime.timezone.utc
125
133
  )
126
134
  if data.get("keyspaceName") is not None:
127
135
  out["keyspace_name"] = data["keyspaceName"]
128
136
  else:
129
- raise DeserializationError("GetStreamOutput.keyspace_name required")
137
+ out["keyspace_name"] = ""
130
138
  if data.get("tableName") is not None:
131
139
  out["table_name"] = data["tableName"]
132
140
  else:
133
- raise DeserializationError("GetStreamOutput.table_name required")
141
+ out["table_name"] = ""
134
142
  if data.get("shards") is not None:
135
143
  import capo_keyspacesstreams.types.shard_description_list
136
144
 
@@ -5,6 +5,7 @@ from typing import TYPE_CHECKING, TypeAlias
5
5
  from typing_extensions import TypedDict
6
6
 
7
7
  from capo_keyspacesstreams.errors import DeserializationError, SerializationError
8
+ from capo_keyspacesstreams.types._unknown import UnknownUnionMember
8
9
 
9
10
  if TYPE_CHECKING:
10
11
  import capo_keyspacesstreams.types.keyspaces_cell_list
@@ -143,12 +144,17 @@ KeyspacesCellValue: TypeAlias = (
143
144
  | _KeyspacesCellValue_varcharT
144
145
  | _KeyspacesCellValue_varintT
145
146
  | _KeyspacesCellValue_udtT
147
+ | UnknownUnionMember
146
148
  )
147
149
 
148
150
 
149
151
  # --- awsJson1_0 ser/de ---
150
152
  def serialize_aws_json_1_0(value: KeyspacesCellValue) -> dict:
151
- if "asciiT" in value:
153
+ if isinstance(value, UnknownUnionMember):
154
+ raise SerializationError(
155
+ f"KeyspacesCellValue: cannot serialize unknown variant {value.name!r}"
156
+ )
157
+ elif "asciiT" in value:
152
158
  return {"asciiT": value["asciiT"]}
153
159
  elif "bigintT" in value:
154
160
  return {"bigintT": value["bigintT"]}
@@ -330,4 +336,9 @@ def deserialize_aws_json_1_0(data: dict) -> KeyspacesCellValue:
330
336
  )
331
337
  }
332
338
  else:
339
+ name = next(
340
+ (k for k, v in data.items() if v is not None and k != "__type"), None
341
+ )
342
+ if name is not None:
343
+ return UnknownUnionMember(name)
333
344
  raise DeserializationError("KeyspacesCellValue: no recognized variant key")
@@ -4,8 +4,6 @@ from typing import TYPE_CHECKING
4
4
 
5
5
  from typing_extensions import TypedDict
6
6
 
7
- from capo_keyspacesstreams.errors import DeserializationError
8
-
9
7
  if TYPE_CHECKING:
10
8
  import capo_keyspacesstreams.types.keyspace_name
11
9
  import capo_keyspacesstreams.types.stream_arn
@@ -38,17 +36,17 @@ def deserialize_aws_json_1_0(data: dict) -> Stream:
38
36
  if data.get("streamArn") is not None:
39
37
  out["stream_arn"] = data["streamArn"]
40
38
  else:
41
- raise DeserializationError("Stream.stream_arn required")
39
+ out["stream_arn"] = ""
42
40
  if data.get("keyspaceName") is not None:
43
41
  out["keyspace_name"] = data["keyspaceName"]
44
42
  else:
45
- raise DeserializationError("Stream.keyspace_name required")
43
+ out["keyspace_name"] = ""
46
44
  if data.get("tableName") is not None:
47
45
  out["table_name"] = data["tableName"]
48
46
  else:
49
- raise DeserializationError("Stream.table_name required")
47
+ out["table_name"] = ""
50
48
  if data.get("streamLabel") is not None:
51
49
  out["stream_label"] = data["streamLabel"]
52
50
  else:
53
- raise DeserializationError("Stream.stream_label required")
51
+ out["stream_label"] = ""
54
52
  return out
@@ -1,7 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: capo-keyspacesstreams
3
- Version: 0.6.0
3
+ Version: 0.8.0
4
4
  Summary: Python SDK for AWS Keyspacesstreams.
5
+ Project-URL: Homepage, https://capo-sdk.dev/
6
+ Project-URL: Documentation, https://capo-sdk.dev/services/keyspacesstreams/
7
+ Project-URL: Repository, https://github.com/kap-sh/capo/tree/main/services/keyspacesstreams
8
+ Project-URL: Changelog, https://github.com/kap-sh/capo/blob/main/services/keyspacesstreams/CHANGELOG.md
5
9
  Classifier: Development Status :: 4 - Beta
6
10
  Classifier: Intended Audience :: Developers
7
11
  Classifier: License :: OSI Approved :: MIT License
@@ -26,7 +30,11 @@ Requires-Dist: capo-sso-oidc>=0.2.0; extra == "sso"
26
30
  Requires-Dist: capo-sts>=0.3.0; extra == "sso"
27
31
  Dynamic: license-file
28
32
 
29
- # Getting Started
33
+ # capo-keyspacesstreams: typed, async Python SDK for AWS Keyspacesstreams
34
+
35
+ `capo-keyspacesstreams` is a typed Python SDK for AWS Keyspacesstreams. It has an async client, `AsyncKeyspacesStreamsClient`, for asyncio and trio, and a sync client, `KeyspacesStreamsClient`, with the same methods. Requests and responses are typed with TypedDicts, so your editor and type checker know every field.
36
+
37
+ It is part of [capo](https://capo-sdk.dev/), a community-driven alternative to boto3 and aioboto3, built on its own HTTP stack instead of botocore and generated from the official AWS Smithy models. Documentation: [https://capo-sdk.dev/services/keyspacesstreams/](https://capo-sdk.dev/services/keyspacesstreams/)
30
38
 
31
39
  ## Installation
32
40
 
@@ -42,6 +42,7 @@ src/capo_keyspacesstreams/errors/internal_server_exception.py
42
42
  src/capo_keyspacesstreams/errors/resource_not_found_exception.py
43
43
  src/capo_keyspacesstreams/errors/throttling_exception.py
44
44
  src/capo_keyspacesstreams/errors/validation_exception.py
45
+ src/capo_keyspacesstreams/types/_unknown.py
45
46
  src/capo_keyspacesstreams/types/date.py
46
47
  src/capo_keyspacesstreams/types/get_records_input.py
47
48
  src/capo_keyspacesstreams/types/get_records_output.py