diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bef77063a..d0d3163a7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.12", "3.13", "3.14", "3.14t", "3.15"] + python-version: ["3.11", "3.12", "3.13", "3.14", "3.14t", "3.15"] env: # Fail rather than fall back to pure Python if a native extension can't be built. SMITHY_PYTHON_NATIVE_BUILD: always @@ -113,9 +113,9 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest] - # 3.12 builds the abi3 wheel, 3.14t a version-specific free-threaded - # wheel, and 3.15t the abi3t wheel. - python-version: ["3.12", "3.14t", "3.15t"] + # 3.11 and 3.12 build the abi3 wheel (abi3-py311), 3.14t a + # version-specific free-threaded wheel, and 3.15t the abi3t wheel. + python-version: ["3.11", "3.12", "3.14t", "3.15t"] package: [smithy-aws-checksums] env: SMITHY_PYTHON_NATIVE_BUILD: always @@ -181,7 +181,8 @@ jobs: - name: Install uv and set the Python version uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 with: - python-version: "3.12" + # The oldest supported Python. + python-version: "3.11" activate-environment: true enable-cache: true diff --git a/codegen-output-py/api-key-auth-client/.smithy-python-manifest.json b/codegen-output-py/api-key-auth-client/.smithy-python-manifest.json index 4ab6967d4..27bb164da 100644 --- a/codegen-output-py/api-key-auth-client/.smithy-python-manifest.json +++ b/codegen-output-py/api-key-auth-client/.smithy-python-manifest.json @@ -1,16 +1,16 @@ { "files": { "README.md": "0575cdb9dbd9d11ba72c347ebd2cfb1a9e68b50208ce144d07c01e46802e1a10", - "pyproject.toml": "94e3cbb02f22fa0b7c2b081fbbb7a797a151ff4e368303e49f69f95f8ae0c96c", + "pyproject.toml": "fae8ba066bc6730ddd7254a73a3342ce17ea9f50b7d40657a4e646c311cd4682", "src/api_key_auth_client/__init__.py": "c9cc2cd353b5b05a7dce3ad05a0e499c8cb368281e2146219dcff4c269e3a1bb", "src/api_key_auth_client/_private/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "src/api_key_auth_client/_private/endpoints.py": "7d515fe771678e82ddbe07798d6b7e48c25c6c9bec19cec9318deb0bc5064ead", "src/api_key_auth_client/_private/schemas.py": "64ebd9bc142c33fba620c877d1c1e6f3d258a4875ad38dbf905bcaa2505d471d", "src/api_key_auth_client/aio/__init__.py": "01574d80de484082fae6de0f710510098e064007fd330bffd9f2e63efc5e75e6", "src/api_key_auth_client/aio/client.py": "03ff3b33f191c3debf70cd95b37611c6937ecdd21c708ec68a492ca0ca2182fa", - "src/api_key_auth_client/aio/config.py": "5f9cefe2070a5a2a0d69c9fd45c0b2fbff065fdd9e09c4b56fc99db67ec3676d", + "src/api_key_auth_client/aio/config.py": "d7918a51fe3286f35b17499b4a865ab3d8667d6388495eff63d14793cf1af770", "src/api_key_auth_client/client.py": "d5de89636e23b7912a79b21712c5759e8efc98db5501cf05a986996d7471b03b", - "src/api_key_auth_client/config.py": "63a8567780b54a2ffb89e7df6f38b1a2c6d5838fa371f03e32011582ee5ebcff", + "src/api_key_auth_client/config.py": "d033a015884b8a138da6b17bd2247f12dd45cbf9a5b51f3603ffac7e593d39e8", "src/api_key_auth_client/models.py": "a05bc9c5dcb44288446bb6ac4a5c0f98cbd1612adb9fb7cbf935e1401617091f", "src/api_key_auth_client/models.pyi": "8a0650b60d4aa7b90f260cf404e1c67b3014db96f18d837011629eff59725bfb", "src/api_key_auth_client/py.typed": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" diff --git a/codegen-output-py/api-key-auth-client/pyproject.toml b/codegen-output-py/api-key-auth-client/pyproject.toml index 837fb9337..223cc0ed1 100644 --- a/codegen-output-py/api-key-auth-client/pyproject.toml +++ b/codegen-output-py/api-key-auth-client/pyproject.toml @@ -5,7 +5,7 @@ name = "api_key_auth_client" version = "0.0.1" description = "Python client for the API key auth fixture" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", "api_key_auth_client"] license = {text = "Apache-2.0"} dependencies = [ @@ -28,7 +28,7 @@ packages = [ typeCheckingMode = "strict" [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/codegen-output-py/api-key-auth-client/src/api_key_auth_client/aio/config.py b/codegen-output-py/api-key-auth-client/src/api_key_auth_client/aio/config.py index 4ea9e2359..11946f1e0 100644 --- a/codegen-output-py/api-key-auth-client/src/api_key_auth_client/aio/config.py +++ b/codegen-output-py/api-key-auth-client/src/api_key_auth_client/aio/config.py @@ -1,6 +1,6 @@ from collections.abc import Callable from dataclasses import dataclass -from typing import Any, cast +from typing import Any, TypeAlias, cast from smithy_core.aio.interfaces import AsyncClientTransport, AsyncEndpointResolver from smithy_core.aio.interfaces.auth import AsyncAuthScheme @@ -118,5 +118,5 @@ def set_auth_scheme(self, scheme: AsyncAuthScheme[Any, Any, Any, Any]) -> None: self.auth_schemes[scheme.scheme_id] = scheme -type Plugin = Callable[[AsyncConfig], None] +Plugin: TypeAlias = Callable[[AsyncConfig], None] "A callable that customizes the client configuration." diff --git a/codegen-output-py/api-key-auth-client/src/api_key_auth_client/config.py b/codegen-output-py/api-key-auth-client/src/api_key_auth_client/config.py index 74922ff65..e1aaa8d44 100644 --- a/codegen-output-py/api-key-auth-client/src/api_key_auth_client/config.py +++ b/codegen-output-py/api-key-auth-client/src/api_key_auth_client/config.py @@ -1,6 +1,6 @@ from collections.abc import Callable from dataclasses import dataclass -from typing import Any, cast +from typing import Any, TypeAlias, cast from smithy_core.auth import DefaultAuthResolver from smithy_core.endpoints import BddEndpointResolver @@ -117,5 +117,5 @@ def set_auth_scheme(self, scheme: AuthScheme[Any, Any, Any, Any]) -> None: self.auth_schemes[scheme.scheme_id] = scheme -type Plugin = Callable[[Config], None] +Plugin: TypeAlias = Callable[[Config], None] "A callable that customizes the client configuration." diff --git a/codegen-output-py/aws-json-1-0/.smithy-python-manifest.json b/codegen-output-py/aws-json-1-0/.smithy-python-manifest.json index 418b42cce..20757bcee 100644 --- a/codegen-output-py/aws-json-1-0/.smithy-python-manifest.json +++ b/codegen-output-py/aws-json-1-0/.smithy-python-manifest.json @@ -1,7 +1,7 @@ { "files": { "README.md": "767e060d5d96f9a0ca03b7855b5c44f45c5b06969c3246b7e7f03fefb92300ec", - "pyproject.toml": "015c1e66e81c31e73cf4eecca096b1f9f6fab83f4627d7c40c0c74f016d3a3d4", + "pyproject.toml": "926530f1035c1e15c1c9ace906a85992335de3eedbeb7ac1ece7b870964816f1", "src/awsjson10/__init__.py": "619a033058229139a02f912a44a6b8997fb35c5af6736d09edd49927876a49dd", "src/awsjson10/_private/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "src/awsjson10/_private/schemas.py": "80a90081368257ec9ab1f1518ac786c6b68191b08bdd591de11899e5510aaeae", diff --git a/codegen-output-py/aws-json-1-0/pyproject.toml b/codegen-output-py/aws-json-1-0/pyproject.toml index 961218f39..36633c830 100644 --- a/codegen-output-py/aws-json-1-0/pyproject.toml +++ b/codegen-output-py/aws-json-1-0/pyproject.toml @@ -5,7 +5,7 @@ name = "awsjson10" version = "0.0.1" description = "Native Python types for the aws-json-1-0 projection" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", "awsjson10"] license = {text = "Apache-2.0"} dependencies = [ @@ -27,7 +27,7 @@ packages = [ typeCheckingMode = "strict" [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/codegen-output-py/aws-json-1-1/.smithy-python-manifest.json b/codegen-output-py/aws-json-1-1/.smithy-python-manifest.json index 2205c1b51..ea15358c5 100644 --- a/codegen-output-py/aws-json-1-1/.smithy-python-manifest.json +++ b/codegen-output-py/aws-json-1-1/.smithy-python-manifest.json @@ -1,7 +1,7 @@ { "files": { "README.md": "c4647f521c7bef71503b8a7d4d6cf0619345113a39bd0f32e683951ab170d284", - "pyproject.toml": "48daaedd63df476c8ae1cf456b7cbd26de6d1556f4efff8a04533bcfbc84a49f", + "pyproject.toml": "90432964885f89dc337a76f15225c1b592edb7a4d1becdcb83873528acec5e9b", "src/awsjson11/__init__.py": "619a033058229139a02f912a44a6b8997fb35c5af6736d09edd49927876a49dd", "src/awsjson11/_private/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "src/awsjson11/_private/schemas.py": "9e4916f6f66be35ae119fad66e5fdbaa277a2d4f4c6b70b29f2b22065636273d", diff --git a/codegen-output-py/aws-json-1-1/pyproject.toml b/codegen-output-py/aws-json-1-1/pyproject.toml index b9d4acb6e..035f89174 100644 --- a/codegen-output-py/aws-json-1-1/pyproject.toml +++ b/codegen-output-py/aws-json-1-1/pyproject.toml @@ -5,7 +5,7 @@ name = "awsjson11" version = "0.0.1" description = "Native Python types for the aws-json-1-1 projection" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", "awsjson11"] license = {text = "Apache-2.0"} dependencies = [ @@ -27,7 +27,7 @@ packages = [ typeCheckingMode = "strict" [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/codegen-output-py/aws-query/.smithy-python-manifest.json b/codegen-output-py/aws-query/.smithy-python-manifest.json index 0d658b9d4..386ec5799 100644 --- a/codegen-output-py/aws-query/.smithy-python-manifest.json +++ b/codegen-output-py/aws-query/.smithy-python-manifest.json @@ -1,7 +1,7 @@ { "files": { "README.md": "34e2e1a81a1bbc2412be2320d53c78a5c9d2557492c0a2a8826d60f7b12888a4", - "pyproject.toml": "393253cb05bfded5a02393b1f94c88b60a74901ba4e6cf3b7b75fb2a2a1ec8dd", + "pyproject.toml": "cedbf580595f06f54294815fea6908f2dd00944a96d8a69d2419944fe3aa98e5", "src/awsquery/__init__.py": "619a033058229139a02f912a44a6b8997fb35c5af6736d09edd49927876a49dd", "src/awsquery/_private/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "src/awsquery/_private/schemas.py": "c38f4206d96ebbbb13b43fb9de87fc8f210e49b2ebb5936213bc1586faaa5f4f", diff --git a/codegen-output-py/aws-query/pyproject.toml b/codegen-output-py/aws-query/pyproject.toml index c1a24ae9c..d3b630191 100644 --- a/codegen-output-py/aws-query/pyproject.toml +++ b/codegen-output-py/aws-query/pyproject.toml @@ -5,7 +5,7 @@ name = "awsquery" version = "0.0.1" description = "Native Python types for the aws-query projection" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", "awsquery"] license = {text = "Apache-2.0"} dependencies = [ @@ -27,7 +27,7 @@ packages = [ typeCheckingMode = "strict" [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/codegen-output-py/ec2-query/.smithy-python-manifest.json b/codegen-output-py/ec2-query/.smithy-python-manifest.json index 8daacc7d0..28bcf5d5f 100644 --- a/codegen-output-py/ec2-query/.smithy-python-manifest.json +++ b/codegen-output-py/ec2-query/.smithy-python-manifest.json @@ -1,7 +1,7 @@ { "files": { "README.md": "88060523405669e4b71bf32d9f2888d510765cf5d1aa0514b652de95144609a1", - "pyproject.toml": "e0809d90933a2cb59f46fb11358c808d44caf077317a0761a4f81c797fc99fde", + "pyproject.toml": "7fd86f1ba9a4f8c4a6962b345757a03f5cc02f75fe896b5bf03697231e4e2e5f", "src/ec2query/__init__.py": "619a033058229139a02f912a44a6b8997fb35c5af6736d09edd49927876a49dd", "src/ec2query/_private/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "src/ec2query/_private/schemas.py": "d5aed93dfd4bcd0e2352724f6390abe866531874f9e6b74ca01c71fc06b99ad1", diff --git a/codegen-output-py/ec2-query/pyproject.toml b/codegen-output-py/ec2-query/pyproject.toml index 868f7354a..e63f1b531 100644 --- a/codegen-output-py/ec2-query/pyproject.toml +++ b/codegen-output-py/ec2-query/pyproject.toml @@ -5,7 +5,7 @@ name = "ec2query" version = "0.0.1" description = "Native Python types for the ec2-query projection" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", "ec2query"] license = {text = "Apache-2.0"} dependencies = [ @@ -27,7 +27,7 @@ packages = [ typeCheckingMode = "strict" [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/codegen-output-py/endpoint-rules-client/.smithy-python-manifest.json b/codegen-output-py/endpoint-rules-client/.smithy-python-manifest.json index 9be605dfe..88265f168 100644 --- a/codegen-output-py/endpoint-rules-client/.smithy-python-manifest.json +++ b/codegen-output-py/endpoint-rules-client/.smithy-python-manifest.json @@ -1,16 +1,16 @@ { "files": { "README.md": "21b6af5d2c11ca92be799a611365291e00be66fee36e0e94876c35ff323358ec", - "pyproject.toml": "0d9158aab01dd1a034aa2bca0a69aa2d247433509c1ebd153b837c95ae79606b", + "pyproject.toml": "609d3abca626ba1bb0bc8253a135f002469e862b2a9704f0e2e607c6319ecfb9", "src/endpoint_rules_client/__init__.py": "f85901beed783e493475b1ccde6669b030eafa7a9b98f796d9a62e3d584e5286", "src/endpoint_rules_client/_private/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "src/endpoint_rules_client/_private/endpoints.py": "f5bec5c0c17f9ec3fab86ea81c1472b1771118e6064f52cbb58cf85d89e09b20", "src/endpoint_rules_client/_private/schemas.py": "804820a7542d2b6df7be9a0e146c17d81ea02eec9e145c056f859e8f6a2c5871", "src/endpoint_rules_client/aio/__init__.py": "9d803a788ce4051a5e037f67248d7cb3c278781e1bd8380e8a35a67cca039e13", "src/endpoint_rules_client/aio/client.py": "b2b375ec339945500d429023176de2aae003eaf2255df15fa9e317af6834d2ca", - "src/endpoint_rules_client/aio/config.py": "dc2b548541bdec4ccf2757638c7fed7a7cb07d432193a87e465274a8f187e557", + "src/endpoint_rules_client/aio/config.py": "b3206a16fa8593df36acf00d908669db96fc89d42ade81735b444e5d8a33a21d", "src/endpoint_rules_client/client.py": "33e88867c1dcbac308a159a5974db2c7ddcbfebca1728aa789a6ec49b7e30623", - "src/endpoint_rules_client/config.py": "ec161b5e6c5bc00f5f55d3b4f9a41dc52967e6b80240b58ce3dcc0426a00a129", + "src/endpoint_rules_client/config.py": "cb5048fdc84096ad954e6f39fde663ac17ba8c0b3630d1220b233e45ec36a43c", "src/endpoint_rules_client/models.py": "74fd08f8085335f26b9aa7c46696666700a0e71235a3ae666a40139c19a8eb18", "src/endpoint_rules_client/models.pyi": "87c615ea467d648b79ca9bdb0eef29006463720de95f71303a39d908cfc4a277", "src/endpoint_rules_client/py.typed": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", diff --git a/codegen-output-py/endpoint-rules-client/pyproject.toml b/codegen-output-py/endpoint-rules-client/pyproject.toml index 93dcc1f92..42f3ef3e9 100644 --- a/codegen-output-py/endpoint-rules-client/pyproject.toml +++ b/codegen-output-py/endpoint-rules-client/pyproject.toml @@ -5,7 +5,7 @@ name = "endpoint_rules_client" version = "0.0.1" description = "Python client for the endpoint rules fixture" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", "endpoint_rules_client"] license = {text = "Apache-2.0"} dependencies = [ @@ -35,7 +35,7 @@ packages = [ typeCheckingMode = "strict" [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/codegen-output-py/endpoint-rules-client/src/endpoint_rules_client/aio/config.py b/codegen-output-py/endpoint-rules-client/src/endpoint_rules_client/aio/config.py index 4b72802e0..05b6bba8b 100644 --- a/codegen-output-py/endpoint-rules-client/src/endpoint_rules_client/aio/config.py +++ b/codegen-output-py/endpoint-rules-client/src/endpoint_rules_client/aio/config.py @@ -1,6 +1,6 @@ from collections.abc import Callable from dataclasses import dataclass -from typing import Any, cast +from typing import Any, TypeAlias, cast from smithy_core.aio.interfaces import AsyncClientTransport, AsyncEndpointResolver from smithy_core.aio.interfaces.auth import AsyncAuthScheme @@ -98,5 +98,5 @@ def __init__( self.force_path_style = force_path_style -type Plugin = Callable[[AsyncConfig], None] +Plugin: TypeAlias = Callable[[AsyncConfig], None] "A callable that customizes the client configuration." diff --git a/codegen-output-py/endpoint-rules-client/src/endpoint_rules_client/config.py b/codegen-output-py/endpoint-rules-client/src/endpoint_rules_client/config.py index a8706e2b2..4904a7f93 100644 --- a/codegen-output-py/endpoint-rules-client/src/endpoint_rules_client/config.py +++ b/codegen-output-py/endpoint-rules-client/src/endpoint_rules_client/config.py @@ -1,6 +1,6 @@ from collections.abc import Callable from dataclasses import dataclass -from typing import Any, cast +from typing import Any, TypeAlias, cast from smithy_core.auth import DefaultAuthResolver from smithy_core.endpoints import BddEndpointResolver @@ -97,5 +97,5 @@ def __init__( self.force_path_style = force_path_style -type Plugin = Callable[[Config], None] +Plugin: TypeAlias = Callable[[Config], None] "A callable that customizes the client configuration." diff --git a/codegen-output-py/my-handwritten-json-model/.smithy-python-manifest.json b/codegen-output-py/my-handwritten-json-model/.smithy-python-manifest.json index c7f27f55c..1285d21e3 100644 --- a/codegen-output-py/my-handwritten-json-model/.smithy-python-manifest.json +++ b/codegen-output-py/my-handwritten-json-model/.smithy-python-manifest.json @@ -1,7 +1,7 @@ { "files": { "README.md": "b62b9017d3b5f4ac588458f462dcf7da6232f960f8aac1d5ed16a4be3bd34695", - "pyproject.toml": "fd99e271e1a36a59f98e45c6bcd00ed94795312d19a9c5844e334a3b3b2f47a4", + "pyproject.toml": "f2e045c3010edfef211f783fbca310c396a20e5d2f2c3b470f8a605ceb4a6088", "src/my_handwritten_json_model/__init__.py": "619a033058229139a02f912a44a6b8997fb35c5af6736d09edd49927876a49dd", "src/my_handwritten_json_model/_private/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "src/my_handwritten_json_model/_private/schemas.py": "1a1bbc8bafb312919b994a51fc106c76578e1cffa9032fe9bbd9a02c0b102426", diff --git a/codegen-output-py/my-handwritten-json-model/pyproject.toml b/codegen-output-py/my-handwritten-json-model/pyproject.toml index 33bfc4edc..f3711b544 100644 --- a/codegen-output-py/my-handwritten-json-model/pyproject.toml +++ b/codegen-output-py/my-handwritten-json-model/pyproject.toml @@ -5,7 +5,7 @@ name = "my_handwritten_json_model" version = "0.0.1" description = "Native Python types for the my-handwritten-json-model projection" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", "my_handwritten_json_model"] license = {text = "Apache-2.0"} dependencies = [ @@ -27,7 +27,7 @@ packages = [ typeCheckingMode = "strict" [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/codegen-output-py/my-handwritten-model/.smithy-python-manifest.json b/codegen-output-py/my-handwritten-model/.smithy-python-manifest.json index 39b5e7cb3..51b325468 100644 --- a/codegen-output-py/my-handwritten-model/.smithy-python-manifest.json +++ b/codegen-output-py/my-handwritten-model/.smithy-python-manifest.json @@ -1,7 +1,7 @@ { "files": { "README.md": "47dc0fb73aa8673141f1fcde44fa3ba3995be83953b41c4f26e3ceb5c5b3ffda", - "pyproject.toml": "7f629f025f463d2e7dc967cab569cc3c0e61c16738eeb1ac5ec0c97561487c10", + "pyproject.toml": "eb4c13e34bc0c00775f607f7bc86902f81fadb1c24fb65e6462f29754e6eb999", "src/my_handwritten_model/__init__.py": "619a033058229139a02f912a44a6b8997fb35c5af6736d09edd49927876a49dd", "src/my_handwritten_model/_private/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "src/my_handwritten_model/_private/schemas.py": "dc76275b338c278172c30166e40c964952fdb5e9ae06f49dff33a37a58a39ff7", diff --git a/codegen-output-py/my-handwritten-model/pyproject.toml b/codegen-output-py/my-handwritten-model/pyproject.toml index f5991c5e8..b611bc1a2 100644 --- a/codegen-output-py/my-handwritten-model/pyproject.toml +++ b/codegen-output-py/my-handwritten-model/pyproject.toml @@ -5,7 +5,7 @@ name = "my_handwritten_model" version = "0.0.1" description = "Native Python types for the my-handwritten-model projection" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", "my_handwritten_model"] license = {text = "Apache-2.0"} dependencies = [ @@ -27,7 +27,7 @@ packages = [ typeCheckingMode = "strict" [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/codegen-output-py/non-query-compatible-rpcv2-cbor/.smithy-python-manifest.json b/codegen-output-py/non-query-compatible-rpcv2-cbor/.smithy-python-manifest.json index de014f1ba..9ecdcb4ed 100644 --- a/codegen-output-py/non-query-compatible-rpcv2-cbor/.smithy-python-manifest.json +++ b/codegen-output-py/non-query-compatible-rpcv2-cbor/.smithy-python-manifest.json @@ -1,7 +1,7 @@ { "files": { "README.md": "0596f3af522471b12c17e5e2cb0f2e42bfeb3a7d910ca77e185f1bd493d12764", - "pyproject.toml": "7e8dbe8d60b2f1997c0c204eed60e7550b731c824efd53979df279e59375fe12", + "pyproject.toml": "fd0390e423d31cdef09ae8a7ba5f9dbe54a429c5257a65a5bfc4f7aac75a6542", "src/nonquerycompatiblerpcv2cbor/__init__.py": "619a033058229139a02f912a44a6b8997fb35c5af6736d09edd49927876a49dd", "src/nonquerycompatiblerpcv2cbor/_private/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "src/nonquerycompatiblerpcv2cbor/_private/schemas.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", diff --git a/codegen-output-py/non-query-compatible-rpcv2-cbor/pyproject.toml b/codegen-output-py/non-query-compatible-rpcv2-cbor/pyproject.toml index 0faa7b411..ddfbd3e7b 100644 --- a/codegen-output-py/non-query-compatible-rpcv2-cbor/pyproject.toml +++ b/codegen-output-py/non-query-compatible-rpcv2-cbor/pyproject.toml @@ -5,7 +5,7 @@ name = "nonquerycompatiblerpcv2cbor" version = "0.0.1" description = "Native Python types for the non-query-compatible-rpcv2-cbor projection" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", "nonquerycompatiblerpcv2cbor"] license = {text = "Apache-2.0"} dependencies = [ @@ -27,7 +27,7 @@ packages = [ typeCheckingMode = "strict" [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/codegen-output-py/partitioned-types/.smithy-python-manifest.json b/codegen-output-py/partitioned-types/.smithy-python-manifest.json index 05716e662..7b1a4f236 100644 --- a/codegen-output-py/partitioned-types/.smithy-python-manifest.json +++ b/codegen-output-py/partitioned-types/.smithy-python-manifest.json @@ -1,7 +1,7 @@ { "files": { "README.md": "20221d6b4a6eb9d45105b926f3bf80197e6ed2bdcab748c5f15e9e6e28dd11ec", - "pyproject.toml": "7c77ad886214636fa2a9f6de5d491b190a407f619f3833af880309ce031a6a18", + "pyproject.toml": "4da8172fbb792a55294b5a9fd51c087aa47b0b6ccedc14bb80958dd358f7ec6b", "src/partitioned_types/__init__.py": "27ea4bc5ba93a6fc6e1f11e9784565de24e9249f0d3e77a9e2fb64fa47d11012", "src/partitioned_types/_private/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "src/partitioned_types/_private/models_0.pyi": "43e2d95e8b75e1a63f4a6d7a60ead524045f688617e6433271a82b9d6eec3b95", diff --git a/codegen-output-py/partitioned-types/pyproject.toml b/codegen-output-py/partitioned-types/pyproject.toml index 78976b2f1..2ba1b71ce 100644 --- a/codegen-output-py/partitioned-types/pyproject.toml +++ b/codegen-output-py/partitioned-types/pyproject.toml @@ -5,7 +5,7 @@ name = "partitioned_types" version = "1.0.0" description = "Native schema and model stub partition stress fixture" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", "partitioned_types"] license = {text = "Apache-2.0"} dependencies = [ @@ -27,7 +27,7 @@ packages = [ typeCheckingMode = "strict" [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/codegen-output-py/query-compatible-aws-json-1-0/.smithy-python-manifest.json b/codegen-output-py/query-compatible-aws-json-1-0/.smithy-python-manifest.json index 873ab26e1..997478098 100644 --- a/codegen-output-py/query-compatible-aws-json-1-0/.smithy-python-manifest.json +++ b/codegen-output-py/query-compatible-aws-json-1-0/.smithy-python-manifest.json @@ -1,7 +1,7 @@ { "files": { "README.md": "9d9dc0e09a156d9f7690a98266d5ec9c0644da310a4906a8bf9c01597e72c931", - "pyproject.toml": "1e2b86bff158358e9ee032707c643205859bbbacf0eed1142b17f4579bc5df7e", + "pyproject.toml": "dbe6f094563cfae599a796779c15587527e000734f4757b1bb29fba06e50fd05", "src/querycompatibleawsjson10/__init__.py": "619a033058229139a02f912a44a6b8997fb35c5af6736d09edd49927876a49dd", "src/querycompatibleawsjson10/_private/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "src/querycompatibleawsjson10/_private/schemas.py": "2f50162ef491662b8ce67108211e9e4720c37ba997d4fcdf5c686c7439f1660a", diff --git a/codegen-output-py/query-compatible-aws-json-1-0/pyproject.toml b/codegen-output-py/query-compatible-aws-json-1-0/pyproject.toml index 893b0ca5a..b920c946d 100644 --- a/codegen-output-py/query-compatible-aws-json-1-0/pyproject.toml +++ b/codegen-output-py/query-compatible-aws-json-1-0/pyproject.toml @@ -5,7 +5,7 @@ name = "querycompatibleawsjson10" version = "0.0.1" description = "Native Python types for the query-compatible-aws-json-1-0 projection" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", "querycompatibleawsjson10"] license = {text = "Apache-2.0"} dependencies = [ @@ -27,7 +27,7 @@ packages = [ typeCheckingMode = "strict" [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/codegen-output-py/query-compatible-rpcv2-cbor/.smithy-python-manifest.json b/codegen-output-py/query-compatible-rpcv2-cbor/.smithy-python-manifest.json index 1d7d53b17..e2c0bcb13 100644 --- a/codegen-output-py/query-compatible-rpcv2-cbor/.smithy-python-manifest.json +++ b/codegen-output-py/query-compatible-rpcv2-cbor/.smithy-python-manifest.json @@ -1,7 +1,7 @@ { "files": { "README.md": "ff19aa552a375f526c29baeaea614e7af167dea1461e78941b3375547b5d1e08", - "pyproject.toml": "906b14bcfbaa2a0df2c9703db740492f47092d9b6a3494d3fb8f576f2996b8c2", + "pyproject.toml": "5d3cb537d152e033a290476d7eeeb0996447c38c417039f0193dcef6b2cccbdc", "src/querycompatiblerpcv2cbor/__init__.py": "619a033058229139a02f912a44a6b8997fb35c5af6736d09edd49927876a49dd", "src/querycompatiblerpcv2cbor/_private/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "src/querycompatiblerpcv2cbor/_private/schemas.py": "8bf49b97ee7af64900c0c5c2ebd4a41d740e2fa0a17c1be3f3d8f25a0d7d997c", diff --git a/codegen-output-py/query-compatible-rpcv2-cbor/pyproject.toml b/codegen-output-py/query-compatible-rpcv2-cbor/pyproject.toml index b4f304f92..45089af49 100644 --- a/codegen-output-py/query-compatible-rpcv2-cbor/pyproject.toml +++ b/codegen-output-py/query-compatible-rpcv2-cbor/pyproject.toml @@ -5,7 +5,7 @@ name = "querycompatiblerpcv2cbor" version = "0.0.1" description = "Native Python types for the query-compatible-rpcv2-cbor projection" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", "querycompatiblerpcv2cbor"] license = {text = "Apache-2.0"} dependencies = [ @@ -27,7 +27,7 @@ packages = [ typeCheckingMode = "strict" [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/codegen-output-py/rest-json-1/.smithy-python-manifest.json b/codegen-output-py/rest-json-1/.smithy-python-manifest.json index cfbdba453..4612fbe19 100644 --- a/codegen-output-py/rest-json-1/.smithy-python-manifest.json +++ b/codegen-output-py/rest-json-1/.smithy-python-manifest.json @@ -1,7 +1,7 @@ { "files": { "README.md": "ab6bb388bf358acca8bbf97c7dc3d54def01226a5e189d2b4ab762072b82c2c6", - "pyproject.toml": "21cf8a6cea8de2f645dc1edbb6adf5d5efefef76f930060da2c307e40efd5084", + "pyproject.toml": "132a6c470a0f72fb9941432d60bb7abee9743b75aac5b7c55094b582b5cccf93", "src/restjson/__init__.py": "619a033058229139a02f912a44a6b8997fb35c5af6736d09edd49927876a49dd", "src/restjson/_private/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "src/restjson/_private/schemas.py": "133535695424fa890dd8cefb8f7f9957138813ae689c7d168e79763296813bcb", diff --git a/codegen-output-py/rest-json-1/pyproject.toml b/codegen-output-py/rest-json-1/pyproject.toml index a724b1206..3590cad06 100644 --- a/codegen-output-py/rest-json-1/pyproject.toml +++ b/codegen-output-py/rest-json-1/pyproject.toml @@ -5,7 +5,7 @@ name = "restjson" version = "0.0.1" description = "Native Python types for the rest-json-1 projection" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", "restjson"] license = {text = "Apache-2.0"} dependencies = [ @@ -27,7 +27,7 @@ packages = [ typeCheckingMode = "strict" [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/codegen-output-py/rest-xml-with-namespace/.smithy-python-manifest.json b/codegen-output-py/rest-xml-with-namespace/.smithy-python-manifest.json index c8abb6759..34a706abb 100644 --- a/codegen-output-py/rest-xml-with-namespace/.smithy-python-manifest.json +++ b/codegen-output-py/rest-xml-with-namespace/.smithy-python-manifest.json @@ -1,7 +1,7 @@ { "files": { "README.md": "377281dbc896249f6395f7d63d1c0f4a3f8ed12dbe286778f00717980613ed4b", - "pyproject.toml": "79fabc6612ef976108a5b3950e297429a576c90f9563d1d75528a5bdd92533ff", + "pyproject.toml": "1ce29087c567ec17ff2c19c4e544f01995133038297cc85eeea90e21619d4603", "src/restxmlwithnamespace/__init__.py": "619a033058229139a02f912a44a6b8997fb35c5af6736d09edd49927876a49dd", "src/restxmlwithnamespace/_private/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "src/restxmlwithnamespace/_private/schemas.py": "bf8c282cb66ded22baad30d30ca84e9750c3135022ef1a0854cf4e95dc58c2bf", diff --git a/codegen-output-py/rest-xml-with-namespace/pyproject.toml b/codegen-output-py/rest-xml-with-namespace/pyproject.toml index b82f04a8d..5c16edec7 100644 --- a/codegen-output-py/rest-xml-with-namespace/pyproject.toml +++ b/codegen-output-py/rest-xml-with-namespace/pyproject.toml @@ -5,7 +5,7 @@ name = "restxmlwithnamespace" version = "0.0.1" description = "Native Python types for the rest-xml-with-namespace projection" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", "restxmlwithnamespace"] license = {text = "Apache-2.0"} dependencies = [ @@ -27,7 +27,7 @@ packages = [ typeCheckingMode = "strict" [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/codegen-output-py/rest-xml/.smithy-python-manifest.json b/codegen-output-py/rest-xml/.smithy-python-manifest.json index 5d5a20a06..02b5d1030 100644 --- a/codegen-output-py/rest-xml/.smithy-python-manifest.json +++ b/codegen-output-py/rest-xml/.smithy-python-manifest.json @@ -1,7 +1,7 @@ { "files": { "README.md": "cb00d252893fb299db4c6569ec3abb219e606507fd61b8e45d46cfe0da47d35b", - "pyproject.toml": "545c322d1248cad579f4bbde139bfa7151208354650e401d0914e938b2339956", + "pyproject.toml": "349e940b0183019c62f031941892010ba6da5462cd411d49b9b42065f54e15b8", "src/restxml/__init__.py": "619a033058229139a02f912a44a6b8997fb35c5af6736d09edd49927876a49dd", "src/restxml/_private/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "src/restxml/_private/schemas.py": "5da8157a7bdd634430fd13506e7581cde70a6c5444f618ca6057f883290a046e", diff --git a/codegen-output-py/rest-xml/pyproject.toml b/codegen-output-py/rest-xml/pyproject.toml index b01c81c10..9d25dcc94 100644 --- a/codegen-output-py/rest-xml/pyproject.toml +++ b/codegen-output-py/rest-xml/pyproject.toml @@ -5,7 +5,7 @@ name = "restxml" version = "0.0.1" description = "Native Python types for the rest-xml projection" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", "restxml"] license = {text = "Apache-2.0"} dependencies = [ @@ -27,7 +27,7 @@ packages = [ typeCheckingMode = "strict" [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/codegen-output-py/rpcv2-cbor-client/.smithy-python-manifest.json b/codegen-output-py/rpcv2-cbor-client/.smithy-python-manifest.json index 7840d997e..ccc0cc0c3 100644 --- a/codegen-output-py/rpcv2-cbor-client/.smithy-python-manifest.json +++ b/codegen-output-py/rpcv2-cbor-client/.smithy-python-manifest.json @@ -1,16 +1,16 @@ { "files": { "README.md": "5342d0e6fd3d9d50c76bad8f4c6559812437b588fc964cf42f4f7706d0b327f6", - "pyproject.toml": "53732e2227b62434a68ef88b5470c476791f3720d59e31b89c58c95e0a75e2d4", + "pyproject.toml": "d15a9a6884d6be783a440f0a274266e36eba969f6284bc9039423eaed07795ab", "src/rpcv2cbor_client/__init__.py": "c8267efbae8c45cca2f1c7f4dccc6da6ce3fc6c99488ed58988b0747b85af0c5", "src/rpcv2cbor_client/_private/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "src/rpcv2cbor_client/_private/endpoints.py": "7d515fe771678e82ddbe07798d6b7e48c25c6c9bec19cec9318deb0bc5064ead", "src/rpcv2cbor_client/_private/schemas.py": "cad2513bd74593541b05ebf5f96823205d254ac69b4d5eb075744503cfa8ba81", "src/rpcv2cbor_client/aio/__init__.py": "31ed3d77a0cc3cc768d548990ef7216e9eb278a7161cb34f1f74d3310100f497", "src/rpcv2cbor_client/aio/client.py": "0c1d028b3cbb670a97219aaeed13f21a6fabcee6e5c57313d727aee616b7dc8e", - "src/rpcv2cbor_client/aio/config.py": "2585543e3bcb534f078e97b9d5d41205545f430de575ab859e8c08f6eb8a11e1", + "src/rpcv2cbor_client/aio/config.py": "4d67ca8d2a6b36d1a4ac6af5544bfaf337361a2cc21dbd784af5d45ba6bd8f61", "src/rpcv2cbor_client/client.py": "5db8d2f687a182c4ea67f88a77201a45bf38632d055effdcf3d21b35b6b5f508", - "src/rpcv2cbor_client/config.py": "f59a5615bdd6a588199a73aabd1a5985e5590a56b846676ac914086d24b872aa", + "src/rpcv2cbor_client/config.py": "d15efa52fdeaa328c3346d8579f82a882dc539ab7a670b52ba421d3d18e7f6f3", "src/rpcv2cbor_client/models.py": "4f7443ca5d6a248346c39518734d165e4c6aa272347da8b12938dd4300368681", "src/rpcv2cbor_client/models.pyi": "1034372fafed1220d9ba996c3a50a274c43a6cd8932c7091011fab068078067f", "src/rpcv2cbor_client/py.typed": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" diff --git a/codegen-output-py/rpcv2-cbor-client/pyproject.toml b/codegen-output-py/rpcv2-cbor-client/pyproject.toml index 6b2d8d584..ef92a3296 100644 --- a/codegen-output-py/rpcv2-cbor-client/pyproject.toml +++ b/codegen-output-py/rpcv2-cbor-client/pyproject.toml @@ -5,7 +5,7 @@ name = "rpcv2cbor_client" version = "0.0.1" description = "Python client for the rpcv2-cbor projection" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", "rpcv2cbor_client"] license = {text = "Apache-2.0"} dependencies = [ @@ -28,7 +28,7 @@ packages = [ typeCheckingMode = "strict" [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/codegen-output-py/rpcv2-cbor-client/src/rpcv2cbor_client/aio/config.py b/codegen-output-py/rpcv2-cbor-client/src/rpcv2cbor_client/aio/config.py index 4023e41a0..6fa2b39d6 100644 --- a/codegen-output-py/rpcv2-cbor-client/src/rpcv2cbor_client/aio/config.py +++ b/codegen-output-py/rpcv2-cbor-client/src/rpcv2cbor_client/aio/config.py @@ -1,6 +1,6 @@ from collections.abc import Callable from dataclasses import dataclass -from typing import Any, cast +from typing import Any, TypeAlias, cast from smithy_core.aio.interfaces import AsyncClientTransport, AsyncEndpointResolver from smithy_core.aio.interfaces.auth import AsyncAuthScheme @@ -88,5 +88,5 @@ def __init__( self.transport = transport or AIOHTTPClient() -type Plugin = Callable[[AsyncConfig], None] +Plugin: TypeAlias = Callable[[AsyncConfig], None] "A callable that customizes the client configuration." diff --git a/codegen-output-py/rpcv2-cbor-client/src/rpcv2cbor_client/config.py b/codegen-output-py/rpcv2-cbor-client/src/rpcv2cbor_client/config.py index 516be21fe..f023f2d95 100644 --- a/codegen-output-py/rpcv2-cbor-client/src/rpcv2cbor_client/config.py +++ b/codegen-output-py/rpcv2-cbor-client/src/rpcv2cbor_client/config.py @@ -1,6 +1,6 @@ from collections.abc import Callable from dataclasses import dataclass -from typing import Any, cast +from typing import Any, TypeAlias, cast from smithy_core.auth import DefaultAuthResolver from smithy_core.endpoints import BddEndpointResolver @@ -87,5 +87,5 @@ def __init__( self.transport = transport or Urllib3HTTPClient() -type Plugin = Callable[[Config], None] +Plugin: TypeAlias = Callable[[Config], None] "A callable that customizes the client configuration." diff --git a/codegen-output-py/rpcv2-cbor/.smithy-python-manifest.json b/codegen-output-py/rpcv2-cbor/.smithy-python-manifest.json index 34d1b68a2..b7d33213a 100644 --- a/codegen-output-py/rpcv2-cbor/.smithy-python-manifest.json +++ b/codegen-output-py/rpcv2-cbor/.smithy-python-manifest.json @@ -1,7 +1,7 @@ { "files": { "README.md": "b856f842a89c64e9cb4ff9a7b27607b66029e73b50597d59041db28f4f2b5180", - "pyproject.toml": "2f41e375828958c622ae82a494bcddbc5422d79126232a4b1ed37468d24d72de", + "pyproject.toml": "9c45e84aa1fddc1e41082003564e1e3e2fcd052cf62359b0b7fff34c8084c78a", "src/rpcv2cbor/__init__.py": "619a033058229139a02f912a44a6b8997fb35c5af6736d09edd49927876a49dd", "src/rpcv2cbor/_private/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "src/rpcv2cbor/_private/schemas.py": "2a75caf22b711ae4dec15bba8a4e327b7f8ad6c02b3ff32e539c277847fb395f", diff --git a/codegen-output-py/rpcv2-cbor/pyproject.toml b/codegen-output-py/rpcv2-cbor/pyproject.toml index 95e0909fc..28eb7f358 100644 --- a/codegen-output-py/rpcv2-cbor/pyproject.toml +++ b/codegen-output-py/rpcv2-cbor/pyproject.toml @@ -5,7 +5,7 @@ name = "rpcv2cbor" version = "0.0.1" description = "Native Python types for the rpcv2-cbor projection" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", "rpcv2cbor"] license = {text = "Apache-2.0"} dependencies = [ @@ -27,7 +27,7 @@ packages = [ typeCheckingMode = "strict" [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/codegen-output-py/rpcv2-json-client/.smithy-python-manifest.json b/codegen-output-py/rpcv2-json-client/.smithy-python-manifest.json index 8f8ac4477..600980502 100644 --- a/codegen-output-py/rpcv2-json-client/.smithy-python-manifest.json +++ b/codegen-output-py/rpcv2-json-client/.smithy-python-manifest.json @@ -1,16 +1,16 @@ { "files": { "README.md": "45e418df185f3c97645bb27cde96c23d25862660c4efb7e07daa6f2f4e541833", - "pyproject.toml": "1e092d69b0fb9a1dc14899c713abb013b2a5580725aebcf3c945fc3121baecf7", + "pyproject.toml": "04b79c8408e7a150de568d57b4b959fd2a76a24c3c66f39416f14900ca2c9158", "src/rpcv2json_client/__init__.py": "fa3fa16a23aaa1ad8d7a87a8c5475ac6b82cfeeabb83625ab4d28d3c3f6a0fbe", "src/rpcv2json_client/_private/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "src/rpcv2json_client/_private/endpoints.py": "7d515fe771678e82ddbe07798d6b7e48c25c6c9bec19cec9318deb0bc5064ead", "src/rpcv2json_client/_private/schemas.py": "b52400dc7e9af25614f09ee4efe1e3ac3fe344436901b62109c94724ee0f0fa2", "src/rpcv2json_client/aio/__init__.py": "a24a4208d8da09d3b8662a439db4ae9838585fc27fe431b42aa8dd05ec93c78c", "src/rpcv2json_client/aio/client.py": "d6f1faa50990e24e578d737acce46a7a9ec525f3e3c1e7ce9d2f656ab443b7ef", - "src/rpcv2json_client/aio/config.py": "9a690c07e6d87a5c43e3a139dc7aafd6483a8be111954e096f80d0af37fc73b2", + "src/rpcv2json_client/aio/config.py": "735007101ea15f9582bd0346f892d625d3f93b86bf27f4691fe9d89cf54ef018", "src/rpcv2json_client/client.py": "64460ff50e711ab7d110b482a4c5d14ae4aa82b3e4938e4909a6b711462ee6bb", - "src/rpcv2json_client/config.py": "427d621c929be7cadc23d8a5b2530e39ec5c8b05b04a2403d8e02a2b17efb7c8", + "src/rpcv2json_client/config.py": "0f0a6548ecee41e885a7bacf5004db1ebbe2dd93712353207ad3dee2855ba149", "src/rpcv2json_client/models.py": "94050bb13fbc2a62b3299790c28b270e6f42fb038f77fdd72f54077269a9c9a0", "src/rpcv2json_client/models.pyi": "5f129d34dd7fd48915deb1396753bcd848eda16d5f1c043e988c605216cb4a8f", "src/rpcv2json_client/py.typed": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" diff --git a/codegen-output-py/rpcv2-json-client/pyproject.toml b/codegen-output-py/rpcv2-json-client/pyproject.toml index c86d64f5a..c6a26da28 100644 --- a/codegen-output-py/rpcv2-json-client/pyproject.toml +++ b/codegen-output-py/rpcv2-json-client/pyproject.toml @@ -5,7 +5,7 @@ name = "rpcv2json_client" version = "0.0.1" description = "Python client for the rpcv2-json projection" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", "rpcv2json_client"] license = {text = "Apache-2.0"} dependencies = [ @@ -28,7 +28,7 @@ packages = [ typeCheckingMode = "strict" [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/codegen-output-py/rpcv2-json-client/src/rpcv2json_client/aio/config.py b/codegen-output-py/rpcv2-json-client/src/rpcv2json_client/aio/config.py index 355a3483a..39d5eccca 100644 --- a/codegen-output-py/rpcv2-json-client/src/rpcv2json_client/aio/config.py +++ b/codegen-output-py/rpcv2-json-client/src/rpcv2json_client/aio/config.py @@ -1,6 +1,6 @@ from collections.abc import Callable from dataclasses import dataclass -from typing import Any, cast +from typing import Any, TypeAlias, cast from smithy_core.aio.interfaces import AsyncClientTransport, AsyncEndpointResolver from smithy_core.aio.interfaces.auth import AsyncAuthScheme @@ -88,5 +88,5 @@ def __init__( self.transport = transport or AIOHTTPClient() -type Plugin = Callable[[AsyncConfig], None] +Plugin: TypeAlias = Callable[[AsyncConfig], None] "A callable that customizes the client configuration." diff --git a/codegen-output-py/rpcv2-json-client/src/rpcv2json_client/config.py b/codegen-output-py/rpcv2-json-client/src/rpcv2json_client/config.py index 9f78b3730..a18167b73 100644 --- a/codegen-output-py/rpcv2-json-client/src/rpcv2json_client/config.py +++ b/codegen-output-py/rpcv2-json-client/src/rpcv2json_client/config.py @@ -1,6 +1,6 @@ from collections.abc import Callable from dataclasses import dataclass -from typing import Any, cast +from typing import Any, TypeAlias, cast from smithy_core.auth import DefaultAuthResolver from smithy_core.endpoints import BddEndpointResolver @@ -87,5 +87,5 @@ def __init__( self.transport = transport or Urllib3HTTPClient() -type Plugin = Callable[[Config], None] +Plugin: TypeAlias = Callable[[Config], None] "A callable that customizes the client configuration." diff --git a/codegen-output-py/rpcv2-json/.smithy-python-manifest.json b/codegen-output-py/rpcv2-json/.smithy-python-manifest.json index 1a4430708..1e26a71cf 100644 --- a/codegen-output-py/rpcv2-json/.smithy-python-manifest.json +++ b/codegen-output-py/rpcv2-json/.smithy-python-manifest.json @@ -1,7 +1,7 @@ { "files": { "README.md": "94b31362a2e131ea489a05430091f33d2320726f788873fd27452809a3d6aa6e", - "pyproject.toml": "5868ae6c5dc5eb29a14cb09e34172636035d17f93050bbbfbb0ee6dd949166d6", + "pyproject.toml": "5357a703b320af6234ab391beb30a14c6990449bdb4e2bb06c5eab1083a54199", "src/rpcv2json/__init__.py": "619a033058229139a02f912a44a6b8997fb35c5af6736d09edd49927876a49dd", "src/rpcv2json/_private/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "src/rpcv2json/_private/schemas.py": "c7b5e9c410266bf04829d7654ceb370635fea033c7071f1c4bf2129a31b3ee05", diff --git a/codegen-output-py/rpcv2-json/pyproject.toml b/codegen-output-py/rpcv2-json/pyproject.toml index 190131da6..363936d9e 100644 --- a/codegen-output-py/rpcv2-json/pyproject.toml +++ b/codegen-output-py/rpcv2-json/pyproject.toml @@ -5,7 +5,7 @@ name = "rpcv2json" version = "0.0.1" description = "Native Python types for the rpcv2-json projection" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", "rpcv2json"] license = {text = "Apache-2.0"} dependencies = [ @@ -27,7 +27,7 @@ packages = [ typeCheckingMode = "strict" [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/codegen-output-py/types/.smithy-python-manifest.json b/codegen-output-py/types/.smithy-python-manifest.json index 28d5801d0..fb239f231 100644 --- a/codegen-output-py/types/.smithy-python-manifest.json +++ b/codegen-output-py/types/.smithy-python-manifest.json @@ -1,7 +1,7 @@ { "files": { "README.md": "b070865ebb1dc46192ea8a45f0961e1b0f812dfccd069537cfc04311b3327660", - "pyproject.toml": "7565450fbc245df3daf2f61a7de068d6ad818ebb7c01a149ffa17fc7e933032f", + "pyproject.toml": "d4e10b9c1818146291fca31d836331f5119ec04b03cdc02edf5998f42546ab7b", "src/example_types/__init__.py": "27ea4bc5ba93a6fc6e1f11e9784565de24e9249f0d3e77a9e2fb64fa47d11012", "src/example_types/_private/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "src/example_types/_private/schemas.py": "ef8526008f167b2f927c5f95d0b443400af99a3ff96047a494d7cdfb262b285c", diff --git a/codegen-output-py/types/pyproject.toml b/codegen-output-py/types/pyproject.toml index dd626c477..838d6b329 100644 --- a/codegen-output-py/types/pyproject.toml +++ b/codegen-output-py/types/pyproject.toml @@ -5,7 +5,7 @@ name = "example_types" version = "1.0.0" description = "Example Python codegen output" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", "example_types"] license = {text = "Apache-2.0"} dependencies = [ @@ -27,7 +27,7 @@ packages = [ typeCheckingMode = "strict" [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/codegen-output/aws-json-1-0/pyproject.toml b/codegen-output/aws-json-1-0/pyproject.toml index b3969b8ec..c6fb75f05 100644 --- a/codegen-output/aws-json-1-0/pyproject.toml +++ b/codegen-output/aws-json-1-0/pyproject.toml @@ -5,7 +5,7 @@ name = "awsjson10" version = "0.0.1" description = "Python client for Sample Json 1.0 Protocol Service" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", "awsjson10"] license = {text = "Apache-2.0"} classifiers = [ @@ -17,6 +17,7 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", @@ -58,7 +59,7 @@ enableExperimentalFeatures = true exclude = ["**/models.py"] [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/codegen-output/aws-json-1-0/tests/_typecheck.py b/codegen-output/aws-json-1-0/tests/_typecheck.py index a44958183..3b2cbe3a7 100644 --- a/codegen-output/aws-json-1-0/tests/_typecheck.py +++ b/codegen-output/aws-json-1-0/tests/_typecheck.py @@ -1,6 +1,6 @@ # Code generated by smithy-python-codegen DO NOT EDIT. -from typing import Any +from typing import Any, TypeVar from awsjson10.aio.client import AsyncJSONRPC10Client from awsjson10.client import JSONRPC10Client @@ -152,8 +152,10 @@ _params_21: TopLevelDict = {"dialog": _} _params_22: GreetingStructDict = {} +_T = TypeVar("_T") -def _request[T](form: type[T]) -> T: + +def _request(form: type[_T]) -> _T: raise NotImplementedError diff --git a/codegen-output/aws-json-1-1/pyproject.toml b/codegen-output/aws-json-1-1/pyproject.toml index d86652f5d..944505f48 100644 --- a/codegen-output/aws-json-1-1/pyproject.toml +++ b/codegen-output/aws-json-1-1/pyproject.toml @@ -5,7 +5,7 @@ name = "awsjson11" version = "0.0.1" description = "Python client for Sample Json 1.1 Protocol Service" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", "awsjson11"] license = {text = "Apache-2.0"} classifiers = [ @@ -17,6 +17,7 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", @@ -58,7 +59,7 @@ enableExperimentalFeatures = true exclude = ["**/models.py"] [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/codegen-output/aws-json-1-1/tests/_typecheck.py b/codegen-output/aws-json-1-1/tests/_typecheck.py index 78a80806a..eaf87a7dc 100644 --- a/codegen-output/aws-json-1-1/tests/_typecheck.py +++ b/codegen-output/aws-json-1-1/tests/_typecheck.py @@ -1,6 +1,6 @@ # Code generated by smithy-python-codegen DO NOT EDIT. -from typing import Any +from typing import Any, TypeVar from awsjson11.aio.client import AsyncJsonProtocolClient from awsjson11.client import JsonProtocolClient @@ -147,8 +147,10 @@ _params_22: StructWithJsonNameDict = {} _params_23: GreetingStructDict = {} +_T = TypeVar("_T") -def _request[T](form: type[T]) -> T: + +def _request(form: type[_T]) -> _T: raise NotImplementedError diff --git a/codegen-output/aws-query/pyproject.toml b/codegen-output/aws-query/pyproject.toml index 23075be90..a0340978f 100644 --- a/codegen-output/aws-query/pyproject.toml +++ b/codegen-output/aws-query/pyproject.toml @@ -5,7 +5,7 @@ name = "awsquery" version = "0.0.1" description = "Python client for Sample Query Protocol Service" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", "awsquery"] license = {text = "Apache-2.0"} classifiers = [ @@ -17,6 +17,7 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", @@ -58,7 +59,7 @@ enableExperimentalFeatures = true exclude = ["**/models.py"] [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/codegen-output/aws-query/tests/_typecheck.py b/codegen-output/aws-query/tests/_typecheck.py index 3aa273ffe..f1b7ccfd0 100644 --- a/codegen-output/aws-query/tests/_typecheck.py +++ b/codegen-output/aws-query/tests/_typecheck.py @@ -1,6 +1,6 @@ # Code generated by smithy-python-codegen DO NOT EDIT. -from typing import Any +from typing import Any, TypeVar from awsquery.aio.client import AsyncQueryProtocolClient from awsquery.client import QueryProtocolClient @@ -239,8 +239,10 @@ _params_35: XmlTimestampsInputDict = {} _params_36: GreetingStructDict = {} +_T = TypeVar("_T") -def _request[T](form: type[T]) -> T: + +def _request(form: type[_T]) -> _T: raise NotImplementedError diff --git a/codegen-output/ec2-query/pyproject.toml b/codegen-output/ec2-query/pyproject.toml index d127d1ab2..ad3852613 100644 --- a/codegen-output/ec2-query/pyproject.toml +++ b/codegen-output/ec2-query/pyproject.toml @@ -5,7 +5,7 @@ name = "ec2query" version = "0.0.1" description = "Python client for Sample Ec2 Protocol Service" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", "ec2query"] license = {text = "Apache-2.0"} classifiers = [ @@ -17,6 +17,7 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", @@ -58,7 +59,7 @@ enableExperimentalFeatures = true exclude = ["**/models.py"] [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/codegen-output/ec2-query/tests/_typecheck.py b/codegen-output/ec2-query/tests/_typecheck.py index 9d9d1a88a..d38c78f69 100644 --- a/codegen-output/ec2-query/tests/_typecheck.py +++ b/codegen-output/ec2-query/tests/_typecheck.py @@ -1,6 +1,6 @@ # Code generated by smithy-python-codegen DO NOT EDIT. -from typing import Any +from typing import Any, TypeVar from ec2query.aio.client import AsyncEC2ProtocolClient from ec2query.client import EC2ProtocolClient @@ -187,8 +187,10 @@ _params_26: XmlTimestampsInputDict = {} _params_27: GreetingStructDict = {} +_T = TypeVar("_T") -def _request[T](form: type[T]) -> T: + +def _request(form: type[_T]) -> _T: raise NotImplementedError diff --git a/codegen-output/my-handwritten-json-model/pyproject.toml b/codegen-output/my-handwritten-json-model/pyproject.toml index d269238a1..d59388778 100644 --- a/codegen-output/my-handwritten-json-model/pyproject.toml +++ b/codegen-output/my-handwritten-json-model/pyproject.toml @@ -5,7 +5,7 @@ name = "my_handwritten_json_model" version = "0.0.1" description = "Python client for My Handwritten JSON Model" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", "my_handwritten_json_model"] license = {text = "Apache-2.0"} classifiers = [ @@ -17,6 +17,7 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", @@ -58,7 +59,7 @@ enableExperimentalFeatures = true exclude = ["**/models.py"] [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/codegen-output/my-handwritten-json-model/tests/_typecheck.py b/codegen-output/my-handwritten-json-model/tests/_typecheck.py index 179e3a89f..96d0f2d34 100644 --- a/codegen-output/my-handwritten-json-model/tests/_typecheck.py +++ b/codegen-output/my-handwritten-json-model/tests/_typecheck.py @@ -1,6 +1,6 @@ # Code generated by smithy-python-codegen DO NOT EDIT. -from typing import Any +from typing import Any, TypeVar from my_handwritten_json_model.aio.client import AsyncMyHandwrittenJsonModel from my_handwritten_json_model.client import MyHandwrittenJsonModel @@ -31,8 +31,10 @@ TradeEventStreamOutput() _params_0: TradeEventStreamInputDict = {} +_T = TypeVar("_T") -def _request[T](form: type[T]) -> T: + +def _request(form: type[_T]) -> _T: raise NotImplementedError diff --git a/codegen-output/my-handwritten-model/pyproject.toml b/codegen-output/my-handwritten-model/pyproject.toml index 0d02beff3..0a3f019ff 100644 --- a/codegen-output/my-handwritten-model/pyproject.toml +++ b/codegen-output/my-handwritten-model/pyproject.toml @@ -5,7 +5,7 @@ name = "my_handwritten_model" version = "0.0.1" description = "Python client for My Handwritten Model" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", "my_handwritten_model"] license = {text = "Apache-2.0"} classifiers = [ @@ -17,6 +17,7 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", @@ -58,7 +59,7 @@ enableExperimentalFeatures = true exclude = ["**/models.py"] [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/codegen-output/my-handwritten-model/tests/_typecheck.py b/codegen-output/my-handwritten-model/tests/_typecheck.py index 6b3a0aff4..1b8152edf 100644 --- a/codegen-output/my-handwritten-model/tests/_typecheck.py +++ b/codegen-output/my-handwritten-model/tests/_typecheck.py @@ -1,6 +1,6 @@ # Code generated by smithy-python-codegen DO NOT EDIT. -from typing import Any +from typing import Any, TypeVar from my_handwritten_model.aio.client import AsyncMyHandwrittenModel from my_handwritten_model.client import MyHandwrittenModel @@ -51,8 +51,10 @@ _params_1: SubscribeToEventsInputDict = {} _params_2: TradeEventStreamInputDict = {} +_T = TypeVar("_T") -def _request[T](form: type[T]) -> T: + +def _request(form: type[_T]) -> _T: raise NotImplementedError diff --git a/codegen-output/non-query-compatible-rpcv2-cbor/pyproject.toml b/codegen-output/non-query-compatible-rpcv2-cbor/pyproject.toml index f965f7c12..690e2cb32 100644 --- a/codegen-output/non-query-compatible-rpcv2-cbor/pyproject.toml +++ b/codegen-output/non-query-compatible-rpcv2-cbor/pyproject.toml @@ -5,7 +5,7 @@ name = "nonquerycompatiblerpcv2cbor" version = "0.0.1" description = "Python client for Non Query Compatible RpcV2 Protocol Service" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", "nonquerycompatiblerpcv2cbor"] license = {text = "Apache-2.0"} classifiers = [ @@ -17,6 +17,7 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", @@ -58,7 +59,7 @@ enableExperimentalFeatures = true exclude = ["**/models.py"] [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/codegen-output/non-query-compatible-rpcv2-cbor/tests/_typecheck.py b/codegen-output/non-query-compatible-rpcv2-cbor/tests/_typecheck.py index 916c76f37..4c2c256f0 100644 --- a/codegen-output/non-query-compatible-rpcv2-cbor/tests/_typecheck.py +++ b/codegen-output/non-query-compatible-rpcv2-cbor/tests/_typecheck.py @@ -1,6 +1,6 @@ # Code generated by smithy-python-codegen DO NOT EDIT. -from typing import Any +from typing import Any, TypeVar from nonquerycompatiblerpcv2cbor.aio.client import ( AsyncNonQueryCompatibleRpcV2ProtocolClient, @@ -23,8 +23,10 @@ NonQueryCompatibleOperationOutput() _params_0: NonQueryCompatibleOperationInputDict = {} +_T = TypeVar("_T") -def _request[T](form: type[T]) -> T: + +def _request(form: type[_T]) -> _T: raise NotImplementedError diff --git a/codegen-output/query-compatible-aws-json-1-0/pyproject.toml b/codegen-output/query-compatible-aws-json-1-0/pyproject.toml index 0594086d9..8df70fe58 100644 --- a/codegen-output/query-compatible-aws-json-1-0/pyproject.toml +++ b/codegen-output/query-compatible-aws-json-1-0/pyproject.toml @@ -5,7 +5,7 @@ name = "querycompatibleawsjson10" version = "0.0.1" description = "Python client for Query Compatible Json 1.0 Protocol Service" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", "querycompatibleawsjson10"] license = {text = "Apache-2.0"} classifiers = [ @@ -17,6 +17,7 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", @@ -58,7 +59,7 @@ enableExperimentalFeatures = true exclude = ["**/models.py"] [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/codegen-output/query-compatible-aws-json-1-0/tests/_typecheck.py b/codegen-output/query-compatible-aws-json-1-0/tests/_typecheck.py index 0745fcb7b..fc63d1685 100644 --- a/codegen-output/query-compatible-aws-json-1-0/tests/_typecheck.py +++ b/codegen-output/query-compatible-aws-json-1-0/tests/_typecheck.py @@ -1,6 +1,6 @@ # Code generated by smithy-python-codegen DO NOT EDIT. -from typing import Any +from typing import Any, TypeVar from querycompatibleawsjson10.aio.client import AsyncQueryCompatibleJSONRPC10Client from querycompatibleawsjson10.client import QueryCompatibleJSONRPC10Client @@ -21,8 +21,10 @@ QueryCompatibleOperationOutput() _params_0: QueryCompatibleOperationInputDict = {} +_T = TypeVar("_T") -def _request[T](form: type[T]) -> T: + +def _request(form: type[_T]) -> _T: raise NotImplementedError diff --git a/codegen-output/query-compatible-rpcv2-cbor/pyproject.toml b/codegen-output/query-compatible-rpcv2-cbor/pyproject.toml index 31e1696a8..856c71f7f 100644 --- a/codegen-output/query-compatible-rpcv2-cbor/pyproject.toml +++ b/codegen-output/query-compatible-rpcv2-cbor/pyproject.toml @@ -5,7 +5,7 @@ name = "querycompatiblerpcv2cbor" version = "0.0.1" description = "Python client for Query Compatible RpcV2 Protocol Service" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", "querycompatiblerpcv2cbor"] license = {text = "Apache-2.0"} classifiers = [ @@ -17,6 +17,7 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", @@ -58,7 +59,7 @@ enableExperimentalFeatures = true exclude = ["**/models.py"] [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/codegen-output/query-compatible-rpcv2-cbor/tests/_typecheck.py b/codegen-output/query-compatible-rpcv2-cbor/tests/_typecheck.py index 1f8698b1d..10f876962 100644 --- a/codegen-output/query-compatible-rpcv2-cbor/tests/_typecheck.py +++ b/codegen-output/query-compatible-rpcv2-cbor/tests/_typecheck.py @@ -1,6 +1,6 @@ # Code generated by smithy-python-codegen DO NOT EDIT. -from typing import Any +from typing import Any, TypeVar from querycompatiblerpcv2cbor.aio.client import AsyncQueryCompatibleRpcV2ProtocolClient from querycompatiblerpcv2cbor.client import QueryCompatibleRpcV2ProtocolClient @@ -21,8 +21,10 @@ QueryCompatibleOperationOutput() _params_0: QueryCompatibleOperationInputDict = {} +_T = TypeVar("_T") -def _request[T](form: type[T]) -> T: + +def _request(form: type[_T]) -> _T: raise NotImplementedError diff --git a/codegen-output/rest-json-1/pyproject.toml b/codegen-output/rest-json-1/pyproject.toml index 0d94e3051..57f67329d 100644 --- a/codegen-output/rest-json-1/pyproject.toml +++ b/codegen-output/rest-json-1/pyproject.toml @@ -5,7 +5,7 @@ name = "restjson" version = "0.0.1" description = "Python client for Sample Rest Json Protocol Service" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", "restjson"] license = {text = "Apache-2.0"} classifiers = [ @@ -17,6 +17,7 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", @@ -58,7 +59,7 @@ enableExperimentalFeatures = true exclude = ["**/models.py"] [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/codegen-output/rest-json-1/tests/_typecheck.py b/codegen-output/rest-json-1/tests/_typecheck.py index 87929353c..eb5ed3c5c 100644 --- a/codegen-output/rest-json-1/tests/_typecheck.py +++ b/codegen-output/rest-json-1/tests/_typecheck.py @@ -1,6 +1,6 @@ # Code generated by smithy-python-codegen DO NOT EDIT. -from typing import Any +from typing import Any, TypeVar from restjson.aio.client import AsyncRestJsonProtocolClient from restjson.client import RestJsonProtocolClient @@ -801,8 +801,10 @@ _params_131: GreetingStructDict = {} _params_132: UnitDict = {} +_T = TypeVar("_T") -def _request[T](form: type[T]) -> T: + +def _request(form: type[_T]) -> _T: raise NotImplementedError diff --git a/codegen-output/rest-xml-with-namespace/pyproject.toml b/codegen-output/rest-xml-with-namespace/pyproject.toml index 46bacbd5b..646a7b81e 100644 --- a/codegen-output/rest-xml-with-namespace/pyproject.toml +++ b/codegen-output/rest-xml-with-namespace/pyproject.toml @@ -5,7 +5,7 @@ name = "restxmlwithnamespace" version = "0.0.1" description = "Python client for Sample Rest Xml Protocol Service With Namespace" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", "restxmlwithnamespace"] license = {text = "Apache-2.0"} classifiers = [ @@ -17,6 +17,7 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", @@ -58,7 +59,7 @@ enableExperimentalFeatures = true exclude = ["**/models.py"] [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/codegen-output/rest-xml-with-namespace/tests/_typecheck.py b/codegen-output/rest-xml-with-namespace/tests/_typecheck.py index b2790948d..dc86bc119 100644 --- a/codegen-output/rest-xml-with-namespace/tests/_typecheck.py +++ b/codegen-output/rest-xml-with-namespace/tests/_typecheck.py @@ -1,6 +1,6 @@ # Code generated by smithy-python-codegen DO NOT EDIT. -from typing import Any +from typing import Any, TypeVar from restxmlwithnamespace.aio.client import AsyncRestXmlProtocolNamespaceClient from restxmlwithnamespace.client import RestXmlProtocolNamespaceClient @@ -25,8 +25,10 @@ _params_0: NestedWithNamespaceDict = {} _params_1: SimpleScalarPropertiesInputDict = {} +_T = TypeVar("_T") -def _request[T](form: type[T]) -> T: + +def _request(form: type[_T]) -> _T: raise NotImplementedError diff --git a/codegen-output/rest-xml/pyproject.toml b/codegen-output/rest-xml/pyproject.toml index ad40b0c60..a59f6a9eb 100644 --- a/codegen-output/rest-xml/pyproject.toml +++ b/codegen-output/rest-xml/pyproject.toml @@ -5,7 +5,7 @@ name = "restxml" version = "0.0.1" description = "Python client for Sample Rest Xml Protocol Service" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", "restxml"] license = {text = "Apache-2.0"} classifiers = [ @@ -17,6 +17,7 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", @@ -58,7 +59,7 @@ enableExperimentalFeatures = true exclude = ["**/models.py"] [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/codegen-output/rest-xml/tests/_typecheck.py b/codegen-output/rest-xml/tests/_typecheck.py index 135be6722..f1ee1c7cb 100644 --- a/codegen-output/rest-xml/tests/_typecheck.py +++ b/codegen-output/rest-xml/tests/_typecheck.py @@ -1,6 +1,6 @@ # Code generated by smithy-python-codegen DO NOT EDIT. -from typing import Any +from typing import Any, TypeVar from restxml.aio.client import AsyncRestXmlProtocolClient from restxml.client import RestXmlProtocolClient @@ -480,8 +480,10 @@ _params_77: XmlUnionsInputDict = {} _params_78: GreetingStructDict = {} +_T = TypeVar("_T") -def _request[T](form: type[T]) -> T: + +def _request(form: type[_T]) -> _T: raise NotImplementedError diff --git a/codegen-output/rpcv2-cbor/pyproject.toml b/codegen-output/rpcv2-cbor/pyproject.toml index 30113b76f..53bda2529 100644 --- a/codegen-output/rpcv2-cbor/pyproject.toml +++ b/codegen-output/rpcv2-cbor/pyproject.toml @@ -5,7 +5,7 @@ name = "rpcv2cbor" version = "0.0.1" description = "Python client for RpcV2 Protocol Service" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", "rpcv2cbor"] license = {text = "Apache-2.0"} classifiers = [ @@ -17,6 +17,7 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", @@ -58,7 +59,7 @@ enableExperimentalFeatures = true exclude = ["**/models.py"] [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/codegen-output/rpcv2-cbor/tests/_typecheck.py b/codegen-output/rpcv2-cbor/tests/_typecheck.py index 76d08d412..96b32a471 100644 --- a/codegen-output/rpcv2-cbor/tests/_typecheck.py +++ b/codegen-output/rpcv2-cbor/tests/_typecheck.py @@ -1,6 +1,6 @@ # Code generated by smithy-python-codegen DO NOT EDIT. -from typing import Any +from typing import Any, TypeVar from rpcv2cbor.aio.client import AsyncRpcV2Protocol from rpcv2cbor.client import RpcV2Protocol @@ -131,8 +131,10 @@ _params_20: StructureListMemberDict = {} _params_21: GreetingStructDict = {} +_T = TypeVar("_T") -def _request[T](form: type[T]) -> T: + +def _request(form: type[_T]) -> _T: raise NotImplementedError diff --git a/codegen-output/rpcv2-json/pyproject.toml b/codegen-output/rpcv2-json/pyproject.toml index 8e0409bfa..8457e41c3 100644 --- a/codegen-output/rpcv2-json/pyproject.toml +++ b/codegen-output/rpcv2-json/pyproject.toml @@ -5,7 +5,7 @@ name = "rpcv2json" version = "0.0.1" description = "Python client for RpcV2 JSON Protocol Service" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", "rpcv2json"] license = {text = "Apache-2.0"} classifiers = [ @@ -17,6 +17,7 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", @@ -57,7 +58,7 @@ enableExperimentalFeatures = true exclude = ["**/models.py"] [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/codegen-output/rpcv2-json/tests/_typecheck.py b/codegen-output/rpcv2-json/tests/_typecheck.py index 2cba2454b..296d80345 100644 --- a/codegen-output/rpcv2-json/tests/_typecheck.py +++ b/codegen-output/rpcv2-json/tests/_typecheck.py @@ -1,6 +1,6 @@ # Code generated by smithy-python-codegen DO NOT EDIT. -from typing import Any +from typing import Any, TypeVar from rpcv2json.aio.client import AsyncRpcV2JsonProtocol from rpcv2json.client import RpcV2JsonProtocol @@ -133,8 +133,10 @@ _params_19: TimestampFormatIgnoredInputDict = {} _params_20: GreetingStructDict = {} +_T = TypeVar("_T") -def _request[T](form: type[T]) -> T: + +def _request(form: type[_T]) -> _T: raise NotImplementedError diff --git a/codegen/README.md b/codegen/README.md index 349dab196..c889950f0 100644 --- a/codegen/README.md +++ b/codegen/README.md @@ -11,7 +11,7 @@ clients. #### Optional Prerequisites - Python -* Python 3.12 is required to run the generated code, but not run the generator. +* Python 3.11 or newer is required to run the generated code, but not run the generator. If it is present on the path, the generator will use it for linting and formatting. * Use of a diff --git a/codegen/core/src/main/java/software/amazon/smithy/python/codegen/PythonFormatter.java b/codegen/core/src/main/java/software/amazon/smithy/python/codegen/PythonFormatter.java index fa9b934c1..59c9b8f80 100644 --- a/codegen/core/src/main/java/software/amazon/smithy/python/codegen/PythonFormatter.java +++ b/codegen/core/src/main/java/software/amazon/smithy/python/codegen/PythonFormatter.java @@ -14,7 +14,7 @@ @SmithyInternalApi public final class PythonFormatter implements Runnable { private static final Logger LOGGER = Logger.getLogger(PythonFormatter.class.getName()); - private static final int PYTHON_MINOR_VERSION = 12; // 3.12 + private static final int PYTHON_MINOR_VERSION = 11; // 3.11 private final GenerationContext context; @@ -46,7 +46,7 @@ public void run() { int minorVersion = Integer.parseInt(matcher.group("minor")); if (minorVersion < PYTHON_MINOR_VERSION) { LOGGER.warning(String.format(""" - Found incompatible python version 3.%s.%s, expected 3.12.0 or greater. \ + Found incompatible python version 3.%s.%s, expected 3.11.0 or greater. \ Skipping formatting and type checking.""", matcher.group("minor"), matcher.group("patch"))); diff --git a/codegen/core/src/main/java/software/amazon/smithy/python/codegen/generators/ConformanceTestGenerator.java b/codegen/core/src/main/java/software/amazon/smithy/python/codegen/generators/ConformanceTestGenerator.java index 1b1794832..b91727743 100644 --- a/codegen/core/src/main/java/software/amazon/smithy/python/codegen/generators/ConformanceTestGenerator.java +++ b/codegen/core/src/main/java/software/amazon/smithy/python/codegen/generators/ConformanceTestGenerator.java @@ -186,9 +186,13 @@ private void writeOperationCalls(PythonWriter writer) { } writer.addImport(asyncClient.getNamespace(), asyncClient.getName()); writer.addImport(syncClient.getNamespace(), syncClient.getName()); + writer.addStdlibImport("typing", "TypeVar"); writer.write(""" - def _request[T](form: type[T]) -> T: + _T = TypeVar("_T") + + + def _request(form: type[_T]) -> _T: raise NotImplementedError """); writer.openBlock("async def check_async_calls(client: $L) -> None:", "", asyncClient.getName(), () -> { diff --git a/codegen/core/src/main/java/software/amazon/smithy/python/codegen/generators/SetupGenerator.java b/codegen/core/src/main/java/software/amazon/smithy/python/codegen/generators/SetupGenerator.java index 42f43e69f..73a7290fe 100644 --- a/codegen/core/src/main/java/software/amazon/smithy/python/codegen/generators/SetupGenerator.java +++ b/codegen/core/src/main/java/software/amazon/smithy/python/codegen/generators/SetupGenerator.java @@ -153,7 +153,7 @@ private static void writePyproject( version = $2S description = $3S readme = "README.md" - requires-python = ">=3.12" + requires-python = ">=3.11" keywords = ["smithy", $1S] license = {text = "Apache-2.0"} classifiers = [ @@ -165,6 +165,7 @@ private static void writePyproject( "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", @@ -208,7 +209,7 @@ private static void writePyproject( exclude = ["**/models.py"] [tool.ruff] - target-version = "py312" + target-version = "py311" [tool.ruff.lint] ignore = ["F841"] diff --git a/designs/codegen/symbols.md b/designs/codegen/symbols.md index ead617bdb..f9db917db 100644 --- a/designs/codegen/symbols.md +++ b/designs/codegen/symbols.md @@ -89,7 +89,7 @@ A field or constant that starts with `__` but does not end with `__` gets `___` appended so Python does not mangle it. Enum constants that would be dunder or sunder names get a trailing `_`, because `Enum` does not treat those as members. Append `_` if the result is a reserved Python word. The reserved-word list combines -Python 3.12 through 3.15 so results do not depend on the Python version running +Python 3.11 through 3.15 so results do not depend on the Python version running codegen. Update it when adding support for another Python version. Names such as `match`, `case`, `type` and `lazy` are valid Python field names and do not need a trailing underscore. diff --git a/designs/codegen/writer.md b/designs/codegen/writer.md index fd0668291..2de14bc00 100644 --- a/designs/codegen/writer.md +++ b/designs/codegen/writer.md @@ -68,11 +68,14 @@ symbol provider ensures that declaration and field names are unique. change aliases in the next render. Raw text is trusted Python, not a template. To find names, `render()` parses -the written lines with the Python 3.12 grammar, with a unique placeholder -standing in for each type reference. Lines that are not valid Python 3.12 raise -`CodegenError`, including syntax added in later versions. So do lines that raise -`SyntaxWarning`, such as an invalid escape sequence in `"""Match \d+."""`; -later Python versions will reject them. Callers supply blank lines between +the written lines with the Python 3.11 grammar, with a unique placeholder +standing in for each type reference. Lines that are not valid Python 3.11 raise +`CodegenError`, including syntax added in later versions such as PEP 695 type +parameters and `type` statements. On a Python 3.12+ host this check does not +reject PEP 701 f-strings; generating on Python 3.11, as CI does, does. Lines that +raise `SyntaxWarning` (`DeprecationWarning` under the 3.11 grammar), such as an +invalid escape sequence in `"""Match \d+."""`, also raise `CodegenError`; later +Python versions will reject them. Callers supply blank lines between declarations. The analysis reads the syntax tree rather than `symtable`, whose results change @@ -110,7 +113,7 @@ level: `list[str | None]` differs from `list[str] | None`. The `None` literal stays `None`, including when marked nullable. Only that literal can omit its module. Other module-less references raise `CodegenError`. -Generated source targets Python 3.12+. References in runtime annotations must +Generated source targets Python 3.11+. References in runtime annotations must name classes that have already been defined. Stub annotations can refer to classes defined later. @@ -155,7 +158,7 @@ A field named `list` makes builtin list references in that class use `_builtins.list[T]`, with `import builtins as _builtins`. An alias that still collides raises `CodegenError`. The writer never adds numbered suffixes or renames declarations. -The builtin-name list combines Python 3.12 through 3.15, including +The builtin-name list combines Python 3.11 through 3.15, including platform-specific names, so imports do not depend on the generator host. Update the list when adding support for another Python version. diff --git a/packages/aws-sdk-signers/.changes/next-release/aws-sdk-signers-feature-702d2c6c980747ca893ca734662eb7c5.json b/packages/aws-sdk-signers/.changes/next-release/aws-sdk-signers-feature-702d2c6c980747ca893ca734662eb7c5.json new file mode 100644 index 000000000..7c6cf0df2 --- /dev/null +++ b/packages/aws-sdk-signers/.changes/next-release/aws-sdk-signers-feature-702d2c6c980747ca893ca734662eb7c5.json @@ -0,0 +1,4 @@ +{ + "type": "feature", + "description": "Added support for Python 3.11." +} \ No newline at end of file diff --git a/packages/aws-sdk-signers/pyproject.toml b/packages/aws-sdk-signers/pyproject.toml index 225a7659d..3a040df19 100644 --- a/packages/aws-sdk-signers/pyproject.toml +++ b/packages/aws-sdk-signers/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "aws-sdk-signers" dynamic = ["version"] -requires-python = ">=3.12" +requires-python = ">=3.11" authors = [ {name = "Amazon Web Services"}, ] @@ -19,6 +19,7 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", @@ -27,6 +28,9 @@ classifiers = [ "Programming Language :: Python :: Free Threading :: 2 - Beta", "Topic :: Software Development :: Libraries" ] +dependencies = [ + "typing-extensions>=4.14.0; python_version < '3.12'", +] [project.urls] "Changelog" = "https://github.com/smithy-lang/smithy-python/blob/develop/packages/aws-sdk-signers/CHANGELOG.md" diff --git a/packages/aws-sdk-signers/src/aws_sdk_signers/_program.py b/packages/aws-sdk-signers/src/aws_sdk_signers/_program.py index 02a7f2356..aee1820ef 100644 --- a/packages/aws-sdk-signers/src/aws_sdk_signers/_program.py +++ b/packages/aws-sdk-signers/src/aws_sdk_signers/_program.py @@ -7,15 +7,25 @@ dependencies. """ +import sys from collections.abc import Callable, Generator from inspect import isawaitable -from typing import Any +from typing import Any, TypeVar -type Effect = Callable[[], Any] -type Program[T] = Generator[Effect, Any, T] +if sys.version_info >= (3, 12): + from typing import TypeAliasType +else: + from typing_extensions import TypeAliasType -def run_program[T](program: Program[T]) -> T: +_T = TypeVar("_T") + + +Effect = TypeAliasType("Effect", Callable[[], Any]) +Program = TypeAliasType("Program", Generator[Effect, Any, _T], type_params=(_T,)) + + +def run_program(program: Program[_T]) -> _T: """Drive a program to completion, calling each effect synchronously. :raises TypeError: If an effect returns an awaitable. diff --git a/packages/aws-sdk-signers/src/aws_sdk_signers/aio/_program.py b/packages/aws-sdk-signers/src/aws_sdk_signers/aio/_program.py index c0a7dfe0b..0b7dd715e 100644 --- a/packages/aws-sdk-signers/src/aws_sdk_signers/aio/_program.py +++ b/packages/aws-sdk-signers/src/aws_sdk_signers/aio/_program.py @@ -1,12 +1,14 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 from inspect import isawaitable -from typing import Any +from typing import Any, TypeVar from .._program import Program +_T = TypeVar("_T") -async def run_program_async[T](program: Program[T]) -> T: + +async def run_program_async(program: Program[_T]) -> _T: """Drive a program to completion, awaiting each effect that returns an awaitable.""" value: Any = None error: BaseException | None = None diff --git a/packages/aws-sdk-signers/src/aws_sdk_signers/interfaces/events.py b/packages/aws-sdk-signers/src/aws_sdk_signers/interfaces/events.py index 50391a100..e6b637b2a 100644 --- a/packages/aws-sdk-signers/src/aws_sdk_signers/interfaces/events.py +++ b/packages/aws-sdk-signers/src/aws_sdk_signers/interfaces/events.py @@ -4,10 +4,17 @@ from __future__ import annotations import datetime +import sys import uuid from collections.abc import Mapping from typing import Protocol +if sys.version_info >= (3, 12): + from typing import TypeAliasType +else: + from typing_extensions import TypeAliasType + + __all__ = ( "HEADERS_DICT", "HEADER_VALUE", @@ -15,11 +22,13 @@ "EventMessage", ) -type HEADER_VALUE = bool | int | bytes | str | datetime.datetime | uuid.UUID +HEADER_VALUE = TypeAliasType( + "HEADER_VALUE", bool | int | bytes | str | datetime.datetime | uuid.UUID +) """A union of valid value types for event headers.""" -type HEADERS_DICT = Mapping[str, HEADER_VALUE] +HEADERS_DICT = TypeAliasType("HEADERS_DICT", Mapping[str, HEADER_VALUE]) """A dictionary of event headers.""" diff --git a/packages/aws-sdk-signers/tests/unit/test_fields.py b/packages/aws-sdk-signers/tests/unit/test_fields.py index a61b4a69f..115ca85ac 100644 --- a/packages/aws-sdk-signers/tests/unit/test_fields.py +++ b/packages/aws-sdk-signers/tests/unit/test_fields.py @@ -1,6 +1,8 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 +import sys + import pytest from aws_sdk_signers import Field, Fields @@ -208,9 +210,15 @@ def test_fields_length_value(fields: Fields, expected_length: int) -> None: [ ( Fields([Field(name="fname1")]), + # Python 3.12 changed OrderedDict's repr to the dict form. ( "Fields(OrderedDict({'fname1': Field(name='fname1', value=[], " "kind='header')}))" + ) + if sys.version_info >= (3, 12) + else ( + "Fields(OrderedDict([('fname1', Field(name='fname1', value=[], " + "kind='header'))]))" ), ), ], diff --git a/packages/smithy-aws-checksums/.changes/next-release/smithy-aws-checksums-feature-7569d7bc100d44d8bfe23ad09e29c8b7.json b/packages/smithy-aws-checksums/.changes/next-release/smithy-aws-checksums-feature-7569d7bc100d44d8bfe23ad09e29c8b7.json new file mode 100644 index 000000000..7c6cf0df2 --- /dev/null +++ b/packages/smithy-aws-checksums/.changes/next-release/smithy-aws-checksums-feature-7569d7bc100d44d8bfe23ad09e29c8b7.json @@ -0,0 +1,4 @@ +{ + "type": "feature", + "description": "Added support for Python 3.11." +} \ No newline at end of file diff --git a/packages/smithy-aws-checksums/Cargo.toml b/packages/smithy-aws-checksums/Cargo.toml index 0c92bb754..cf0fcaa19 100644 --- a/packages/smithy-aws-checksums/Cargo.toml +++ b/packages/smithy-aws-checksums/Cargo.toml @@ -13,7 +13,7 @@ path = "rust/lib.rs" [dependencies] crc-fast = { version = "1.10", default-features = false, features = ["std"] } -pyo3 = { version = "0.30", features = ["abi3-py312", "abi3t-py315"] } +pyo3 = { version = "0.30", features = ["abi3-py311", "abi3t-py315"] } twox-hash = { version = "2.1", default-features = false, features = ["std", "xxhash64", "xxhash3_64", "xxhash3_128"] } [profile.release] diff --git a/packages/smithy-aws-checksums/build_backend/smithy_aws_checksums_build.py b/packages/smithy-aws-checksums/build_backend/smithy_aws_checksums_build.py index b17b9fcfa..a7f2666f0 100644 --- a/packages/smithy-aws-checksums/build_backend/smithy_aws_checksums_build.py +++ b/packages/smithy-aws-checksums/build_backend/smithy_aws_checksums_build.py @@ -26,9 +26,10 @@ import tomllib from importlib import import_module from pathlib import Path +from typing import TypeAlias -type _ConfigSettings = dict[str, str | list[str]] | None -type _Version = tuple[int, ...] +_ConfigSettings: TypeAlias = dict[str, str | list[str]] | None +_Version: TypeAlias = tuple[int, ...] _ENV_VAR = "SMITHY_PYTHON_NATIVE_BUILD" _MATURIN = "maturin>=1.10,<2" diff --git a/packages/smithy-aws-checksums/pyproject.toml b/packages/smithy-aws-checksums/pyproject.toml index e4e0856b6..1c3a470f7 100644 --- a/packages/smithy-aws-checksums/pyproject.toml +++ b/packages/smithy-aws-checksums/pyproject.toml @@ -2,7 +2,7 @@ name = "smithy-aws-checksums" # The version must stay static: both build backends read it from here. version = "0.1.1" -requires-python = ">=3.12" +requires-python = ">=3.11" authors = [ {name = "Amazon Web Services"}, ] @@ -20,6 +20,7 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", @@ -29,7 +30,9 @@ classifiers = [ "Programming Language :: Rust", "Topic :: Software Development :: Libraries" ] -dependencies = [] +dependencies = [ + "typing-extensions>=4.14.0; python_version < '3.12'", +] [project.urls] "Changelog" = "https://github.com/smithy-lang/smithy-python/blob/develop/packages/smithy-aws-checksums/CHANGELOG.md" diff --git a/packages/smithy-aws-checksums/src/smithy_aws_checksums/__init__.py b/packages/smithy-aws-checksums/src/smithy_aws_checksums/__init__.py index 66a892bfb..5473423aa 100644 --- a/packages/smithy-aws-checksums/src/smithy_aws_checksums/__init__.py +++ b/packages/smithy-aws-checksums/src/smithy_aws_checksums/__init__.py @@ -10,7 +10,7 @@ """ import hashlib -from collections.abc import Buffer +import sys from importlib.metadata import version from typing import ClassVar, Final, Protocol, Self, runtime_checkable @@ -19,6 +19,11 @@ from ._private.selection import NATIVE as _NATIVE from ._private.selection import ChecksumImpl as _ChecksumImpl +if sys.version_info >= (3, 12): + from collections.abc import Buffer +else: + from typing_extensions import Buffer + __version__ = version("smithy-aws-checksums") __all__ = ( "CRC32", diff --git a/packages/smithy-aws-checksums/src/smithy_aws_checksums/_native.pyi b/packages/smithy-aws-checksums/src/smithy_aws_checksums/_native.pyi index 67aa37d15..fd24824ba 100644 --- a/packages/smithy-aws-checksums/src/smithy_aws_checksums/_native.pyi +++ b/packages/smithy-aws-checksums/src/smithy_aws_checksums/_native.pyi @@ -2,9 +2,9 @@ # SPDX-License-Identifier: Apache-2.0 """Type stubs for the native extension built from ``rust/lib.rs``.""" -from typing import Self +from typing import Self, TypeAlias -type _Bytes = bytes | bytearray | memoryview +_Bytes: TypeAlias = bytes | bytearray | memoryview class Crc32: def update(self, data: _Bytes, /) -> None: ... diff --git a/packages/smithy-aws-checksums/src/smithy_aws_checksums/_private/buffers.py b/packages/smithy-aws-checksums/src/smithy_aws_checksums/_private/buffers.py index 175ab15e7..29c8ed0ec 100644 --- a/packages/smithy-aws-checksums/src/smithy_aws_checksums/_private/buffers.py +++ b/packages/smithy-aws-checksums/src/smithy_aws_checksums/_private/buffers.py @@ -1,6 +1,11 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 -from collections.abc import Buffer +import sys + +if sys.version_info >= (3, 12): + from collections.abc import Buffer +else: + from typing_extensions import Buffer def as_byte_view(data: Buffer) -> bytes | bytearray | memoryview: diff --git a/packages/smithy-aws-checksums/src/smithy_aws_checksums/_private/selection.py b/packages/smithy-aws-checksums/src/smithy_aws_checksums/_private/selection.py index 69a2ed678..77dab9a33 100644 --- a/packages/smithy-aws-checksums/src/smithy_aws_checksums/_private/selection.py +++ b/packages/smithy-aws-checksums/src/smithy_aws_checksums/_private/selection.py @@ -2,9 +2,15 @@ # SPDX-License-Identifier: Apache-2.0 """Selects the native checksum implementations, or the pure-Python ones if unavailable.""" +import sys from collections.abc import Callable, Mapping from typing import Protocol, Self +if sys.version_info >= (3, 12): + from typing import TypeAliasType +else: + from typing_extensions import TypeAliasType + class ChecksumImpl(Protocol): """The interface shared by the native and pure-Python implementations. @@ -19,7 +25,7 @@ def digest(self) -> bytes: ... def copy(self) -> Self: ... -type ImplFactory = Callable[[], ChecksumImpl] +ImplFactory = TypeAliasType("ImplFactory", Callable[[], ChecksumImpl]) def _load() -> tuple[bool, Mapping[str, ImplFactory]]: diff --git a/packages/smithy-aws-checksums/src/smithy_aws_checksums/_private/xxhash.py b/packages/smithy-aws-checksums/src/smithy_aws_checksums/_private/xxhash.py index 09012127f..e7d236e7c 100644 --- a/packages/smithy-aws-checksums/src/smithy_aws_checksums/_private/xxhash.py +++ b/packages/smithy-aws-checksums/src/smithy_aws_checksums/_private/xxhash.py @@ -9,12 +9,17 @@ a seed of zero and the default secret, which is all that checksums need. """ -from collections.abc import Buffer +import sys from struct import Struct from typing import Self from .pure import PureChecksum +if sys.version_info >= (3, 12): + from collections.abc import Buffer +else: + from typing_extensions import Buffer + _MASK64 = 0xFFFFFFFFFFFFFFFF _PRIME32_1 = 0x9E3779B1 diff --git a/packages/smithy-aws-checksums/tests/unit/test_implementations.py b/packages/smithy-aws-checksums/tests/unit/test_implementations.py index 990bd814e..5f0e96736 100644 --- a/packages/smithy-aws-checksums/tests/unit/test_implementations.py +++ b/packages/smithy-aws-checksums/tests/unit/test_implementations.py @@ -11,6 +11,7 @@ from collections.abc import Callable from concurrent.futures import ThreadPoolExecutor from types import ModuleType +from typing import TypeAlias import pytest from smithy_aws_checksums._private import crc, xxhash @@ -18,7 +19,7 @@ from .vectors import ALGORITHMS, KNOWN_ANSWERS, PATTERN_DIGESTS, pattern -type Factory = Callable[[], ChecksumImpl] +Factory: TypeAlias = Callable[[], ChecksumImpl] PURE: dict[str, Factory] = { "crc32": crc.Crc32, diff --git a/packages/smithy-aws-core/.changes/next-release/smithy-aws-core-feature-6871a94f54b84734a9e86d97337d2c8a.json b/packages/smithy-aws-core/.changes/next-release/smithy-aws-core-feature-6871a94f54b84734a9e86d97337d2c8a.json new file mode 100644 index 000000000..7d730d287 --- /dev/null +++ b/packages/smithy-aws-core/.changes/next-release/smithy-aws-core-feature-6871a94f54b84734a9e86d97337d2c8a.json @@ -0,0 +1,4 @@ +{ + "type": "feature", + "description": "Added support for Python 3.11 while preserving compatibility with customer type checkers." +} \ No newline at end of file diff --git a/packages/smithy-aws-core/pyproject.toml b/packages/smithy-aws-core/pyproject.toml index 3ca8f6faa..31309d8ad 100644 --- a/packages/smithy-aws-core/pyproject.toml +++ b/packages/smithy-aws-core/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "smithy-aws-core" dynamic = ["version"] -requires-python = ">=3.12" +requires-python = ">=3.11" authors = [ {name = "Amazon Web Services"}, ] @@ -19,6 +19,7 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", @@ -30,7 +31,8 @@ classifiers = [ dependencies = [ "smithy-core~=0.13.0", "smithy-http~=0.10.0", - "aws-sdk-signers~=0.6.0" + "aws-sdk-signers~=0.6.0", + "typing-extensions>=4.14.0; python_version < '3.12'", ] [project.urls] diff --git a/packages/smithy-aws-core/src/smithy_aws_core/aio/auth/sigv4.py b/packages/smithy-aws-core/src/smithy_aws_core/aio/auth/sigv4.py index 3b5aec8b3..ab3f98a7c 100644 --- a/packages/smithy-aws-core/src/smithy_aws_core/aio/auth/sigv4.py +++ b/packages/smithy-aws-core/src/smithy_aws_core/aio/auth/sigv4.py @@ -1,6 +1,7 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 import re +import sys from typing import TYPE_CHECKING, Protocol from aws_sdk_signers import SigV4EventSigner, SigV4SigningProperties @@ -18,6 +19,12 @@ from ...identity.components import AWSCredentialsIdentity, AWSIdentityProperties from ..identity import AsyncAWSCredentialsResolver +if sys.version_info >= (3, 12): + from typing import TypeAliasType +else: + from typing_extensions import TypeAliasType + + if TYPE_CHECKING: from smithy_aws_event_stream.events import EventHeaderEncoder @@ -39,9 +46,10 @@ class AsyncSigV4Config(Protocol): SIGV4_CONFIG = PropertyKey(key="config", value_type=AsyncSigV4Config) """Property key for the client config the SigV4 auth scheme reads.""" -type SigV4Signer = AsyncSigner[ - HTTPRequest, AWSCredentialsIdentity, SigV4SigningProperties -] +SigV4Signer = TypeAliasType( + "SigV4Signer", + AsyncSigner[HTTPRequest, AWSCredentialsIdentity, SigV4SigningProperties], +) class AsyncSigV4AuthScheme( diff --git a/packages/smithy-aws-core/src/smithy_aws_core/aio/config/aws_config.py b/packages/smithy-aws-core/src/smithy_aws_core/aio/config/aws_config.py index 93316ad49..cc5fbadd3 100644 --- a/packages/smithy-aws-core/src/smithy_aws_core/aio/config/aws_config.py +++ b/packages/smithy-aws-core/src/smithy_aws_core/aio/config/aws_config.py @@ -3,7 +3,7 @@ from collections.abc import Mapping from dataclasses import dataclass -from typing import TYPE_CHECKING, Any, ClassVar, Self, Unpack +from typing import TYPE_CHECKING, Any, ClassVar, Self, TypeAlias, Unpack from smithy_core.aio.program import run_program_async @@ -16,8 +16,8 @@ AWSIdentityProperties, ) - type _AsyncTransport = AsyncClientTransport[Any, Any] - type _AsyncCredentialsResolver = AsyncIdentityResolver[ + _AsyncTransport: TypeAlias = AsyncClientTransport[Any, Any] + _AsyncCredentialsResolver: TypeAlias = AsyncIdentityResolver[ AWSCredentialsIdentity, AWSIdentityProperties ] diff --git a/packages/smithy-aws-core/src/smithy_aws_core/aio/identity/__init__.py b/packages/smithy-aws-core/src/smithy_aws_core/aio/identity/__init__.py index 866e0aa13..96fa06369 100644 --- a/packages/smithy-aws-core/src/smithy_aws_core/aio/identity/__init__.py +++ b/packages/smithy-aws-core/src/smithy_aws_core/aio/identity/__init__.py @@ -1,5 +1,7 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 +import sys + from smithy_core.aio.interfaces.identity import AsyncIdentityResolver from ...identity.components import AWSCredentialsIdentity, AWSIdentityProperties @@ -10,9 +12,16 @@ from .process import AsyncProcessCredentialsResolver from .static import AsyncStaticCredentialsResolver -type AsyncAWSCredentialsResolver = AsyncIdentityResolver[ - AWSCredentialsIdentity, AWSIdentityProperties -] +if sys.version_info >= (3, 12): + from typing import TypeAliasType +else: + from typing_extensions import TypeAliasType + + +AsyncAWSCredentialsResolver = TypeAliasType( + "AsyncAWSCredentialsResolver", + AsyncIdentityResolver[AWSCredentialsIdentity, AWSIdentityProperties], +) __all__ = ( "AsyncAWSCredentialsResolver", diff --git a/packages/smithy-aws-core/src/smithy_aws_core/aio/identity/chain/__init__.py b/packages/smithy-aws-core/src/smithy_aws_core/aio/identity/chain/__init__.py index 7fadbff65..871decdae 100644 --- a/packages/smithy-aws-core/src/smithy_aws_core/aio/identity/chain/__init__.py +++ b/packages/smithy-aws-core/src/smithy_aws_core/aio/identity/chain/__init__.py @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 import logging from collections.abc import Mapping, Sequence -from typing import Any +from typing import Any, Generic, TypeVar from smithy_core.aio.interfaces.identity import AsyncIdentityResolver from smithy_core.aio.program import run_program_async @@ -20,20 +20,26 @@ __all__ = ("AsyncIdentityChain",) +_ChainIdentity = TypeVar("_ChainIdentity", bound=Identity) +_I_co = TypeVar("_I_co", bound=Identity, covariant=True) + + _CHAIN_PROVIDER_ENTRY_POINT_GROUP = "smithy_aws_core.aio.identity.chain_providers" logger: logging.Logger = logging.getLogger(__name__) -class AsyncIdentityChain[I: Identity]( - _IdentityChainBase[I], AsyncIdentityResolver[I, Mapping[str, Any]] +class AsyncIdentityChain( + _IdentityChainBase[_I_co], + AsyncIdentityResolver[_I_co, Mapping[str, Any]], + Generic[_I_co], ): """Resolves identities from an assembled sequence of resolvers.""" def __init__( self, - resolvers: Sequence[AsyncIdentityResolver[I, Any]], + resolvers: Sequence[AsyncIdentityResolver[_I_co, Any]], *, - identity_type: type[I] | None = None, + identity_type: type[_I_co] | None = None, unclaimed_sources: Sequence[UnclaimedSource] = (), ) -> None: """Initialize the chain with resolvers in precedence order. @@ -50,14 +56,14 @@ def __init__( ) @staticmethod - async def create[ChainIdentity: Identity]( - identity_type: type[ChainIdentity], + async def create( + identity_type: type[_ChainIdentity], *, config_file: MergedConfig | None = None, profile_name: str | None = None, region_override: str | None = None, http_client: AsyncHTTPClient | None = None, - ) -> "AsyncIdentityChain[ChainIdentity]": + ) -> "AsyncIdentityChain[_ChainIdentity]": """Create an identity chain from discovered providers. :param identity_type: The identity type to resolve. @@ -87,7 +93,7 @@ async def create[ChainIdentity: Identity]( unclaimed_sources=unclaimed_sources, ) - async def get_identity(self, *, properties: Mapping[str, Any]) -> I: + async def get_identity(self, *, properties: Mapping[str, Any]) -> _I_co: """Return the first identity resolved by the chain.""" return await run_program_async(self._get_identity(properties)) diff --git a/packages/smithy-aws-core/src/smithy_aws_core/config/aws_config.py b/packages/smithy-aws-core/src/smithy_aws_core/config/aws_config.py index 42782fb5f..285c3efa3 100644 --- a/packages/smithy-aws-core/src/smithy_aws_core/config/aws_config.py +++ b/packages/smithy-aws-core/src/smithy_aws_core/config/aws_config.py @@ -4,7 +4,18 @@ from copy import deepcopy from dataclasses import dataclass, field, fields from inspect import isgenerator -from typing import TYPE_CHECKING, Any, ClassVar, Self, TypedDict, Unpack, cast +from typing import ( + TYPE_CHECKING, + Any, + ClassVar, + Generic, + Self, + TypeAlias, + TypedDict, + TypeVar, + Unpack, + cast, +) from smithy_core.program import Program, run_program from smithy_core.retries import RetryStrategyOptions, RetryStrategyType @@ -20,8 +31,8 @@ AWSIdentityProperties, ) - type _Transport = ClientTransport[Any, Any] - type _CredentialsResolver = IdentityResolver[ + _Transport: TypeAlias = ClientTransport[Any, Any] + _CredentialsResolver: TypeAlias = IdentityResolver[ AWSCredentialsIdentity, AWSIdentityProperties ] @@ -44,6 +55,10 @@ validate_sdk_ua_app_id, ) +_TContext_co = TypeVar("_TContext_co", covariant=True) +_TCredentialsResolver = TypeVar("_TCredentialsResolver") +_TTransport = TypeVar("_TTransport") + __all__ = [ "AwsConfig", "AwsConfigOverrides", @@ -347,7 +362,9 @@ def _resolve_credentials(self, overrides: dict[str, Any]) -> None: ) -class _AwsConfigOverridesBase[TTransport, TCredentialsResolver](TypedDict, total=False): +class _AwsConfigOverridesBase( + TypedDict, Generic[_TTransport, _TCredentialsResolver], total=False +): """Common keyword overrides accepted by AWS config resolution.""" region: str | None @@ -357,12 +374,12 @@ class _AwsConfigOverridesBase[TTransport, TCredentialsResolver](TypedDict, total aws_access_key_id: str | None aws_secret_access_key: str | None aws_session_token: str | None - aws_credentials_identity_resolver: TCredentialsResolver | None + aws_credentials_identity_resolver: _TCredentialsResolver | None sdk_ua_app_id: str | None user_agent_extra: str | None interceptors: list[Any] http_request_config: "HTTPRequestConfiguration | None" - transport: TTransport | None + transport: _TTransport | None retry_strategy: "RetryStrategy | RetryStrategyOptions | None" @@ -377,7 +394,9 @@ class AwsConfigOverrides( @dataclass(kw_only=True, init=False, repr=False) -class _AwsConfigFields[TTransport, TCredentialsResolver, TContext](_AwsConfigBase): +class _AwsConfigFields( + _AwsConfigBase, Generic[_TTransport, _TCredentialsResolver, _TContext_co] +): """The fields shared by the sync and async AWS configs.""" region: str | None = None @@ -419,7 +438,7 @@ class _AwsConfigFields[TTransport, TCredentialsResolver, TContext](_AwsConfigBas when supplying temporary credentials in code. """ - aws_credentials_identity_resolver: TCredentialsResolver | None = None + aws_credentials_identity_resolver: _TCredentialsResolver | None = None """Resolves AWS Credentials. Set automatically to a ``StaticCredentialsResolver`` when @@ -440,14 +459,14 @@ class _AwsConfigFields[TTransport, TCredentialsResolver, TContext](_AwsConfigBas http_request_config: "HTTPRequestConfiguration | None" = None """Configuration for individual HTTP requests.""" - transport: TTransport | None = None + transport: _TTransport | None = None """The transport to use to send requests""" retry_strategy: Any | None = None """The retry strategy or options for configuring retry behavior. """ - _ctx: TContext | None = field(default=None, repr=False, compare=False) + _ctx: _TContext_co | None = field(default=None, repr=False, compare=False) _sources: dict[str, ConfigSource] = field( # type: ignore[assignment] default_factory=dict, repr=False, @@ -456,7 +475,7 @@ class _AwsConfigFields[TTransport, TCredentialsResolver, TContext](_AwsConfigBas _FIELDS: ClassVar[dict[str, FieldSpec]] = _BASE_FIELDS - def resolution_context(self) -> TContext | None: + def resolution_context(self) -> _TContext_co | None: """Get the resolution context used to create this config. :returns: The resolution context, or None if not available. diff --git a/packages/smithy-aws-core/src/smithy_aws_core/config/file_parser.py b/packages/smithy-aws-core/src/smithy_aws_core/config/file_parser.py index 08df2daef..7323251b4 100644 --- a/packages/smithy-aws-core/src/smithy_aws_core/config/file_parser.py +++ b/packages/smithy-aws-core/src/smithy_aws_core/config/file_parser.py @@ -3,6 +3,7 @@ import logging import re +import sys from dataclasses import dataclass, field from enum import Enum from typing import TYPE_CHECKING, Any @@ -11,6 +12,12 @@ from .exceptions import ConfigParseError +if sys.version_info >= (3, 12): + from typing import TypeAliasType +else: + from typing_extensions import TypeAliasType + + if TYPE_CHECKING: from .filesystem import FileSystem @@ -28,7 +35,9 @@ # Type aliases -type RawParsedSections = dict[str, dict[str, str | dict[str, str]]] +RawParsedSections = TypeAliasType( + "RawParsedSections", dict[str, dict[str, str | dict[str, str]]] +) _VALID_IDENTIFIER_RE = re.compile(r"^[A-Za-z0-9_\-/.%@:+]+$") @@ -47,7 +56,7 @@ class Section: properties: dict[str, str | dict[str, str]] = field(default_factory=dict) # type: ignore[assignment] -type SectionMap = dict[str, Section] +SectionMap = TypeAliasType("SectionMap", dict[str, Section]) @dataclass diff --git a/packages/smithy-aws-core/src/smithy_aws_core/config/types.py b/packages/smithy-aws-core/src/smithy_aws_core/config/types.py index 585647417..066c155eb 100644 --- a/packages/smithy-aws-core/src/smithy_aws_core/config/types.py +++ b/packages/smithy-aws-core/src/smithy_aws_core/config/types.py @@ -2,10 +2,17 @@ # SPDX-License-Identifier: Apache-2.0 +import sys from collections.abc import Callable from dataclasses import dataclass from enum import StrEnum -from typing import Any, Literal +from typing import Any, Generic, Literal, TypeVar + +if sys.version_info >= (3, 12): + from typing import TypeAliasType +else: + from typing_extensions import TypeAliasType + __all__ = [ "UNSET", @@ -16,6 +23,8 @@ "ResponseChecksumValidation", ] +_T_co = TypeVar("_T_co", covariant=True) + class _UnsetType: def __repr__(self) -> str: @@ -39,10 +48,10 @@ class ConfigSource(StrEnum): @dataclass(frozen=True, kw_only=True) -class Resolved[T]: +class Resolved(Generic[_T_co]): """A resolved config value paired with its provenance source.""" - value: T + value: _T_co source: ConfigSource @@ -91,7 +100,9 @@ def __post_init__(self) -> None: ) -type RequestChecksumCalculation = Literal["when_supported", "when_required"] +RequestChecksumCalculation = TypeAliasType( + "RequestChecksumCalculation", Literal["when_supported", "when_required"] +) """When to calculate checksums of request payloads. * ``when_supported``: calculate a checksum for the request payload of every @@ -103,7 +114,9 @@ def __post_init__(self) -> None: """ -type ResponseChecksumValidation = Literal["when_supported", "when_required"] +ResponseChecksumValidation = TypeAliasType( + "ResponseChecksumValidation", Literal["when_supported", "when_required"] +) """When to validate the checksums of response payloads. * ``when_supported``: validate the response payload of every operation that models diff --git a/packages/smithy-aws-core/src/smithy_aws_core/identity/chain/ordering.py b/packages/smithy-aws-core/src/smithy_aws_core/identity/chain/ordering.py index 17fdac240..8cbc6c5de 100644 --- a/packages/smithy-aws-core/src/smithy_aws_core/identity/chain/ordering.py +++ b/packages/smithy-aws-core/src/smithy_aws_core/identity/chain/ordering.py @@ -1,11 +1,18 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 import os +import sys from dataclasses import dataclass from enum import Enum from ...config.context import shared_config_files_exist +if sys.version_info >= (3, 12): + from typing import TypeAliasType +else: + from typing_extensions import TypeAliasType + + __all__ = [ "After", "Before", @@ -79,5 +86,5 @@ class After: slot: StandardProvider -type OrderingConstraint = Standard | Before | After +OrderingConstraint = TypeAliasType("OrderingConstraint", Standard | Before | After) """Positions a provider at, before, or after a standard provider slot.""" diff --git a/packages/smithy-aws-core/src/smithy_aws_core/identity/chain/resolver.py b/packages/smithy-aws-core/src/smithy_aws_core/identity/chain/resolver.py index 81828080c..5a3c6df55 100644 --- a/packages/smithy-aws-core/src/smithy_aws_core/identity/chain/resolver.py +++ b/packages/smithy-aws-core/src/smithy_aws_core/identity/chain/resolver.py @@ -4,7 +4,7 @@ from collections.abc import Callable, Mapping, Sequence from functools import partial from importlib import metadata -from typing import Any, cast +from typing import Any, Generic, TypeVar, cast from smithy_core.exceptions import SmithyIdentityError from smithy_core.interfaces.identity import Identity, IdentityResolver @@ -27,22 +27,26 @@ __all__ = ("IdentityChain",) +_ChainIdentity = TypeVar("_ChainIdentity", bound=Identity) +_I_co = TypeVar("_I_co", bound=Identity, covariant=True) + + _CHAIN_PROVIDER_ENTRY_POINT_GROUP = "smithy_aws_core.identity.chain_providers" logger: logging.Logger = logging.getLogger(__name__) -class _IdentityChainBase[I: Identity]: +class _IdentityChainBase(Generic[_I_co]): """Identity chain logic shared by the sync and async chains.""" _resolvers: tuple[Any, ...] - _identity_type: type[I] | None + _identity_type: type[_I_co] | None _unclaimed_sources: tuple[UnclaimedSource, ...] def __init__( self, resolvers: Sequence[Any], *, - identity_type: type[I] | None = None, + identity_type: type[_I_co] | None = None, unclaimed_sources: Sequence[UnclaimedSource] = (), ) -> None: """Initialize the chain with resolvers in precedence order. @@ -59,11 +63,11 @@ def __init__( self._unclaimed_sources = tuple(unclaimed_sources) @property - def identity_type(self) -> type[I] | None: + def identity_type(self) -> type[_I_co] | None: """The identity type this chain resolves, or None if not declared.""" return self._identity_type - def _get_identity(self, properties: Mapping[str, Any]) -> Program[I]: + def _get_identity(self, properties: Mapping[str, Any]) -> Program[_I_co]: failures: list[IdentityResolverFailure] = [] for resolver in self._resolvers: try: @@ -90,16 +94,18 @@ def _invalidate(self) -> Program[None]: yield resolver.invalidate -class IdentityChain[I: Identity]( - _IdentityChainBase[I], IdentityResolver[I, Mapping[str, Any]] +class IdentityChain( + _IdentityChainBase[_I_co], + IdentityResolver[_I_co, Mapping[str, Any]], + Generic[_I_co], ): """Resolves identities from an assembled sequence of resolvers.""" def __init__( self, - resolvers: Sequence[IdentityResolver[I, Any]], + resolvers: Sequence[IdentityResolver[_I_co, Any]], *, - identity_type: type[I] | None = None, + identity_type: type[_I_co] | None = None, unclaimed_sources: Sequence[UnclaimedSource] = (), ) -> None: """Initialize the chain with resolvers in precedence order. @@ -115,14 +121,14 @@ def __init__( ) @staticmethod - def create[ChainIdentity: Identity]( - identity_type: type[ChainIdentity], + def create( + identity_type: type[_ChainIdentity], *, config_file: MergedConfig | None = None, profile_name: str | None = None, region_override: str | None = None, http_client: HTTPClient | None = None, - ) -> "IdentityChain[ChainIdentity]": + ) -> "IdentityChain[_ChainIdentity]": """Create an identity chain from discovered providers. :param identity_type: The identity type to resolve. @@ -153,7 +159,7 @@ def create[ChainIdentity: Identity]( unclaimed_sources=unclaimed_sources, ) - def get_identity(self, *, properties: Mapping[str, Any]) -> I: + def get_identity(self, *, properties: Mapping[str, Any]) -> _I_co: """Return the first identity resolved by the chain.""" return run_program(self._get_identity(properties)) diff --git a/packages/smithy-aws-core/src/smithy_aws_core/identity/components.py b/packages/smithy-aws-core/src/smithy_aws_core/identity/components.py index 7f5e55a53..af6909808 100644 --- a/packages/smithy-aws-core/src/smithy_aws_core/identity/components.py +++ b/packages/smithy-aws-core/src/smithy_aws_core/identity/components.py @@ -1,5 +1,6 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 +import sys from dataclasses import dataclass, field from datetime import datetime from typing import Protocol, TypedDict @@ -8,6 +9,12 @@ from ..business_metrics import AwsFeatureId +if sys.version_info >= (3, 12): + from typing import TypeAliasType +else: + from typing_extensions import TypeAliasType + + __all__ = [ "AWSCredentialsIdentity", "AWSCredentialsResolver", @@ -50,9 +57,10 @@ class AWSIdentityProperties(TypedDict, total=False): _feature_ids: dict[AwsFeatureId, None] -type AWSCredentialsResolver = IdentityResolver[ - AWSCredentialsIdentity, AWSIdentityProperties -] +AWSCredentialsResolver = TypeAliasType( + "AWSCredentialsResolver", + IdentityResolver[AWSCredentialsIdentity, AWSIdentityProperties], +) class AWSIdentityConfig(Protocol): diff --git a/packages/smithy-aws-core/src/smithy_aws_core/protocols.py b/packages/smithy-aws-core/src/smithy_aws_core/protocols.py index 0053570e7..1d9be4fa9 100644 --- a/packages/smithy-aws-core/src/smithy_aws_core/protocols.py +++ b/packages/smithy-aws-core/src/smithy_aws_core/protocols.py @@ -3,7 +3,7 @@ from collections.abc import Callable from dataclasses import dataclass, replace from io import BytesIO -from typing import TYPE_CHECKING, Any, ClassVar, Final +from typing import TYPE_CHECKING, Any, ClassVar, Final, TypeVar from xml.etree.ElementTree import Element from smithy_core import URI as _URI @@ -64,6 +64,12 @@ parse_retry_after, ) +_I = TypeVar("_I", bound=SerializeableShape) +_O = TypeVar("_O", bound=DeserializeableShape) +_OperationInput = TypeVar("_OperationInput", bound=SerializeableShape) +_OperationOutput = TypeVar("_OperationOutput", bound=DeserializeableShape) + + try: from smithy_json import JSONCodec, JSONDocument @@ -201,15 +207,12 @@ def payload_codec(self) -> Codec: def content_type(self) -> str: return self._content_type - def _deserialize_output[ - OperationInput: SerializeableShape, - OperationOutput: DeserializeableShape, - ]( + def _deserialize_output( self, - operation: APIOperation[OperationInput, OperationOutput], + operation: APIOperation[_OperationInput, _OperationOutput], response: HTTPResponse, body: SyncStreamingBlob | None, - ) -> OperationOutput: + ) -> _OperationOutput: if operation.schema.get_trait(S3UnwrappedXmlOutputTrait) is None: return super()._deserialize_output(operation, response, body) output_schema = operation.output_schema @@ -344,14 +347,11 @@ def content_type(self) -> str: def error_identifier(self) -> HTTPErrorIdentifier: return self._error_identifier - def serialize_request[ - OperationInput: SerializeableShape, - OperationOutput: DeserializeableShape, - ]( + def serialize_request( self, *, - operation: APIOperation[OperationInput, OperationOutput], - input: OperationInput, + operation: APIOperation[_OperationInput, _OperationOutput], + input: _OperationInput, endpoint: URI, context: TypedProperties, ) -> HTTPRequest: @@ -398,18 +398,15 @@ def serialize_request[ http2_required=http2_required, ) - def _deserialize_body[ - OperationInput: SerializeableShape, - OperationOutput: DeserializeableShape, - ]( + def _deserialize_body( self, *, - operation: APIOperation[OperationInput, OperationOutput], + operation: APIOperation[_OperationInput, _OperationOutput], response: HTTPResponse, body: bytes, error_registry: TypeRegistry, context: TypedProperties, - ) -> OperationOutput: + ) -> _OperationOutput: if not self._is_success(operation, context, response): raise self._create_error( operation=operation, @@ -579,14 +576,11 @@ def extract_response_metadata( return metadata return replace(metadata, request_id=recorded.value) - def serialize_request[ - OperationInput: SerializeableShape, - OperationOutput: DeserializeableShape, - ]( + def serialize_request( self, *, - operation: APIOperation[OperationInput, OperationOutput], - input: OperationInput, + operation: APIOperation[_OperationInput, _OperationOutput], + input: _OperationInput, endpoint: URI, context: TypedProperties, ) -> HTTPRequest: @@ -613,18 +607,15 @@ def serialize_request[ body=sink, ) - def _deserialize_body[ - OperationInput: SerializeableShape, - OperationOutput: DeserializeableShape, - ]( + def _deserialize_body( self, *, - operation: APIOperation[OperationInput, OperationOutput], + operation: APIOperation[_OperationInput, _OperationOutput], response: HTTPResponse, body: bytes, error_registry: TypeRegistry, context: TypedProperties, - ) -> OperationOutput: + ) -> _OperationOutput: root = parse_xml_root(body) # Recorded before any branch below returns or raises, so successes, empty @@ -706,15 +697,15 @@ def _create_serializer( sink=sink, action=action, version=self._version, params=params ) - def _action_name[I: SerializeableShape, O: DeserializeableShape]( + def _action_name( self, - operation: APIOperation[I, O], + operation: APIOperation[_I, _O], ) -> str: return operation.schema.id.name - def _response_wrapper_elements[I: SerializeableShape, O: DeserializeableShape]( + def _response_wrapper_elements( self, - operation: APIOperation[I, O], + operation: APIOperation[_I, _O], ) -> tuple[str, ...]: name = operation.schema.id.name # Operations with no output members will omit the element. @@ -750,9 +741,9 @@ def _create_serializer( sink=sink, action=action, version=self._version, params=params ) - def _response_wrapper_elements[I: SerializeableShape, O: DeserializeableShape]( + def _response_wrapper_elements( self, - operation: APIOperation[I, O], + operation: APIOperation[_I, _O], ) -> tuple[str, ...]: return (f"{operation.schema.id.name}Response",) diff --git a/packages/smithy-aws-event-stream/.changes/next-release/smithy-aws-event-stream-feature-d2a4ee0b688a44ddb5a5a29c2748d518.json b/packages/smithy-aws-event-stream/.changes/next-release/smithy-aws-event-stream-feature-d2a4ee0b688a44ddb5a5a29c2748d518.json new file mode 100644 index 000000000..7d730d287 --- /dev/null +++ b/packages/smithy-aws-event-stream/.changes/next-release/smithy-aws-event-stream-feature-d2a4ee0b688a44ddb5a5a29c2748d518.json @@ -0,0 +1,4 @@ +{ + "type": "feature", + "description": "Added support for Python 3.11 while preserving compatibility with customer type checkers." +} \ No newline at end of file diff --git a/packages/smithy-aws-event-stream/pyproject.toml b/packages/smithy-aws-event-stream/pyproject.toml index 23152ab14..89c19e4dc 100644 --- a/packages/smithy-aws-event-stream/pyproject.toml +++ b/packages/smithy-aws-event-stream/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "smithy-aws-event-stream" dynamic = ["version"] -requires-python = ">=3.12" +requires-python = ">=3.11" authors = [ {name = "Amazon Web Services"}, ] @@ -19,6 +19,7 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", @@ -29,6 +30,7 @@ classifiers = [ ] dependencies = [ "smithy-core~=0.13.0", + "typing-extensions>=4.14.0; python_version < '3.12'", ] [project.urls] diff --git a/packages/smithy-aws-event-stream/src/smithy_aws_event_stream/aio/__init__.py b/packages/smithy-aws-event-stream/src/smithy_aws_event_stream/aio/__init__.py index d7a8cbffc..80a3841eb 100644 --- a/packages/smithy-aws-event-stream/src/smithy_aws_event_stream/aio/__init__.py +++ b/packages/smithy-aws-event-stream/src/smithy_aws_event_stream/aio/__init__.py @@ -2,8 +2,9 @@ # SPDX-License-Identifier: Apache-2.0 import contextlib import logging +import sys from collections.abc import Callable, Mapping -from typing import Any +from typing import Any, Generic, TypeVar from smithy_core.aio.interfaces import AsyncByteStream, AsyncWriter from smithy_core.aio.interfaces.eventstream import ( @@ -25,8 +26,21 @@ from ..exceptions import EventError from ..signing import SigningConfig +if sys.version_info >= (3, 12): + from typing import TypeAliasType +else: + from typing_extensions import TypeAliasType + + __all__ = ["AsyncAWSEventPublisher", "AsyncAWSEventReceiver", "decode_event_async"] +_IE_contra = TypeVar("_IE_contra", bound=SerializeableShape, contravariant=True) +_OE_co = TypeVar("_OE_co", bound=DeserializeableShape, covariant=True) +_I = TypeVar("_I", bound=Identity) +_IP = TypeVar("_IP", bound=Mapping[str, Any]) +_SP = TypeVar("_SP", bound=Mapping[str, Any]) + + logger: logging.Logger = logging.getLogger(__name__) @@ -42,14 +56,14 @@ async def decode_event_async(source: AsyncByteStream) -> Event | None: return await run_program_async(Event._decode(source.read)) # pyright: ignore[reportPrivateUsage] -class AsyncAWSEventPublisher[E: SerializeableShape](AsyncEventPublisher[E]): +class AsyncAWSEventPublisher(AsyncEventPublisher[_IE_contra], Generic[_IE_contra]): """Publishes events to an AWS event stream.""" - def __init__[I: Identity, IP: Mapping[str, Any], SP: Mapping[str, Any]]( + def __init__( self, payload_codec: Codec, async_writer: AsyncWriter, - signing_config: "_AsyncSigningConfig[I, IP, SP] | None" = None, + signing_config: "_AsyncSigningConfig[_I, _IP, _SP] | None" = None, is_client_mode: bool = True, initial_message: EventMessage | None = None, ): @@ -71,7 +85,7 @@ async def prepare(self) -> None: """ await self._write_initial() - async def send(self, event: E) -> None: + async def send(self, event: _IE_contra) -> None: if self._closed: raise OSError("Attempted to write to closed stream.") await self._write_initial() @@ -149,14 +163,14 @@ async def _write(self, message: EventMessage) -> None: raise OSError("Failed to write to stream.") from e -class AsyncAWSEventReceiver[E: DeserializeableShape](AsyncEventReceiver[E]): +class AsyncAWSEventReceiver(AsyncEventReceiver[_OE_co], Generic[_OE_co]): """Receives events from an AWS event stream.""" def __init__( self, payload_codec: Codec, source: AsyncByteStream, - deserializer: Callable[[ShapeDeserializer], E], + deserializer: Callable[[ShapeDeserializer], _OE_co], is_client_mode: bool = True, ) -> None: self._payload_codec = payload_codec @@ -165,7 +179,7 @@ def __init__( self._deserializer = deserializer self._closed = False - async def receive(self) -> E | None: + async def receive(self) -> _OE_co | None: if self._closed: return None @@ -206,6 +220,12 @@ def closed(self) -> bool: return self._closed -type _AsyncSigningConfig[I: Identity, IP: Mapping[str, Any], SP: Mapping[str, Any]] = ( - SigningConfig[I, IP, SP, AsyncIdentityResolver[I, IP]] +_AsyncSigningConfig = TypeAliasType( + "_AsyncSigningConfig", + (SigningConfig[_I, _IP, _SP, AsyncIdentityResolver[_I, _IP]]), + type_params=( + _I, + _IP, + _SP, + ), ) diff --git a/packages/smithy-aws-event-stream/src/smithy_aws_event_stream/events.py b/packages/smithy-aws-event-stream/src/smithy_aws_event_stream/events.py index 9cf820c1f..297b02ccf 100644 --- a/packages/smithy-aws-event-stream/src/smithy_aws_event_stream/events.py +++ b/packages/smithy-aws-event-stream/src/smithy_aws_event_stream/events.py @@ -9,6 +9,7 @@ import datetime import struct +import sys import uuid from binascii import crc32 from collections.abc import Callable, Iterator, Mapping @@ -33,6 +34,12 @@ InvalidPayloadLength, ) +if sys.version_info >= (3, 12): + from typing import TypeAliasType +else: + from typing_extensions import TypeAliasType + + __all__ = [ "HEADERS_DICT", "HEADER_VALUE", @@ -99,7 +106,7 @@ class Long(int): """ -type SizedInt = Byte | Short | Long | int +SizedInt = TypeAliasType("SizedInt", Byte | Short | Long | int) """A union of integer types that indicate their size. Each member of the union is a Python int or empty subclass of it, so they can be used @@ -117,11 +124,13 @@ class Long(int): """ -type HEADER_VALUE = bool | int | bytes | str | datetime.datetime | uuid.UUID +HEADER_VALUE = TypeAliasType( + "HEADER_VALUE", bool | int | bytes | str | datetime.datetime | uuid.UUID +) """A union of valid value types for event headers.""" -type HEADERS_DICT = Mapping[str, HEADER_VALUE] +HEADERS_DICT = TypeAliasType("HEADERS_DICT", Mapping[str, HEADER_VALUE]) """A dictionary of event headers.""" diff --git a/packages/smithy-aws-event-stream/src/smithy_aws_event_stream/signing.py b/packages/smithy-aws-event-stream/src/smithy_aws_event_stream/signing.py index 79cdd4386..d5944b582 100644 --- a/packages/smithy-aws-event-stream/src/smithy_aws_event_stream/signing.py +++ b/packages/smithy-aws-event-stream/src/smithy_aws_event_stream/signing.py @@ -2,21 +2,21 @@ # SPDX-License-Identifier: Apache-2.0 from collections.abc import Mapping from dataclasses import dataclass -from typing import Any +from typing import Any, Generic, TypeVar from smithy_core.interfaces.auth import EventSigner from smithy_core.interfaces.identity import Identity __all__ = ["SigningConfig"] +_I = TypeVar("_I", bound=Identity) +_IP = TypeVar("_IP", bound=Mapping[str, Any]) +_R = TypeVar("_R") +_SP = TypeVar("_SP", bound=Mapping[str, Any]) + @dataclass -class SigningConfig[ - I: Identity, - IP: Mapping[str, Any], - SP: Mapping[str, Any], - R, -]: +class SigningConfig(Generic[_I, _IP, _SP, _R]): """What an event publisher needs to sign the events it sends. :param I: The identity type the resolver returns and the signer accepts. @@ -25,7 +25,7 @@ class SigningConfig[ :param R: The identity resolver type, sync or async. """ - signer: EventSigner[I, SP] - signing_properties: SP - identity_resolver: R - identity_properties: IP + signer: EventSigner[_I, _SP] + signing_properties: _SP + identity_resolver: _R + identity_properties: _IP diff --git a/packages/smithy-aws-event-stream/tests/unit/_private/__init__.py b/packages/smithy-aws-event-stream/tests/unit/_private/__init__.py index 1fbb8cd02..97b271767 100644 --- a/packages/smithy-aws-event-stream/tests/unit/_private/__init__.py +++ b/packages/smithy-aws-event-stream/tests/unit/_private/__init__.py @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 import datetime from dataclasses import dataclass -from typing import Any, ClassVar, Literal, Self +from typing import Any, ClassVar, Literal, Self, TypeAlias from smithy_aws_event_stream.events import Byte, EventMessage, Long, Short from smithy_core.deserializers import ShapeDeserializer @@ -391,7 +391,7 @@ def serialize_members(self, serializer: ShapeSerializer): raise SmithyError("Unknown union variants may not be serialized.") -type EventStream = ( +EventStream: TypeAlias = ( EventStreamMessageEvent | EventStreamPayloadEvent | EventStreamBlobPayloadEvent diff --git a/packages/smithy-cbor/.changes/next-release/smithy-cbor-feature-2986e555f6d74d93a5f7d9158cfd7c18.json b/packages/smithy-cbor/.changes/next-release/smithy-cbor-feature-2986e555f6d74d93a5f7d9158cfd7c18.json new file mode 100644 index 000000000..7c6cf0df2 --- /dev/null +++ b/packages/smithy-cbor/.changes/next-release/smithy-cbor-feature-2986e555f6d74d93a5f7d9158cfd7c18.json @@ -0,0 +1,4 @@ +{ + "type": "feature", + "description": "Added support for Python 3.11." +} \ No newline at end of file diff --git a/packages/smithy-cbor/pyproject.toml b/packages/smithy-cbor/pyproject.toml index b0394d760..8124ec728 100644 --- a/packages/smithy-cbor/pyproject.toml +++ b/packages/smithy-cbor/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "smithy-cbor" dynamic = ["version"] -requires-python = ">=3.12" +requires-python = ">=3.11" authors = [ {name = "Amazon Web Services"}, ] @@ -19,6 +19,7 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", @@ -29,6 +30,7 @@ classifiers = [ ] dependencies = [ "smithy-core~=0.13.0", + "typing-extensions>=4.14.0; python_version < '3.12'", ] [project.urls] diff --git a/packages/smithy-cbor/src/smithy_cbor/_private/deserializers.py b/packages/smithy-cbor/src/smithy_cbor/_private/deserializers.py index deedb33cc..a451a3b86 100644 --- a/packages/smithy-cbor/src/smithy_cbor/_private/deserializers.py +++ b/packages/smithy-cbor/src/smithy_cbor/_private/deserializers.py @@ -4,9 +4,9 @@ import datetime import struct as _struct +import sys from collections.abc import Callable from decimal import Decimal -from typing import override from smithy_core.deserializers import ShapeDeserializer from smithy_core.documents import Document @@ -16,6 +16,11 @@ from ..settings import CBORSettings +if sys.version_info >= (3, 12): + from typing import override +else: + from typing_extensions import override + # Major type occupies the high 3 bits; the low 5 bits are the "additional information". _MAJOR_UINT = 0 _MAJOR_NEGINT = 1 diff --git a/packages/smithy-cbor/src/smithy_cbor/_private/serializers.py b/packages/smithy-cbor/src/smithy_cbor/_private/serializers.py index 68ee887de..1e0d058c4 100644 --- a/packages/smithy-cbor/src/smithy_cbor/_private/serializers.py +++ b/packages/smithy-cbor/src/smithy_cbor/_private/serializers.py @@ -9,12 +9,13 @@ import datetime import struct as _struct +import sys from collections.abc import Callable from contextlib import AbstractContextManager, nullcontext from decimal import Decimal from io import BytesIO from types import TracebackType -from typing import Self, override +from typing import Self from smithy_core.documents import Document from smithy_core.interfaces import BytesWriter @@ -25,6 +26,11 @@ from ..settings import CBORSettings +if sys.version_info >= (3, 12): + from typing import override +else: + from typing_extensions import override + # CBOR major types, shifted into the high 3 bits of the initial byte. _MAJOR_UINT = 0 << 5 _MAJOR_NEGINT = 1 << 5 diff --git a/packages/smithy-core/.changes/next-release/smithy-core-feature-f7486a94dbc240dfb335bfb259b60108.json b/packages/smithy-core/.changes/next-release/smithy-core-feature-f7486a94dbc240dfb335bfb259b60108.json new file mode 100644 index 000000000..bdb6e6e1a --- /dev/null +++ b/packages/smithy-core/.changes/next-release/smithy-core-feature-f7486a94dbc240dfb335bfb259b60108.json @@ -0,0 +1,4 @@ +{ + "type": "feature", + "description": "Added support for Python 3.11 while retaining named recursive aliases and customer type-checker compatibility." +} \ No newline at end of file diff --git a/packages/smithy-core/pyproject.toml b/packages/smithy-core/pyproject.toml index 65c15802c..64eb2eaf2 100644 --- a/packages/smithy-core/pyproject.toml +++ b/packages/smithy-core/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "smithy-core" dynamic = ["version"] -requires-python = ">=3.12" +requires-python = ">=3.11" authors = [ {name = "Amazon Web Services"}, ] @@ -19,6 +19,7 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", @@ -27,7 +28,9 @@ classifiers = [ "Programming Language :: Python :: Free Threading :: 2 - Beta", "Topic :: Software Development :: Libraries" ] -dependencies = [] +dependencies = [ + "typing-extensions>=4.14.0; python_version < '3.12'", +] [project.urls] "Changelog" = "https://github.com/smithy-lang/smithy-python/blob/develop/packages/smithy-core/CHANGELOG.md" diff --git a/packages/smithy-core/src/smithy_core/_client.py b/packages/smithy-core/src/smithy_core/_client.py index f3aa98ea6..77e7c530e 100644 --- a/packages/smithy-core/src/smithy_core/_client.py +++ b/packages/smithy-core/src/smithy_core/_client.py @@ -3,7 +3,7 @@ from collections.abc import Callable from copy import copy from types import FunctionType -from typing import Any, ClassVar, cast, get_overloads +from typing import Any, ClassVar, Generic, TypeVar, cast, get_overloads from .deserializers import DeserializeableShape from .exceptions import ExpectationNotMetError, ResourceLifecycleError @@ -16,13 +16,19 @@ __all__ = ["OPERATION", "ClientBase"] +_C = TypeVar("_C") +_I = TypeVar("_I", bound=SerializeableShape) +_O = TypeVar("_O", bound=DeserializeableShape) +_T = TypeVar("_T") + + OPERATION = PropertyKey(key="operation", value_type=APIOperation[Any, Any]) """The operation being invoked by the call.""" _CLOSED_MESSAGE = "Cannot invoke an operation on a client that has been closed." -class ClientBase[C]: +class ClientBase(Generic[_C]): """Client machinery shared by the sync and async clients. Setup and call preparation are programs (see ``smithy_core.program``) whose @@ -49,8 +55,8 @@ def __init_subclass__(cls, **kwargs: Any) -> None: def __init__( self, - config: C | None = None, - plugins: list[Callable[[C], None]] | None = None, + config: _C | None = None, + plugins: list[Callable[[_C], None]] | None = None, ) -> None: """ :param config: Optional configuration for the client. Here you can set things @@ -69,7 +75,7 @@ def _new_config(self) -> Any: """Effect: create the config used when none is passed to the constructor.""" raise NotImplementedError - def _post_setup(self, config: C) -> Any: + def _post_setup(self, config: _C) -> Any: """Effect: finish setup that depends on the plugin-applied config.""" return None @@ -81,10 +87,10 @@ def _resolve_retry_strategy(self, config: Any) -> Any: max_attempts=getattr(config, "max_attempts", None), ) - def _build_call[I: SerializeableShape, O: DeserializeableShape]( + def _build_call( self, - input: I, - operation: APIOperation[I, O], + input: _I, + operation: APIOperation[_I, _O], *, config: Any, retry_strategy: Any, @@ -108,12 +114,12 @@ def _build_call[I: SerializeableShape, O: DeserializeableShape]( ) return pipeline, call - def _select_input[I: SerializeableShape, O: DeserializeableShape]( + def _select_input( self, - operation: APIOperation[I, O], + operation: APIOperation[_I, _O], args: tuple[object, ...], members: dict[str, object], - ) -> I | dict[str, Any]: + ) -> _I | dict[str, Any]: """Choose what a generated operation method's input is built from. The method takes either its whole request, positionally, as the input model @@ -150,9 +156,9 @@ def _select_input[I: SerializeableShape, O: DeserializeableShape]( f"got {'None' if request is None else type(request).__name__}" ) - def _build_input[I: SerializeableShape, O: DeserializeableShape]( - self, input: I | dict[str, Any] | None, operation: APIOperation[I, O] - ) -> I: + def _build_input( + self, input: _I | dict[str, Any] | None, operation: APIOperation[_I, _O] + ) -> _I: """Build the input model from the keyword arguments of an operation call. Runs before any client setup, so a call with invalid arguments fails without @@ -181,7 +187,7 @@ def _close(self) -> Program[None]: if (close := getattr(self._transport, "close", None)) is not None: yield close - def _setup(self) -> Program[C]: + def _setup(self) -> Program[_C]: """Resolve the client's base config once; callers hold the setup lock.""" self._raise_if_closed() if not self._setup_done: @@ -203,13 +209,13 @@ def _setup(self) -> Program[C]: self._setup_done = True return self._config - def _prepare[I: SerializeableShape, O: DeserializeableShape]( + def _prepare( self, config: Any, - input: I, - operation: APIOperation[I, O], - default_plugins: list[Callable[[C], None]], - plugins: list[Callable[[C], None]] | None, + input: _I, + operation: APIOperation[_I, _O], + default_plugins: list[Callable[[_C], None]], + plugins: list[Callable[[_C], None]] | None, ) -> Program[Any]: if default_plugins or plugins: # Keep operation-plugin mutations scoped to this call. @@ -235,7 +241,7 @@ def _prepare[I: SerializeableShape, O: DeserializeableShape]( ) -def _copy_config[T](config: T) -> T: +def _copy_config(config: _T) -> _T: """Copy a config and its container fields, sharing the components they hold. Configured components such as interceptors, resolvers and retry strategies diff --git a/packages/smithy-core/src/smithy_core/_dynamic_models.py b/packages/smithy-core/src/smithy_core/_dynamic_models.py index d01888684..0ad9b790a 100644 --- a/packages/smithy-core/src/smithy_core/_dynamic_models.py +++ b/packages/smithy-core/src/smithy_core/_dynamic_models.py @@ -18,14 +18,14 @@ import datetime from base64 import b64decode -from collections.abc import Collection, Mapping, Sequence +from collections.abc import Callable, Collection, Mapping, Sequence from dataclasses import field as _field from dataclasses import make_dataclass from decimal import Decimal from enum import IntEnum, StrEnum from threading import RLock from types import ModuleType -from typing import TYPE_CHECKING, Any, cast, dataclass_transform +from typing import Any, TypeAlias, cast, dataclass_transform from ._model_naming import ( escape_input_member_names, @@ -53,15 +53,12 @@ ) from .types import UnknownEnumMixin -if TYPE_CHECKING: - from collections.abc import Callable - -type _Writer = "Callable[[ShapeSerializer, Schema, Any], None]" -type _Reader = "Callable[[ShapeDeserializer, Schema], Any]" +_Writer: TypeAlias = Callable[[ShapeSerializer, Schema, Any], None] +_Reader: TypeAlias = Callable[[ShapeDeserializer, Schema], Any] # Converts or checks a member's value: (value, redact, in_model) -> value. ``redact`` # is set under a sensitive shape, where keys the caller wrote stay out of errors. # ``in_model`` is set inside a model the caller built, which is checked as it is. -type _InputConverter = "Callable[[Any, bool, bool], Any]" +_InputConverter: TypeAlias = Callable[[Any, bool, bool], Any] # Sequences that are never meant as a list of their elements. _NOT_A_LIST = (str, bytes, bytearray, memoryview) diff --git a/packages/smithy-core/src/smithy_core/_jmespath.py b/packages/smithy-core/src/smithy_core/_jmespath.py index d60b415c2..785b4aa66 100644 --- a/packages/smithy-core/src/smithy_core/_jmespath.py +++ b/packages/smithy-core/src/smithy_core/_jmespath.py @@ -10,13 +10,20 @@ import json import re +import sys from collections.abc import Callable, Iterable from dataclasses import fields, is_dataclass from typing import Any, NamedTuple from ._model_naming import member_field_name -type _Closure = Callable[[Any], Any] +if sys.version_info >= (3, 12): + from typing import TypeAliasType +else: + from typing_extensions import TypeAliasType + + +_Closure = TypeAliasType("_Closure", Callable[[Any], Any]) def compile(expression: str) -> _Closure: diff --git a/packages/smithy-core/src/smithy_core/_pipeline.py b/packages/smithy-core/src/smithy_core/_pipeline.py index c60f0831e..ad67cbdfa 100644 --- a/packages/smithy-core/src/smithy_core/_pipeline.py +++ b/packages/smithy-core/src/smithy_core/_pipeline.py @@ -13,7 +13,7 @@ from copy import copy from dataclasses import replace from functools import partial -from typing import Any, ClassVar, Protocol +from typing import Any, ClassVar, Generic, Protocol, TypeVar from . import URI from .auth import RESOLVED_IDENTITY, AuthParams @@ -53,6 +53,12 @@ __all__ = ["AUTH_SCHEME", "CallLike", "RequestPipelineBase", "is_retryable"] +_I = TypeVar("_I", bound=SerializeableShape) +_O = TypeVar("_O", bound=DeserializeableShape) +_TRequest = TypeVar("_TRequest") +_TResponse = TypeVar("_TResponse") + + AUTH_SCHEME = PropertyKey(key="auth_scheme", value_type=object) """The auth scheme selected for a call. Exposed with a mode-specific type by each client module.""" @@ -60,17 +66,17 @@ _UNRESOLVED = URI(host="", path="/") -class CallLike[I: SerializeableShape, O: DeserializeableShape](Protocol): +class CallLike(Protocol[_I, _O]): """The fields of a client call that the shared pipeline reads.""" @property - def input(self) -> I: ... + def input(self) -> _I: ... @property - def operation(self) -> APIOperation[I, O]: ... + def operation(self) -> APIOperation[_I, _O]: ... @property def context(self) -> TypedProperties: ... @property - def interceptor(self) -> Interceptor[I, O, Any, Any]: ... + def interceptor(self) -> Interceptor[_I, _O, Any, Any]: ... @property def auth_scheme_resolver(self) -> AuthSchemeResolver: ... @property @@ -94,7 +100,7 @@ def is_retryable(operation: APIOperation[Any, Any]) -> bool: return member is None or member.shape_type is not ShapeType.UNION -class RequestPipelineBase[TRequest, TResponse]: +class RequestPipelineBase(Generic[_TRequest, _TResponse]): """Mode-neutral request pipeline. Subclasses supply the protocol and transport and implement the hooks that @@ -115,7 +121,7 @@ def _sleep(self, delay: float) -> Any: raise NotImplementedError def _transmit( - self, request_context: RequestContext[Any, TRequest], request_future: Any + self, request_context: RequestContext[Any, _TRequest], request_future: Any ) -> Any: """Effect: send a request over the transport.""" raise NotImplementedError @@ -123,9 +129,9 @@ def _transmit( def _fail_request_future(self, request_future: Any, error: Exception) -> None: """Report a failure that happened before the request was sent.""" - def _execute[I: SerializeableShape, O: DeserializeableShape]( - self, call: CallLike[I, O], request_future: Any - ) -> Program[tuple[O, OutputContext[I, O, TRequest, TResponse]]]: + def _execute( + self, call: CallLike[_I, _O], request_future: Any + ) -> Program[tuple[_O, OutputContext[_I, _O, _TRequest, _TResponse]]]: self._logger.debug( 'Making request for operation "%s" with parameters: %s', call.operation.schema.id.name, @@ -147,9 +153,9 @@ def _execute[I: SerializeableShape, O: DeserializeableShape]( return output_context.response, output_context # type: ignore - def _attach_response_metadata[I: SerializeableShape, O: DeserializeableShape]( + def _attach_response_metadata( self, - output_context: OutputContext[I, O, TRequest | None, TResponse | None], + output_context: OutputContext[_I, _O, _TRequest | None, _TResponse | None], ) -> None: """Attach metadata about the transport response to the result or error. @@ -183,9 +189,9 @@ def _attach_response_metadata[I: SerializeableShape, O: DeserializeableShape]( # output shape is frozen. self._logger.debug("Unable to attach response metadata: %s", e) - def _handle_execution[I: SerializeableShape, O: DeserializeableShape]( - self, call: CallLike[I, O], request_future: Any - ) -> Program[OutputContext[I, O, TRequest | None, TResponse | None]]: + def _handle_execution( + self, call: CallLike[_I, _O], request_future: Any + ) -> Program[OutputContext[_I, _O, _TRequest | None, _TResponse | None]]: interceptor = call.interceptor input_context = InputContext(request=call.input, properties=call.context) try: @@ -207,7 +213,7 @@ def _handle_execution[I: SerializeableShape, O: DeserializeableShape]( interceptor.read_before_serialization(input_context) self._logger.debug("Serializing request for: %s", input_context.request) - transport_request: TRequest = self.protocol.serialize_request( + transport_request: _TRequest = self.protocol.serialize_request( operation=call.operation, input=input_context.request, endpoint=_UNRESOLVED, @@ -253,12 +259,12 @@ def _handle_execution[I: SerializeableShape, O: DeserializeableShape]( properties=request_context.properties, ) - def _retry[I: SerializeableShape, O: DeserializeableShape]( + def _retry( self, - call: CallLike[I, O], - request_context: RequestContext[I, TRequest], + call: CallLike[_I, _O], + request_context: RequestContext[_I, _TRequest], request_future: Any, - ) -> Program[OutputContext[I, O, TRequest | None, TResponse | None]]: + ) -> Program[OutputContext[_I, _O, _TRequest | None, _TResponse | None]]: body = getattr(request_context.transport_request, "body", None) if ( not call.retryable() @@ -275,9 +281,9 @@ def _retry[I: SerializeableShape, O: DeserializeableShape]( token_scope=call.retry_scope ) - last_output_context: OutputContext[I, O, TRequest, TResponse | None] | None = ( - None - ) + last_output_context: ( + OutputContext[_I, _O, _TRequest, _TResponse | None] | None + ) = None while True: if retry_token.retry_delay: yield partial(self._sleep, retry_token.retry_delay) @@ -338,12 +344,12 @@ def _retry[I: SerializeableShape, O: DeserializeableShape]( yield partial(retry_strategy.record_success, token=retry_token) return output_context - def _send_with_rate_limiting[I: SerializeableShape, O: DeserializeableShape]( + def _send_with_rate_limiting( self, - call: CallLike[I, O], - request_context: RequestContext[I, TRequest], + call: CallLike[_I, _O], + request_context: RequestContext[_I, _TRequest], request_future: Any, - ) -> Program[OutputContext[I, O, TRequest, TResponse | None]]: + ) -> Program[OutputContext[_I, _O, _TRequest, _TResponse | None]]: """Send a single attempt, applying client-side rate limiting (adaptive only). Every attempt, retryable or not, acquires a send token before it is sent. Once a @@ -381,23 +387,23 @@ def _send_with_rate_limiting[I: SerializeableShape, O: DeserializeableShape]( ) return output_context - def _handle_attempt[I: SerializeableShape, O: DeserializeableShape]( + def _handle_attempt( self, - call: CallLike[I, O], - request_context: RequestContext[I, TRequest], + call: CallLike[_I, _O], + request_context: RequestContext[_I, _TRequest], request_future: Any, - ) -> Program[OutputContext[I, O, TRequest, TResponse | None]]: - output_context: OutputContext[I, O, TRequest, TResponse | None] + ) -> Program[OutputContext[_I, _O, _TRequest, _TResponse | None]]: + output_context: OutputContext[_I, _O, _TRequest, _TResponse | None] # A modeled error arrives after the response does, so the response is kept # here to report alongside it. Stays None if nothing came back. - transport_response: TResponse | None = None + transport_response: _TResponse | None = None try: interceptor = call.interceptor interceptor.read_before_attempt(request_context) # The auth scheme and identity resolve before the endpoint, so endpoint # rules can read the identity. - auth_params = AuthParams[I, O]( + auth_params = AuthParams[_I, _O]( protocol_id=self.protocol.id, operation=call.operation, context=request_context.properties, @@ -468,7 +474,7 @@ def _handle_attempt[I: SerializeableShape, O: DeserializeableShape]( signer = scheme.signer() unsigned = request_context.transport_request - signed: TRequest = yield lambda: signer.sign( + signed: _TRequest = yield lambda: signer.sign( request=unsigned, identity=identity, properties=signer_properties, @@ -519,7 +525,7 @@ def _handle_attempt[I: SerializeableShape, O: DeserializeableShape]( "Deserializing response: %s", response_context.transport_response ) - deserialize: Program[O] = self.protocol.deserialize_response_program( + deserialize: Program[_O] = self.protocol.deserialize_response_program( operation=call.operation, request=response_context.transport_request, response=response_context.transport_response, @@ -570,8 +576,8 @@ def _release_response(self, response: Any) -> Program[None]: except Exception as e: self._logger.debug("Unable to close response body: %s", e) - def _resolve_auth[I: SerializeableShape, O: DeserializeableShape]( - self, call: CallLike[Any, Any], params: AuthParams[I, O] + def _resolve_auth( + self, call: CallLike[Any, Any], params: AuthParams[_I, _O] ) -> tuple[AuthOption, Any] | None: auth_options: Sequence[AuthOption] = ( call.auth_scheme_resolver.resolve_auth_scheme(auth_parameters=params) @@ -607,11 +613,11 @@ def _endpoint_auth_scheme( f"signed with {scheme_id}. The client supports {supported}." ) - def _finalize_attempt[I: SerializeableShape, O: DeserializeableShape]( + def _finalize_attempt( self, - call: CallLike[I, O], - output_context: OutputContext[I, O, TRequest, TResponse | None], - ) -> OutputContext[I, O, TRequest, TResponse | None]: + call: CallLike[_I, _O], + output_context: OutputContext[_I, _O, _TRequest, _TResponse | None], + ) -> OutputContext[_I, _O, _TRequest, _TResponse | None]: interceptor = call.interceptor try: output_context = replace( @@ -628,11 +634,11 @@ def _finalize_attempt[I: SerializeableShape, O: DeserializeableShape]( return output_context - def _finalize_execution[I: SerializeableShape, O: DeserializeableShape]( + def _finalize_execution( self, - call: CallLike[I, O], - output_context: OutputContext[I, O, TRequest | None, TResponse | None], - ) -> OutputContext[I, O, TRequest | None, TResponse | None]: + call: CallLike[_I, _O], + output_context: OutputContext[_I, _O, _TRequest | None, _TResponse | None], + ) -> OutputContext[_I, _O, _TRequest | None, _TResponse | None]: interceptor = call.interceptor try: output_context = replace( @@ -694,9 +700,9 @@ def _default_idempotency_token() -> str: return str(uuid.uuid4()) -def _fill_idempotency_token[I: SerializeableShape]( - input: I, operation: APIOperation[I, Any], logger: logging.Logger -) -> I: +def _fill_idempotency_token( + input: _I, operation: APIOperation[_I, Any], logger: logging.Logger +) -> _I: """Return the input with its idempotency token set, if the caller left it unset. A token set by the caller or by an interceptor is sent as-is. The caller's input diff --git a/packages/smithy-core/src/smithy_core/_schema_compact.py b/packages/smithy-core/src/smithy_core/_schema_compact.py index ce36b131e..6d94a2c66 100644 --- a/packages/smithy-core/src/smithy_core/_schema_compact.py +++ b/packages/smithy-core/src/smithy_core/_schema_compact.py @@ -26,29 +26,38 @@ id -> value for valued/unknown traits (also carrying any valueless ones present). """ +import sys import threading from collections.abc import Callable -from typing import TYPE_CHECKING, Any, Final, cast +from typing import TYPE_CHECKING, Any, Final, TypeAlias, cast from . import prelude from .schemas import Schema from .shapes import ShapeID, ShapeType from .traits import DynamicTrait, Trait +if sys.version_info >= (3, 12): + from typing import TypeAliasType +else: + from typing_extensions import TypeAliasType + + if TYPE_CHECKING: from .documents import DocumentValue _ENCODING_VERSION: Final = 2 -type StaticSchema = tuple[Any, ...] +StaticSchema = TypeAliasType("StaticSchema", tuple[Any, ...]) # A member target: a prelude int, a sibling tuple, or a lambda returning one. A built # Schema is also accepted so an operation can be hand-initialized with real schemas. -type StaticSchemaRef = int | StaticSchema | Schema | Callable[[], "StaticSchemaRef"] -type StaticSchemaTraits = int | dict[str, "DocumentValue"] +StaticSchemaRef: TypeAlias = ( + int | StaticSchema | Schema | Callable[[], "StaticSchemaRef"] +) +StaticSchemaTraits: TypeAlias = int | dict[str, "DocumentValue"] # Permissive (not a fixed-arity tuple) so a generated operation literal -- whose # nested refs and valued-trait dicts have partially-inferred element types -- still # assigns under strict type checking. -type StaticOperationSchema = tuple[Any, ...] +StaticOperationSchema = TypeAliasType("StaticOperationSchema", tuple[Any, ...]) # Prelude integer substitutes. Index == the prelude shape's ShapeType value, so a # bare simple-shape type int doubles as its prelude reference. diff --git a/packages/smithy-core/src/smithy_core/aio/client.py b/packages/smithy-core/src/smithy_core/aio/client.py index feaef8770..94ed430e8 100644 --- a/packages/smithy-core/src/smithy_core/aio/client.py +++ b/packages/smithy-core/src/smithy_core/aio/client.py @@ -5,7 +5,7 @@ import logging from asyncio import Future, sleep from collections.abc import Awaitable, Callable -from typing import TYPE_CHECKING, Any, ClassVar, Self +from typing import TYPE_CHECKING, Any, ClassVar, Generic, Self, TypeVar from smithy_core.interfaces import ClientProtocol, Request, Response @@ -41,24 +41,33 @@ from .interfaces.eventstream import AsyncEventPublisher +_C = TypeVar("_C") +_I = TypeVar("_I", bound=SerializeableShape) +_IE = TypeVar("_IE", bound=SerializeableShape) +_O = TypeVar("_O", bound=DeserializeableShape) +_OE = TypeVar("_OE", bound=DeserializeableShape) +_TRequest = TypeVar("_TRequest", bound=Request) +_TResponse = TypeVar("_TResponse", bound=Response) + + AUTH_SCHEME = PropertyKey( key="auth_scheme", value_type=AsyncAuthScheme[Any, Any, Any, Any] ) """Property key for the auth scheme selected for the call.""" -class AsyncRequestPipeline[TRequest: Request, TResponse: Response]( - RequestPipelineBase[TRequest, TResponse] +class AsyncRequestPipeline( + RequestPipelineBase[_TRequest, _TResponse], Generic[_TRequest, _TResponse] ): """Invokes client operations asynchronously.""" - protocol: ClientProtocol[TRequest, TResponse] + protocol: ClientProtocol[_TRequest, _TResponse] """The protocol to use to serialize the request and deserialize the response. Event stream operations need an :py:class:`AsyncClientProtocol`. """ - transport: AsyncClientTransport[TRequest, TResponse] + transport: AsyncClientTransport[_TRequest, _TResponse] """The transport to use to send the request and receive the response (e.g. an HTTP Client).""" @@ -66,15 +75,13 @@ class AsyncRequestPipeline[TRequest: Request, TResponse: Response]( def __init__( self, - protocol: ClientProtocol[TRequest, TResponse], - transport: AsyncClientTransport[TRequest, TResponse], + protocol: ClientProtocol[_TRequest, _TResponse], + transport: AsyncClientTransport[_TRequest, _TResponse], ) -> None: self.protocol = protocol self.transport = transport - async def __call__[I: SerializeableShape, O: DeserializeableShape]( - self, call: ClientCall[I, O], / - ) -> O: + async def __call__(self, call: ClientCall[_I, _O], /) -> _O: """Invoke an operation asynchronously. :param call: The operation to invoke and associated context. @@ -82,19 +89,15 @@ async def __call__[I: SerializeableShape, O: DeserializeableShape]( output, _ = await self._execute_request(call, None) return output - async def input_stream[ - I: SerializeableShape, - O: DeserializeableShape, - E: SerializeableShape, - ]( - self, call: ClientCall[I, O], event_type: "TypeForm[E]", / - ) -> AsyncInputEventStream[E, O]: + async def input_stream( + self, call: ClientCall[_I, _O], event_type: "TypeForm[_IE]", / + ) -> AsyncInputEventStream[_IE, _O]: """Invoke an input stream operation asynchronously. :param call: The operation to invoke and associated context. :param event_type: The event type to send in the input stream. """ - request_future = Future[RequestContext[I, TRequest]]() + request_future = Future[RequestContext[_I, _TRequest]]() output_future = asyncio.create_task( self._await_output(self._execute_request(call, request_future)) ) @@ -105,17 +108,13 @@ async def input_stream[ input_stream=input_stream, output_future=output_future ) - async def output_stream[ - I: SerializeableShape, - O: DeserializeableShape, - E: DeserializeableShape, - ]( + async def output_stream( self, - call: ClientCall[I, O], - event_type: "TypeForm[E]", - event_deserializer: Callable[[ShapeDeserializer], E], + call: ClientCall[_I, _O], + event_type: "TypeForm[_OE]", + event_deserializer: Callable[[ShapeDeserializer], _OE], /, - ) -> AsyncOutputEventStream[E, O]: + ) -> AsyncOutputEventStream[_OE, _O]: """Invoke an input stream operation asynchronously. :param call: The operation to invoke and associated context. @@ -133,19 +132,14 @@ async def output_stream[ ) return AsyncOutputEventStream(output_stream=output_stream, output=output) - async def duplex_stream[ - I: SerializeableShape, - O: DeserializeableShape, - IE: SerializeableShape, - OE: DeserializeableShape, - ]( + async def duplex_stream( self, - call: ClientCall[I, O], - input_event_type: "TypeForm[IE]", - output_event_type: "TypeForm[OE]", - event_deserializer: Callable[[ShapeDeserializer], OE], + call: ClientCall[_I, _O], + input_event_type: "TypeForm[_IE]", + output_event_type: "TypeForm[_OE]", + event_deserializer: Callable[[ShapeDeserializer], _OE], /, - ) -> AsyncDuplexEventStream[IE, OE, O]: + ) -> AsyncDuplexEventStream[_IE, _OE, _O]: """Invoke an input stream operation asynchronously. :param call: The operation to invoke and associated context. @@ -165,7 +159,7 @@ async def duplex_stream[ f"support duplex streaming can implement AsyncDuplexClientTransport " f"by setting SUPPORTS_DUPLEX_STREAMING to True." ) - request_future = Future[RequestContext[I, TRequest]]() + request_future = Future[RequestContext[_I, _TRequest]]() execute_task = asyncio.create_task(self._execute_request(call, request_future)) input_stream = await self._start_publisher( call, input_event_type, request_future, execute_task @@ -182,13 +176,13 @@ async def duplex_stream[ input_stream=input_stream, output_future=output_future ) - async def _start_publisher[I: SerializeableShape, E: SerializeableShape]( + async def _start_publisher( self, - call: ClientCall[I, Any], - event_type: "TypeForm[E]", - request_future: Future[RequestContext[I, TRequest]], + call: ClientCall[_I, Any], + event_type: "TypeForm[_IE]", + request_future: Future[RequestContext[_I, _TRequest]], execute_task: "asyncio.Task[Any]", - ) -> "AsyncEventPublisher[E]": + ) -> "AsyncEventPublisher[_IE]": request_context = await request_future try: return await self._event_stream_protocol().create_event_publisher( @@ -206,24 +200,24 @@ async def _start_publisher[I: SerializeableShape, E: SerializeableShape]( await execute_task raise - async def _await_output[I: SerializeableShape, O: DeserializeableShape]( + async def _await_output( self, - execute_task: Awaitable[tuple[O, OutputContext[I, O, TRequest, TResponse]]], - ) -> O: + execute_task: Awaitable[ + tuple[_O, OutputContext[_I, _O, _TRequest, _TResponse]] + ], + ) -> _O: output, _ = await execute_task return output - async def _await_output_stream[ - I: SerializeableShape, - O: DeserializeableShape, - OE: DeserializeableShape, - ]( + async def _await_output_stream( self, - call: ClientCall[I, O], - execute_task: Awaitable[tuple[O, OutputContext[I, O, TRequest, TResponse]]], - output_event_type: "TypeForm[OE]", - event_deserializer: Callable[[ShapeDeserializer], OE], - ) -> tuple[O, AsyncEventReceiver[OE]]: + call: ClientCall[_I, _O], + execute_task: Awaitable[ + tuple[_O, OutputContext[_I, _O, _TRequest, _TResponse]] + ], + output_event_type: "TypeForm[_OE]", + event_deserializer: Callable[[ShapeDeserializer], _OE], + ) -> tuple[_O, AsyncEventReceiver[_OE]]: output, output_context = await execute_task output_stream = self._event_stream_protocol().create_event_receiver( operation=call.operation, @@ -235,14 +229,14 @@ async def _await_output_stream[ ) return output, output_stream - async def _execute_request[I: SerializeableShape, O: DeserializeableShape]( + async def _execute_request( self, - call: ClientCall[I, O], - request_future: Future[RequestContext[I, TRequest]] | None, - ) -> tuple[O, OutputContext[I, O, TRequest, TResponse]]: + call: ClientCall[_I, _O], + request_future: Future[RequestContext[_I, _TRequest]] | None, + ) -> tuple[_O, OutputContext[_I, _O, _TRequest, _TResponse]]: return await run_program_async(self._execute(call, request_future)) - def _event_stream_protocol(self) -> AsyncClientProtocol[TRequest, TResponse]: + def _event_stream_protocol(self) -> AsyncClientProtocol[_TRequest, _TResponse]: if not isinstance(self.protocol, AsyncClientProtocol): raise UnsupportedStreamError( f"The configured protocol ({type(self.protocol).__name__}) does not " @@ -258,9 +252,9 @@ async def _sleep(self, delay: float) -> None: async def _transmit( self, - request_context: RequestContext[Any, TRequest], - request_future: Future[RequestContext[Any, TRequest]] | None, - ) -> TResponse: + request_context: RequestContext[Any, _TRequest], + request_future: Future[RequestContext[Any, _TRequest]] | None, + ) -> _TResponse: if request_future is None: # If we don't have an input stream, there's no point in creating a # task, so we just immediately await the coroutine. @@ -278,14 +272,14 @@ async def _transmit( def _fail_request_future( self, - request_future: Future[RequestContext[Any, TRequest]] | None, + request_future: Future[RequestContext[Any, _TRequest]] | None, error: Exception, ) -> None: if request_future is not None and not request_future.done(): request_future.set_exception(error) -class AsyncClient[C](_ClientBase[C]): +class AsyncClient(_ClientBase[_C], Generic[_C]): """Shared async client machinery: lifecycle, setup gating, and call dispatch. Generated clients subclass this with their config type and supply @@ -297,8 +291,8 @@ class AsyncClient[C](_ClientBase[C]): def __init__( self, - config: C | None = None, - plugins: list[Callable[[C], None]] | None = None, + config: _C | None = None, + plugins: list[Callable[[_C], None]] | None = None, ) -> None: super().__init__(config, plugins) self._derive_lock = asyncio.Lock() @@ -318,31 +312,31 @@ async def close(self) -> None: async with self._derive_lock: await run_program_async(self._close()) - async def _ensure_setup(self) -> C: + async def _ensure_setup(self) -> _C: if not self._setup_done: async with self._derive_lock: return await run_program_async(self._setup()) return self._config - async def _invoke[I: SerializeableShape, O: DeserializeableShape]( + async def _invoke( self, - input: I | dict[str, Any] | None, - operation: APIOperation[I, O], - default_plugins: list[Callable[[C], None]], - plugins: list[Callable[[C], None]] | None, - ) -> O: + input: _I | dict[str, Any] | None, + operation: APIOperation[_I, _O], + default_plugins: list[Callable[[_C], None]], + plugins: list[Callable[[_C], None]] | None, + ) -> _O: pipeline, call = await self._prepare_call( input, operation, default_plugins, plugins ) return await pipeline(call) - async def _prepare_call[I: SerializeableShape, O: DeserializeableShape]( + async def _prepare_call( self, - input: I | dict[str, Any] | None, - operation: APIOperation[I, O], - default_plugins: list[Callable[[C], None]], - plugins: list[Callable[[C], None]] | None, - ) -> tuple[AsyncRequestPipeline[Any, Any], ClientCall[I, O]]: + input: _I | dict[str, Any] | None, + operation: APIOperation[_I, _O], + default_plugins: list[Callable[[_C], None]], + plugins: list[Callable[[_C], None]] | None, + ) -> tuple[AsyncRequestPipeline[Any, Any], ClientCall[_I, _O]]: model = self._build_input(input, operation) self._raise_if_closed() config = await self._ensure_setup() diff --git a/packages/smithy-core/src/smithy_core/aio/eventstream.py b/packages/smithy-core/src/smithy_core/aio/eventstream.py index 2f4fdcc8f..98c589bb5 100644 --- a/packages/smithy-core/src/smithy_core/aio/eventstream.py +++ b/packages/smithy-core/src/smithy_core/aio/eventstream.py @@ -1,7 +1,7 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 from asyncio import Future -from typing import Any, Self +from typing import Any, Generic, Self, TypeVar from ..deserializers import DeserializeableShape from ..serializers import SerializeableShape @@ -13,12 +13,13 @@ "AsyncOutputEventStream", ] +_IE = TypeVar("_IE", bound=SerializeableShape) +_O = TypeVar("_O", bound=DeserializeableShape) +_Output = TypeVar("_Output") +_OE = TypeVar("_OE", bound=DeserializeableShape) -class AsyncDuplexEventStream[ - IE: SerializeableShape, - OE: DeserializeableShape, - O: DeserializeableShape, -]: + +class AsyncDuplexEventStream(Generic[_IE, _OE, _O]): """An event stream that both sends and receives messages. To ensure that streams are closed upon exiting, this class may be used as an async @@ -55,10 +56,10 @@ async def handle_output(stream: EventStream) -> None: return """ - input_stream: AsyncEventPublisher[IE] + input_stream: AsyncEventPublisher[_IE] """An event stream that sends events to the service.""" - output_stream: AsyncEventReceiver[OE] | None = None + output_stream: AsyncEventReceiver[_OE] | None = None """An event stream that receives events from the service. This value may be None until ``await_output`` has been called. @@ -66,7 +67,7 @@ async def handle_output(stream: EventStream) -> None: This value will also be None if the operation has no output stream. """ - output: O | None = None + output: _O | None = None """The initial response from the service. This value may be None until ``await_output`` has been called. @@ -78,8 +79,8 @@ async def handle_output(stream: EventStream) -> None: def __init__( self, *, - input_stream: AsyncEventPublisher[IE], - output_future: Future[tuple[O, AsyncEventReceiver[OE]]], + input_stream: AsyncEventPublisher[_IE], + output_future: Future[tuple[_O, AsyncEventReceiver[_OE]]], ) -> None: self.input_stream = input_stream self._output_future = output_future @@ -90,7 +91,7 @@ async def __aenter__(self) -> Self: async def __aexit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None: await self.close() - async def await_output(self) -> tuple[O, AsyncEventReceiver[OE]]: + async def await_output(self) -> tuple[_O, AsyncEventReceiver[_OE]]: """Await the operation's output. The EventStream will be returned as soon as the input stream is ready to @@ -124,7 +125,7 @@ async def close(self) -> None: await self.output_stream.close() -class AsyncInputEventStream[IE: SerializeableShape, O]: +class AsyncInputEventStream(Generic[_IE, _Output]): """An event stream that streams messages to the service. To ensure that streams are closed upon exiting, this class may be used as an async @@ -143,10 +144,10 @@ async def main(): await stream.await_output() """ - input_stream: AsyncEventPublisher[IE] + input_stream: AsyncEventPublisher[_IE] """An event stream that sends events to the service.""" - output: O | None = None + output: _Output | None = None """The initial response from the service. This value may be None until ``await_output`` has been called. @@ -158,8 +159,8 @@ async def main(): def __init__( self, *, - input_stream: AsyncEventPublisher[IE], - output_future: Future[O], + input_stream: AsyncEventPublisher[_IE], + output_future: Future[_Output], ) -> None: self.input_stream = input_stream self._output_future = output_future @@ -170,7 +171,7 @@ async def __aenter__(self) -> Self: async def __aexit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None: await self.close() - async def await_output(self) -> O: + async def await_output(self) -> _Output: """Await the operation's initial response. The EventStream will be returned as soon as the input stream is ready to receive @@ -190,7 +191,7 @@ async def close(self) -> None: await self.input_stream.close() -class AsyncOutputEventStream[OE: DeserializeableShape, O: DeserializeableShape]: +class AsyncOutputEventStream(Generic[_OE, _O]): """An event stream that streams messages from the service. To ensure that streams are closed upon exiting, this class may be used as an async @@ -211,20 +212,20 @@ async def main(): return """ - output_stream: AsyncEventReceiver[OE] + output_stream: AsyncEventReceiver[_OE] """An event stream that receives events from the service. This value will also be None if the operation has no output stream. """ - output: O + output: _O """The initial response from the service. This may include context necessary to interpret output events or prepare input events. It will always be available before any events. """ - def __init__(self, output_stream: AsyncEventReceiver[OE], output: O) -> None: + def __init__(self, output_stream: AsyncEventReceiver[_OE], output: _O) -> None: self.output_stream = output_stream self.output = output diff --git a/packages/smithy-core/src/smithy_core/aio/identity.py b/packages/smithy-core/src/smithy_core/aio/identity.py index 47033b169..6300c3a38 100644 --- a/packages/smithy-core/src/smithy_core/aio/identity.py +++ b/packages/smithy-core/src/smithy_core/aio/identity.py @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 import logging from collections.abc import Mapping, Sequence -from typing import Any, Final +from typing import Any, Final, Generic, TypeVar from ..identity import ( _cached_identity, # pyright: ignore[reportPrivateUsage] @@ -15,19 +15,23 @@ __all__ = ["AsyncCachingIdentityResolver", "AsyncChainedIdentityResolver"] +_I_co = TypeVar("_I_co", bound=Identity, covariant=True) +_IP_contra = TypeVar("_IP_contra", bound=Mapping[str, Any], contravariant=True) + + logger: Final = logging.getLogger(__name__) # TODO: turn this into a decorator -class AsyncCachingIdentityResolver[I: Identity, IP: Mapping[str, Any]]( - AsyncIdentityResolver[I, IP] +class AsyncCachingIdentityResolver( + AsyncIdentityResolver[_I_co, _IP_contra], Generic[_I_co, _IP_contra] ): """Identity resolver that caches its identity until it expires.""" def __init__(self) -> None: - self._cached: I | None = None + self._cached: _I_co | None = None - async def get_identity(self, *, properties: IP) -> I: + async def get_identity(self, *, properties: _IP_contra) -> _I_co: return await run_program_async( _cached_identity(self, lambda: self._get_identity(properties=properties)) # pyright: ignore[reportPrivateUsage] ) @@ -36,12 +40,12 @@ async def invalidate(self) -> None: """Discard the cached identity so the next resolution re-reads its source.""" self._cached = None - async def _get_identity(self, *, properties: IP) -> I: + async def _get_identity(self, *, properties: _IP_contra) -> _I_co: raise NotImplementedError -class AsyncChainedIdentityResolver[I: Identity, IP: Mapping[str, Any]]( - AsyncCachingIdentityResolver[I, IP] +class AsyncChainedIdentityResolver( + AsyncCachingIdentityResolver[_I_co, _IP_contra], Generic[_I_co, _IP_contra] ): """Attempts to resolve an identity by checking a sequence of sub-resolvers. @@ -49,7 +53,9 @@ class AsyncChainedIdentityResolver[I: Identity, IP: Mapping[str, Any]]( resolver in the chain will be attempted. """ - def __init__(self, resolvers: Sequence[AsyncIdentityResolver[I, IP]]) -> None: + def __init__( + self, resolvers: Sequence[AsyncIdentityResolver[_I_co, _IP_contra]] + ) -> None: """Construct a AsyncChainedIdentityResolver. :param resolvers: The sequence of resolvers to resolve identity from. @@ -62,7 +68,7 @@ async def invalidate(self) -> None: await super().invalidate() await run_program_async(_invalidate_all(self._resolvers)) # pyright: ignore[reportPrivateUsage] - async def _get_identity(self, *, properties: IP) -> I: + async def _get_identity(self, *, properties: _IP_contra) -> _I_co: return await run_program_async( _resolve_from_chain(self._resolvers, properties) # pyright: ignore[reportPrivateUsage] ) diff --git a/packages/smithy-core/src/smithy_core/aio/interfaces/__init__.py b/packages/smithy-core/src/smithy_core/aio/interfaces/__init__.py index 11ea37478..c4277d1c8 100644 --- a/packages/smithy-core/src/smithy_core/aio/interfaces/__init__.py +++ b/packages/smithy-core/src/smithy_core/aio/interfaces/__init__.py @@ -1,7 +1,8 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 +import sys from collections.abc import Callable -from typing import TYPE_CHECKING, Any, Literal, Protocol, runtime_checkable +from typing import TYPE_CHECKING, Any, Literal, Protocol, TypeVar, runtime_checkable from ...exceptions import UnsupportedStreamError from ...interfaces import ( @@ -15,6 +16,12 @@ from ...interfaces import ProtocolSettings as ProtocolSettings from .eventstream import AsyncEventPublisher, AsyncEventReceiver +if sys.version_info >= (3, 12): + from typing import TypeAliasType +else: + from typing_extensions import TypeAliasType + + if TYPE_CHECKING: from typing_extensions import TypeForm @@ -25,6 +32,15 @@ from ...serializers import SerializeableShape from .auth import AsyncAuthScheme +_IE = TypeVar("_IE", bound="SerializeableShape") +_OE = TypeVar("_OE", bound="DeserializeableShape") +_I = TypeVar("_I", bound=Request) +_I_contra = TypeVar("_I_contra", bound=Request, contravariant=True) +_O_co = TypeVar("_O_co", bound=Response, covariant=True) +_O_contra = TypeVar("_O_contra", bound=Response, contravariant=True) +_OperationInput = TypeVar("_OperationInput", bound="SerializeableShape") +_OperationOutput = TypeVar("_OperationOutput", bound="DeserializeableShape") + @runtime_checkable class AsyncByteStream(Protocol): @@ -44,7 +60,7 @@ async def write(self, data: bytes) -> None: ... -type StreamingBlob = AnyStreamingBlob +StreamingBlob = TypeAliasType("StreamingBlob", AnyStreamingBlob) class AsyncEndpointResolver(Protocol): @@ -63,7 +79,7 @@ async def resolve_endpoint( ... -class AsyncClientTransport[I: Request, O: Response](Protocol): +class AsyncClientTransport(Protocol[_I_contra, _O_co]): """Protocol-agnostic representation of a client transport (e.g. an HTTP client). Transports that support duplex (bidirectional) event streaming can implement @@ -72,13 +88,13 @@ class AsyncClientTransport[I: Request, O: Response](Protocol): TIMEOUT_EXCEPTIONS: tuple[type[Exception], ...] - async def send(self, request: I) -> O: + async def send(self, request: _I_contra) -> _O_co: """Send a request over the transport and receive the response.""" ... -class AsyncDuplexClientTransport[I: Request, O: Response]( - AsyncClientTransport[I, O], Protocol +class AsyncDuplexClientTransport( + AsyncClientTransport[_I_contra, _O_co], Protocol[_I_contra, _O_co] ): """A client transport that supports duplex (bidirectional) event streaming. @@ -90,22 +106,18 @@ class AsyncDuplexClientTransport[I: Request, O: Response]( @runtime_checkable -class AsyncClientProtocol[I: Request, O: Response](ClientProtocol[I, O], Protocol): +class AsyncClientProtocol(ClientProtocol[_I, _O_contra], Protocol[_I, _O_contra]): """A client protocol that also supports event streams for async clients.""" - async def create_event_publisher[ - OperationInput: "SerializeableShape", - OperationOutput: "DeserializeableShape", - Event: "SerializeableShape", - ]( + async def create_event_publisher( self, *, - operation: "APIOperation[OperationInput, OperationOutput]", - request: I, - event_type: "TypeForm[Event]", + operation: "APIOperation[_OperationInput, _OperationOutput]", + request: _I, + event_type: "TypeForm[_IE]", context: TypedProperties, auth_scheme: "AsyncAuthScheme[Any, Any, Any, Any] | None" = None, - ) -> AsyncEventPublisher[Event]: + ) -> AsyncEventPublisher[_IE]: """Creates an event publisher for a protocol event stream. :param operation: The event stream operation. @@ -116,20 +128,16 @@ async def create_event_publisher[ """ raise UnsupportedStreamError() - def create_event_receiver[ - OperationInput: "SerializeableShape", - OperationOutput: "DeserializeableShape", - Event: "DeserializeableShape", - ]( + def create_event_receiver( self, *, - operation: "APIOperation[OperationInput, OperationOutput]", - request: I, - response: O, - event_type: "TypeForm[Event]", - event_deserializer: Callable[["ShapeDeserializer"], Event], + operation: "APIOperation[_OperationInput, _OperationOutput]", + request: _I, + response: _O_contra, + event_type: "TypeForm[_OE]", + event_deserializer: Callable[["ShapeDeserializer"], _OE], context: TypedProperties, - ) -> AsyncEventReceiver[Event]: + ) -> AsyncEventReceiver[_OE]: """Creates an event receiver for a protocol event stream. :param operation: The event stream operation. diff --git a/packages/smithy-core/src/smithy_core/aio/interfaces/auth.py b/packages/smithy-core/src/smithy_core/aio/interfaces/auth.py index fa1944eb4..df4422b1f 100644 --- a/packages/smithy-core/src/smithy_core/aio/interfaces/auth.py +++ b/packages/smithy-core/src/smithy_core/aio/interfaces/auth.py @@ -1,7 +1,7 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 from collections.abc import Mapping -from typing import Any, Protocol +from typing import Any, Protocol, TypeVar from smithy_core.interfaces import Request @@ -11,11 +11,20 @@ from ...shapes import ShapeID from .identity import AsyncIdentityResolver +_I_contra = TypeVar("_I_contra", contravariant=True) +_AuthIdentity = TypeVar("_AuthIdentity", bound=Identity) +_IP = TypeVar("_IP", bound=Mapping[str, Any]) +_R = TypeVar("_R", bound=Request) +_SP = TypeVar("_SP", bound=Mapping[str, Any]) +_SP_contra = TypeVar("_SP_contra", bound=Mapping[str, Any], contravariant=True) -class AsyncSigner[R: Request, I, SP: Mapping[str, Any]](Protocol): + +class AsyncSigner(Protocol[_R, _I_contra, _SP_contra]): """A class that signs requests before they are sent.""" - async def sign(self, *, request: R, identity: I, properties: SP) -> R: + async def sign( + self, *, request: _R, identity: _I_contra, properties: _SP_contra + ) -> _R: """Get a signed version of the request. :param request: The request to be signed. @@ -25,18 +34,13 @@ async def sign(self, *, request: R, identity: I, properties: SP) -> R: ... -class AsyncAuthScheme[ - R: Request, - I: Identity, - IP: Mapping[str, Any], - SP: Mapping[str, Any], -](Protocol): +class AsyncAuthScheme(Protocol[_R, _AuthIdentity, _IP, _SP]): """A class that coordinates identity and auth.""" scheme_id: ShapeID """The ID of the auth scheme.""" - def identity_properties(self, *, context: _TypedProperties) -> IP: + def identity_properties(self, *, context: _TypedProperties) -> _IP: """Construct identity properties from the request context. The context will always include the client's config under "config". Other @@ -48,7 +52,7 @@ def identity_properties(self, *, context: _TypedProperties) -> IP: def identity_resolver( self, *, context: _TypedProperties - ) -> AsyncIdentityResolver[I, IP]: + ) -> AsyncIdentityResolver[_AuthIdentity, _IP]: """Get an identity resolver for the request. The context will always include the client's config under "config". Other @@ -58,7 +62,7 @@ def identity_resolver( """ ... - def signer_properties(self, *, context: _TypedProperties) -> SP: + def signer_properties(self, *, context: _TypedProperties) -> _SP: """Construct signer properties from the request context. The context will always include the client's config under "config". Other @@ -68,14 +72,16 @@ def signer_properties(self, *, context: _TypedProperties) -> SP: """ ... - def signer(self) -> AsyncSigner[R, I, SP] | Signer[R, I, SP]: + def signer( + self, + ) -> AsyncSigner[_R, _AuthIdentity, _SP] | Signer[_R, _AuthIdentity, _SP]: """Get a signer for the request. Signers that do no I/O may be synchronous. """ ... - def event_signer(self, *, request: R) -> EventSigner[I, SP] | None: + def event_signer(self, *, request: _R) -> EventSigner[_AuthIdentity, _SP] | None: """Construct a signer for event stream events. :param request: The request that will initiate the event stream. The request diff --git a/packages/smithy-core/src/smithy_core/aio/interfaces/eventstream.py b/packages/smithy-core/src/smithy_core/aio/interfaces/eventstream.py index a27f413b1..4f6c8f64e 100644 --- a/packages/smithy-core/src/smithy_core/aio/interfaces/eventstream.py +++ b/packages/smithy-core/src/smithy_core/aio/interfaces/eventstream.py @@ -1,12 +1,15 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 -from typing import Any, Protocol, Self +from typing import Any, Protocol, Self, TypeVar from ...deserializers import DeserializeableShape from ...serializers import SerializeableShape +_IE_contra = TypeVar("_IE_contra", bound=SerializeableShape, contravariant=True) +_OE_co = TypeVar("_OE_co", bound=DeserializeableShape, covariant=True) -class AsyncEventPublisher[E: SerializeableShape](Protocol): + +class AsyncEventPublisher(Protocol[_IE_contra]): """Asynchronously sends events to a service. This may be used as a context manager to ensure the stream is closed before exiting. @@ -18,7 +21,7 @@ async def __aenter__(self) -> Self: async def __aexit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None: await self.close() - async def send(self, event: E) -> None: + async def send(self, event: _IE_contra) -> None: """Sends an event to the service. :param event: The event to send. @@ -30,7 +33,7 @@ async def close(self) -> None: ... -class AsyncEventReceiver[E: DeserializeableShape](Protocol): +class AsyncEventReceiver(Protocol[_OE_co]): """Asynchronously receives events from a service. Events may be received via the ``receive`` method or by using this class as @@ -40,7 +43,7 @@ class AsyncEventReceiver[E: DeserializeableShape](Protocol): exiting. """ - async def __anext__(self) -> E: + async def __anext__(self) -> _OE_co: result = await self.receive() if result is None: await self.close() @@ -56,7 +59,7 @@ async def __aenter__(self) -> Self: async def __aexit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None: await self.close() - async def receive(self) -> E | None: + async def receive(self) -> _OE_co | None: """Receive a single event from the service. :returns: An event or None. None indicates that no more events will be sent by diff --git a/packages/smithy-core/src/smithy_core/aio/interfaces/identity.py b/packages/smithy-core/src/smithy_core/aio/interfaces/identity.py index cc898bc26..edd6eb532 100644 --- a/packages/smithy-core/src/smithy_core/aio/interfaces/identity.py +++ b/packages/smithy-core/src/smithy_core/aio/interfaces/identity.py @@ -1,18 +1,21 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 from collections.abc import Mapping -from typing import Any, Protocol +from typing import Any, Protocol, TypeVar from ...interfaces.identity import Identity +_I_co = TypeVar("_I_co", bound=Identity, covariant=True) +_IP_contra = TypeVar("_IP_contra", bound=Mapping[str, Any], contravariant=True) -class AsyncIdentityResolver[I: Identity, IP: Mapping[str, Any]](Protocol): + +class AsyncIdentityResolver(Protocol[_I_co, _IP_contra]): """Used to load a user's `Identity` from a given source. Each `Identity` may have one or more resolver implementations. """ - async def get_identity(self, *, properties: IP) -> I: + async def get_identity(self, *, properties: _IP_contra) -> _I_co: """Load the user's identity from this resolver. :param properties: Properties used to help determine the identity to return. diff --git a/packages/smithy-core/src/smithy_core/aio/program.py b/packages/smithy-core/src/smithy_core/aio/program.py index d9d0858db..7708dc5df 100644 --- a/packages/smithy-core/src/smithy_core/aio/program.py +++ b/packages/smithy-core/src/smithy_core/aio/program.py @@ -1,14 +1,16 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 from inspect import isawaitable -from typing import Any +from typing import Any, TypeVar from ..program import Program __all__ = ["run_program_async"] +_T = TypeVar("_T") -async def run_program_async[T](program: Program[T]) -> T: + +async def run_program_async(program: Program[_T]) -> _T: """Drive a program to completion, awaiting each effect that returns an awaitable.""" value: Any = None error: BaseException | None = None diff --git a/packages/smithy-core/src/smithy_core/aio/utils.py b/packages/smithy-core/src/smithy_core/aio/utils.py index b49a7cd97..d07958e51 100644 --- a/packages/smithy-core/src/smithy_core/aio/utils.py +++ b/packages/smithy-core/src/smithy_core/aio/utils.py @@ -3,7 +3,7 @@ from asyncio import iscoroutine, sleep from collections.abc import AsyncIterable, Iterable from inspect import isawaitable -from typing import Any +from typing import Any, TypeVar from .._pipeline import _seek # pyright: ignore[reportPrivateUsage] from ..utils import read_streaming_blob @@ -17,8 +17,10 @@ "seek_async", ] +_E = TypeVar("_E") -async def list_async[E](lst: Iterable[E]) -> AsyncIterable[E]: + +async def list_async(lst: Iterable[_E]) -> AsyncIterable[_E]: """Turn an Iterable into an AsyncIterable.""" for x in lst: await sleep(0) diff --git a/packages/smithy-core/src/smithy_core/auth.py b/packages/smithy-core/src/smithy_core/auth.py index 44cc6a315..a39429577 100644 --- a/packages/smithy-core/src/smithy_core/auth.py +++ b/packages/smithy-core/src/smithy_core/auth.py @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 from collections.abc import Sequence from dataclasses import dataclass, field -from typing import Any +from typing import Any, Generic, TypeVar from .deserializers import DeserializeableShape from .interfaces import TypedProperties as _TypedProperties @@ -20,6 +20,10 @@ "NoAuthResolver", ] +_I_co = TypeVar("_I_co", bound=SerializeableShape, covariant=True) +_O_co = TypeVar("_O_co", bound=DeserializeableShape, covariant=True) + + RESOLVED_IDENTITY: PropertyKey[_Identity] = PropertyKey( key="resolved_identity", value_type=_Identity ) @@ -27,13 +31,13 @@ @dataclass(kw_only=True, frozen=True) -class AuthParams[I: SerializeableShape, O: DeserializeableShape]: +class AuthParams(Generic[_I_co, _O_co]): """Parameters passed to an AuthSchemeResolver's ``resolve_auth_scheme`` method.""" protocol_id: ShapeID """The ID of the protocol being used for the operation invocation.""" - operation: APIOperation[I, O] = field(repr=False) + operation: APIOperation[_I_co, _O_co] = field(repr=False) """The schema and associated information about the operation being invoked.""" context: _TypedProperties diff --git a/packages/smithy-core/src/smithy_core/client.py b/packages/smithy-core/src/smithy_core/client.py index aef2b1caf..a899e5d13 100644 --- a/packages/smithy-core/src/smithy_core/client.py +++ b/packages/smithy-core/src/smithy_core/client.py @@ -5,7 +5,7 @@ import time from collections.abc import Callable from dataclasses import dataclass, field -from typing import Any, ClassVar, Self +from typing import Any, ClassVar, Generic, Self, TypeVar from ._client import OPERATION from ._client import ClientBase as _ClientBase @@ -30,25 +30,32 @@ __all__ = ["AUTH_SCHEME", "OPERATION", "Client", "ClientCall", "RequestPipeline"] +_C = TypeVar("_C") +_I = TypeVar("_I", bound=SerializeableShape) +_O = TypeVar("_O", bound=DeserializeableShape) +_TRequest = TypeVar("_TRequest") +_TResponse = TypeVar("_TResponse") + + AUTH_SCHEME = PropertyKey(key="auth_scheme", value_type=AuthScheme[Any, Any, Any, Any]) """Property key for the auth scheme selected for the call.""" @dataclass(kw_only=True, frozen=True) -class ClientCall[I: SerializeableShape, O: DeserializeableShape]: +class ClientCall(Generic[_I, _O]): """A data class containing all the initial information about an operation invocation.""" - input: I + input: _I """The input of the operation.""" - operation: APIOperation[I, O] = field(repr=False) + operation: APIOperation[_I, _O] = field(repr=False) """The schema of the operation.""" context: TypedProperties """The initial context of the operation.""" - interceptor: Interceptor[I, O, Any, Any] + interceptor: Interceptor[_I, _O, Any, Any] """The interceptor to use in the course of the operation invocation. This SHOULD be an InterceptorChain. @@ -80,28 +87,28 @@ def retryable(self) -> bool: return is_retryable(self.operation) -class RequestPipeline[TRequest, TResponse](RequestPipelineBase[TRequest, TResponse]): +class RequestPipeline( + RequestPipelineBase[_TRequest, _TResponse], Generic[_TRequest, _TResponse] +): """Invokes client operations synchronously.""" - protocol: ClientProtocol[TRequest, TResponse] + protocol: ClientProtocol[_TRequest, _TResponse] """The protocol to use to serialize the request and deserialize the response.""" - transport: ClientTransport[TRequest, TResponse] + transport: ClientTransport[_TRequest, _TResponse] """The transport to use to send the request and receive the response.""" _logger: ClassVar[logging.Logger] = logging.getLogger("smithy_core.client") def __init__( self, - protocol: ClientProtocol[TRequest, TResponse], - transport: ClientTransport[TRequest, TResponse], + protocol: ClientProtocol[_TRequest, _TResponse], + transport: ClientTransport[_TRequest, _TResponse], ) -> None: self.protocol = protocol self.transport = transport - def __call__[I: SerializeableShape, O: DeserializeableShape]( - self, call: ClientCall[I, O], / - ) -> O: + def __call__(self, call: ClientCall[_I, _O], /) -> _O: """Invoke an operation synchronously. :param call: The operation to invoke and associated context. @@ -116,12 +123,12 @@ def _sleep(self, delay: float) -> None: time.sleep(delay) def _transmit( - self, request_context: RequestContext[Any, TRequest], request_future: None - ) -> TResponse: + self, request_context: RequestContext[Any, _TRequest], request_future: None + ) -> _TResponse: return self.transport.send(request_context.transport_request) -class Client[C](_ClientBase[C]): +class Client(_ClientBase[_C], Generic[_C]): """Shared sync client machinery: lifecycle, setup gating, and call dispatch. Generated clients subclass this with their config type and supply @@ -133,8 +140,8 @@ class Client[C](_ClientBase[C]): def __init__( self, - config: C | None = None, - plugins: list[Callable[[C], None]] | None = None, + config: _C | None = None, + plugins: list[Callable[[_C], None]] | None = None, ) -> None: super().__init__(config, plugins) self._derive_lock = threading.Lock() @@ -154,29 +161,29 @@ def close(self) -> None: with self._derive_lock: run_program(self._close()) - def _ensure_setup(self) -> C: + def _ensure_setup(self) -> _C: if not self._setup_done: with self._derive_lock: return run_program(self._setup()) return self._config - def _invoke[I: SerializeableShape, O: DeserializeableShape]( + def _invoke( self, - input: I | dict[str, Any] | None, - operation: APIOperation[I, O], - default_plugins: list[Callable[[C], None]], - plugins: list[Callable[[C], None]] | None, - ) -> O: + input: _I | dict[str, Any] | None, + operation: APIOperation[_I, _O], + default_plugins: list[Callable[[_C], None]], + plugins: list[Callable[[_C], None]] | None, + ) -> _O: pipeline, call = self._prepare_call(input, operation, default_plugins, plugins) return pipeline(call) - def _prepare_call[I: SerializeableShape, O: DeserializeableShape]( + def _prepare_call( self, - input: I | dict[str, Any] | None, - operation: APIOperation[I, O], - default_plugins: list[Callable[[C], None]], - plugins: list[Callable[[C], None]] | None, - ) -> tuple[RequestPipeline[Any, Any], ClientCall[I, O]]: + input: _I | dict[str, Any] | None, + operation: APIOperation[_I, _O], + default_plugins: list[Callable[[_C], None]], + plugins: list[Callable[[_C], None]] | None, + ) -> tuple[RequestPipeline[Any, Any], ClientCall[_I, _O]]: model = self._build_input(input, operation) self._raise_if_closed() config = self._ensure_setup() diff --git a/packages/smithy-core/src/smithy_core/codecs.py b/packages/smithy-core/src/smithy_core/codecs.py index 2eecc294d..c05eab194 100644 --- a/packages/smithy-core/src/smithy_core/codecs.py +++ b/packages/smithy-core/src/smithy_core/codecs.py @@ -1,7 +1,7 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 from io import BytesIO -from typing import TYPE_CHECKING, Protocol, runtime_checkable +from typing import TYPE_CHECKING, Protocol, TypeVar, runtime_checkable from .interfaces import BytesReader, BytesWriter @@ -12,6 +12,8 @@ __all__ = ["Codec"] +_S = TypeVar("_S", bound="DeserializeableShape") + @runtime_checkable class Codec(Protocol): @@ -55,9 +57,7 @@ def serialize(self, shape: "SerializeableShape") -> bytes: stream.seek(0) return stream.read() - def deserialize[S: DeserializeableShape]( - self, source: bytes | BytesReader, shape: type[S] - ) -> S: + def deserialize(self, source: bytes | BytesReader, shape: type[_S]) -> _S: """Deserialize bytes into a shape. :param source: The bytes to deserialize. diff --git a/packages/smithy-core/src/smithy_core/documents.py b/packages/smithy-core/src/smithy_core/documents.py index d32b8f501..b633b8228 100644 --- a/packages/smithy-core/src/smithy_core/documents.py +++ b/packages/smithy-core/src/smithy_core/documents.py @@ -1,10 +1,11 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 import datetime +import sys from collections.abc import Callable, Iterator, Mapping, Sequence from contextlib import contextmanager from decimal import Decimal -from typing import TypeGuard, override +from typing import TYPE_CHECKING, TypeAlias, TypeGuard, TypeVar from .deserializers import DeserializeableShape, ShapeDeserializer from .exceptions import DiscriminatorError, ExpectationNotMetError, SmithyError @@ -18,27 +19,54 @@ from .shapes import ShapeID, ShapeType from .utils import expect_type +if sys.version_info >= (3, 12): + from typing import TypeAliasType, override +else: + from typing_extensions import TypeAliasType, override + + __all__ = ["Document", "DocumentValue", "TypeRegistry"] -_DOCUMENT = Schema(id=ShapeID("smithy.api#Document"), shape_type=ShapeType.DOCUMENT) +_S = TypeVar("_S", bound=DeserializeableShape) -type DocumentValue = ( - Mapping[str, DocumentValue] - | Sequence[DocumentValue] - | str - | int - | float - | Decimal - | bool - | None - | bytes - | datetime.datetime -) -"""Protocol-agnostic open content.""" +_DOCUMENT = Schema(id=ShapeID("smithy.api#Document"), shape_type=ShapeType.DOCUMENT) -type _InnerDocumentValue = ( +# Type checkers read the recursive TypeAlias; at runtime the alias is a named +# TypeAliasType, so annotations that use it resolve without the caller's globals. +# Keep both values identical. +if TYPE_CHECKING: + DocumentValue: TypeAlias = ( + Mapping[str, "DocumentValue"] + | Sequence["DocumentValue"] + | str + | int + | float + | Decimal + | bool + | None + | bytes + | datetime.datetime + ) + """Protocol-agnostic open content.""" +else: + DocumentValue = TypeAliasType( + "DocumentValue", + Mapping[str, "DocumentValue"] + | Sequence["DocumentValue"] + | str + | int + | float + | Decimal + | bool + | None + | bytes + | datetime.datetime, + ) + + +_InnerDocumentValue: TypeAlias = ( dict[str, "Document"] | list["Document"] | str @@ -290,7 +318,7 @@ def as_value(self) -> DocumentValue: return self._value return self._raw_value - def as_shape[S: DeserializeableShape](self, shape_class: type[S]) -> S: + def as_shape(self, shape_class: type[_S]) -> _S: """Converts the document to an instance of the given shape type. :param shape_class: A class that implements the DeserializeableShape protocol. diff --git a/packages/smithy-core/src/smithy_core/endpoints/_engine.py b/packages/smithy-core/src/smithy_core/endpoints/_engine.py index 82b2d822b..4fc2450b2 100644 --- a/packages/smithy-core/src/smithy_core/endpoints/_engine.py +++ b/packages/smithy-core/src/smithy_core/endpoints/_engine.py @@ -8,6 +8,7 @@ """ import re +import sys from collections.abc import Callable, Mapping, Sequence from functools import lru_cache, partial from operator import itemgetter @@ -29,11 +30,17 @@ Tag, ) -type _Values = list[Any] -type _Closure = Callable[[_Values], Any] +if sys.version_info >= (3, 12): + from typing import TypeAliasType +else: + from typing_extensions import TypeAliasType + + +_Values = TypeAliasType("_Values", list[Any]) +_Closure = TypeAliasType("_Closure", Callable[[_Values], Any]) """A compiled condition, expression or result, called with the values.""" -type _Steps = tuple[str | int, ...] +_Steps = TypeAliasType("_Steps", tuple[str | int, ...]) """A parsed getAttr path: its keys and indexes, in order.""" _RESULT_OFFSET = 100_000_000 diff --git a/packages/smithy-core/src/smithy_core/endpoints/_types.py b/packages/smithy-core/src/smithy_core/endpoints/_types.py index bc46eb67e..2eec2ecdb 100644 --- a/packages/smithy-core/src/smithy_core/endpoints/_types.py +++ b/packages/smithy-core/src/smithy_core/endpoints/_types.py @@ -4,9 +4,10 @@ extensions its rules call, what it is given and returns, and the properties that carry them.""" +import sys from collections.abc import Callable, Mapping, Sequence from dataclasses import dataclass, field -from typing import Any, Final, NamedTuple, Protocol +from typing import Any, Final, Generic, NamedTuple, Protocol, TypeVar from .. import URI from ..interfaces import Endpoint as _Endpoint @@ -17,6 +18,14 @@ from ..shapes import ShapeID from ..types import PropertyKey, TypedProperties +if sys.version_info >= (3, 12): + from typing import TypeAliasType +else: + from typing_extensions import TypeAliasType + + +_I = TypeVar("_I", bound=SerializeableShape) + @dataclass(slots=True) class EndpointAuthScheme: @@ -85,13 +94,13 @@ class Endpoint(_Endpoint): @dataclass(kw_only=True) -class EndpointResolverParams[I: SerializeableShape]: +class EndpointResolverParams(Generic[_I]): """Parameters passed into an Endpoint Resolver's resolve_endpoint method.""" - operation: APIOperation[I, Any] = field(repr=False) + operation: APIOperation[_I, Any] = field(repr=False) """The operation to resolve an endpoint for.""" - input: I + input: _I """The input to the operation.""" context: _TypedProperties @@ -169,13 +178,15 @@ class EndpointBdd(NamedTuple): """The trait's nodes, three ints per node.""" -type BuiltinGetter = Callable[[Any, _TypedProperties], Any] +BuiltinGetter = TypeAliasType("BuiltinGetter", Callable[[Any, _TypedProperties], Any]) """Computes a built-in parameter's value from the config and the call context.""" -type BuiltinBinding = str | BuiltinGetter +BuiltinBinding = TypeAliasType("BuiltinBinding", str | BuiltinGetter) """How a built-in parameter gets its value: a config attribute name, or a getter.""" -type EndpointAuthSchemeFactory = Callable[[Mapping[str, Any]], EndpointAuthScheme] +EndpointAuthSchemeFactory = TypeAliasType( + "EndpointAuthSchemeFactory", Callable[[Mapping[str, Any]], EndpointAuthScheme] +) """Builds an endpoint's auth scheme from an ``authSchemes`` entry of its rules.""" diff --git a/packages/smithy-core/src/smithy_core/exceptions.py b/packages/smithy-core/src/smithy_core/exceptions.py index 90be4f8de..edd1c090f 100644 --- a/packages/smithy-core/src/smithy_core/exceptions.py +++ b/packages/smithy-core/src/smithy_core/exceptions.py @@ -1,10 +1,17 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 +import sys from dataclasses import dataclass, field from typing import Literal from .response import EMPTY_RESPONSE_METADATA, ResponseMetadata +if sys.version_info >= (3, 12): + from typing import TypeAliasType +else: + from typing_extensions import TypeAliasType + + __all__ = [ "AsyncBodyError", "CallError", @@ -30,7 +37,7 @@ class SmithyError(Exception): """Base exception type for all exceptions raised by smithy-python.""" -type Fault = Literal["client", "server"] | None +Fault = TypeAliasType("Fault", Literal["client", "server"] | None) """Whether the client or server is at fault. If None, then there was not enough information to determine fault. diff --git a/packages/smithy-core/src/smithy_core/identity.py b/packages/smithy-core/src/smithy_core/identity.py index 89bd22619..7aedec5dc 100644 --- a/packages/smithy-core/src/smithy_core/identity.py +++ b/packages/smithy-core/src/smithy_core/identity.py @@ -4,7 +4,7 @@ import threading from collections.abc import Callable, Mapping, Sequence from functools import partial -from typing import Any, Final +from typing import Any, Final, Generic, TypeVar from .exceptions import SmithyIdentityError from .interfaces.identity import Identity, IdentityResolver @@ -12,16 +12,22 @@ __all__ = ["CachingIdentityResolver", "ChainedIdentityResolver"] +_I = TypeVar("_I", bound=Identity) +_I_co = TypeVar("_I_co", bound=Identity, covariant=True) +_ChainIdentity = TypeVar("_ChainIdentity") +_IP_contra = TypeVar("_IP_contra", bound=Mapping[str, Any], contravariant=True) + + logger: Final = logging.getLogger(__name__) -class CachingIdentityResolver[I: Identity, IP: Mapping[str, Any]]( - IdentityResolver[I, IP] +class CachingIdentityResolver( + IdentityResolver[_I_co, _IP_contra], Generic[_I_co, _IP_contra] ): """An identity resolver that caches an identity until it expires.""" def __init__(self) -> None: - self._cached: I | None = None + self._cached: _I_co | None = None self._lock = threading.Lock() def __getstate__(self) -> dict[str, Any]: @@ -34,7 +40,7 @@ def __setstate__(self, state: dict[str, Any]) -> None: self.__dict__.update(state) self._lock = threading.Lock() - def get_identity(self, *, properties: IP) -> I: + def get_identity(self, *, properties: _IP_contra) -> _I_co: cached = self._cached if cached is not None and not cached.is_expired: return cached @@ -50,12 +56,12 @@ def invalidate(self) -> None: """Discard the cached identity so the next resolution re-reads its source.""" self._cached = None - def _get_identity(self, *, properties: IP) -> I: + def _get_identity(self, *, properties: _IP_contra) -> _I_co: raise NotImplementedError -class ChainedIdentityResolver[I: Identity, IP: Mapping[str, Any]]( - CachingIdentityResolver[I, IP] +class ChainedIdentityResolver( + CachingIdentityResolver[_I_co, _IP_contra], Generic[_I_co, _IP_contra] ): """Attempts to resolve an identity by checking a sequence of sub-resolvers. @@ -63,7 +69,9 @@ class ChainedIdentityResolver[I: Identity, IP: Mapping[str, Any]]( the chain will be attempted. """ - def __init__(self, resolvers: Sequence[IdentityResolver[I, IP]]) -> None: + def __init__( + self, resolvers: Sequence[IdentityResolver[_I_co, _IP_contra]] + ) -> None: """Construct a ChainedIdentityResolver. :param resolvers: The sequence of resolvers to resolve identity from. @@ -76,22 +84,20 @@ def invalidate(self) -> None: super().invalidate() run_program(_invalidate_all(self._resolvers)) - def _get_identity(self, *, properties: IP) -> I: + def _get_identity(self, *, properties: _IP_contra) -> _I_co: return run_program(_resolve_from_chain(self._resolvers, properties)) -def _cached_identity[I: Identity]( - resolver: Any, fetch: Callable[[], Any] -) -> Program[I]: +def _cached_identity(resolver: Any, fetch: Callable[[], Any]) -> Program[_I]: """Return the resolver's cached identity, refreshing it if missing or expired.""" if resolver._cached is None or resolver._cached.is_expired: resolver._cached = yield fetch return resolver._cached -def _resolve_from_chain[I]( +def _resolve_from_chain( resolvers: Sequence[object], properties: Mapping[str, Any] -) -> Program[I]: +) -> Program[_ChainIdentity]: """Resolve an identity from the first resolver in a chain that can provide one.""" logger.debug("Attempting to resolve identity from resolver chain.") for resolver in resolvers: diff --git a/packages/smithy-core/src/smithy_core/interceptors.py b/packages/smithy-core/src/smithy_core/interceptors.py index fe249d7d7..fde4e580b 100644 --- a/packages/smithy-core/src/smithy_core/interceptors.py +++ b/packages/smithy-core/src/smithy_core/interceptors.py @@ -3,7 +3,7 @@ import logging from collections.abc import Callable, Sequence from dataclasses import dataclass, replace -from typing import Any +from typing import Any, Generic, TypeVar from .deserializers import DeserializeableShape from .interfaces import TypedProperties @@ -19,14 +19,25 @@ "ResponseContext", ] +_C = TypeVar("_C", bound="OutputContext[Any, Any, Any, Any]") +_Request = TypeVar("_Request", bound=SerializeableShape) +_Request_co = TypeVar("_Request_co", bound=SerializeableShape, covariant=True) +_Response = TypeVar("_Response", bound=DeserializeableShape) +_Response_co = TypeVar("_Response_co", bound=DeserializeableShape, covariant=True) +_TransportRequest = TypeVar("_TransportRequest") +_TransportRequest_co = TypeVar("_TransportRequest_co", covariant=True) +_TransportResponse = TypeVar("_TransportResponse") +_TransportResponse_co = TypeVar("_TransportResponse_co", covariant=True) + + _LOGGER = logging.getLogger(__name__) @dataclass(kw_only=True, frozen=True, slots=True) -class InputContext[Request: SerializeableShape]: +class InputContext(Generic[_Request_co]): """Context available before the request is serialized.""" - request: Request + request: _Request_co """The modeled request for the operation being invoked.""" properties: TypedProperties @@ -34,44 +45,38 @@ class InputContext[Request: SerializeableShape]: @dataclass(kw_only=True, frozen=True, slots=True) -class RequestContext[Request: SerializeableShape, TransportRequest]( - InputContext[Request] +class RequestContext( + InputContext[_Request_co], Generic[_Request_co, _TransportRequest_co] ): """Context available once the transport request exists.""" - transport_request: TransportRequest + transport_request: _TransportRequest_co """The transmittable request for the operation being invoked.""" @dataclass(kw_only=True, frozen=True, slots=True) -class ResponseContext[Request: SerializeableShape, TransportRequest, TransportResponse]( - RequestContext[Request, TransportRequest] +class ResponseContext( + RequestContext[_Request_co, _TransportRequest_co], + Generic[_Request_co, _TransportRequest_co, _TransportResponse_co], ): """Context available once the transport response has arrived.""" - transport_response: TransportResponse + transport_response: _TransportResponse_co """The transmitted response for the operation being invoked.""" @dataclass(kw_only=True, frozen=True, slots=True) -class OutputContext[ - Request: SerializeableShape, - Response: DeserializeableShape, - TransportRequest, - TransportResponse, -](ResponseContext[Request, TransportRequest, TransportResponse]): +class OutputContext( + ResponseContext[_Request_co, _TransportRequest_co, _TransportResponse_co], + Generic[_Request_co, _Response_co, _TransportRequest_co, _TransportResponse_co], +): """Context available once the response has been deserialized.""" - response: Response | Exception + response: _Response_co | Exception """The modeled response for the operation being invoked.""" -class Interceptor[ - Request: SerializeableShape, - Response: DeserializeableShape, - TransportRequest, - TransportResponse, -]: +class Interceptor(Generic[_Request, _Response, _TransportRequest, _TransportResponse]): """Allows injecting code into the SDK's request execution pipeline. Terminology: @@ -86,7 +91,7 @@ class Interceptor[ requests or responses. """ - def read_before_execution(self, context: InputContext[Request]) -> None: + def read_before_execution(self, context: InputContext[_Request]) -> None: """A hook called at the start of an execution, before the SDK does anything else. @@ -107,7 +112,7 @@ def read_before_execution(self, context: InputContext[Request]) -> None: the latest will be used and earlier ones will be logged and dropped. """ - def modify_before_serialization(self, context: InputContext[Request]) -> Request: + def modify_before_serialization(self, context: InputContext[_Request]) -> _Request: """A hook called before the request is serialized into a transport request. This method has the ability to modify and return a new request of the same @@ -128,7 +133,7 @@ def modify_before_serialization(self, context: InputContext[Request]) -> Request """ return context.request - def read_before_serialization(self, context: InputContext[Request]) -> None: + def read_before_serialization(self, context: InputContext[_Request]) -> None: """A hook called before the input message is serialized into a transport request. @@ -151,7 +156,7 @@ def read_before_serialization(self, context: InputContext[Request]) -> None: """ def read_after_serialization( - self, context: RequestContext[Request, TransportRequest] + self, context: RequestContext[_Request, _TransportRequest] ) -> None: """A hook called after the input message is serialized into a transport request. @@ -174,8 +179,8 @@ def read_after_serialization( """ def modify_before_retry_loop( - self, context: RequestContext[Request, TransportRequest] - ) -> TransportRequest: + self, context: RequestContext[_Request, _TransportRequest] + ) -> _TransportRequest: """A hook called before the retry loop is entered. This method has the ability to modify and return a new transport request of the @@ -193,7 +198,7 @@ def modify_before_retry_loop( return context.transport_request def read_before_attempt( - self, context: RequestContext[Request, TransportRequest] + self, context: RequestContext[_Request, _TransportRequest] ) -> None: """A hook called before each attempt at sending the transport request to the service. @@ -218,8 +223,8 @@ def read_before_attempt( """ def modify_before_signing( - self, context: RequestContext[Request, TransportRequest] - ) -> TransportRequest: + self, context: RequestContext[_Request, _TransportRequest] + ) -> _TransportRequest: """A hook called before the transport request is signed. This method has the ability to modify and return a new transport request of the @@ -244,7 +249,7 @@ def modify_before_signing( return context.transport_request def read_before_signing( - self, context: RequestContext[Request, TransportRequest] + self, context: RequestContext[_Request, _TransportRequest] ) -> None: """A hook called before the transport request is signed. @@ -270,7 +275,7 @@ def read_before_signing( """ def read_after_signing( - self, context: RequestContext[Request, TransportRequest] + self, context: RequestContext[_Request, _TransportRequest] ) -> None: """A hook called after the transport request is signed. @@ -296,8 +301,8 @@ def read_after_signing( """ def modify_before_transmit( - self, context: RequestContext[Request, TransportRequest] - ) -> TransportRequest: + self, context: RequestContext[_Request, _TransportRequest] + ) -> _TransportRequest: """A hook called before the transport request is sent to the service. This method has the ability to modify and return a new transport request of the @@ -322,7 +327,7 @@ def modify_before_transmit( return context.transport_request def read_before_transmit( - self, context: RequestContext[Request, TransportRequest] + self, context: RequestContext[_Request, _TransportRequest] ) -> None: """A hook called before the transport request is sent to the service. @@ -350,7 +355,7 @@ def read_before_transmit( def read_after_transmit( self, - context: ResponseContext[Request, TransportRequest, TransportResponse], + context: ResponseContext[_Request, _TransportRequest, _TransportResponse], ) -> None: """A hook called after the transport request is sent to the service and a transport response is received. @@ -379,8 +384,8 @@ def read_after_transmit( def modify_before_deserialization( self, - context: ResponseContext[Request, TransportRequest, TransportResponse], - ) -> TransportResponse: + context: ResponseContext[_Request, _TransportRequest, _TransportResponse], + ) -> _TransportResponse: """A hook called before the transport response is deserialized. This method has the ability to modify and return a new transport response of the @@ -409,7 +414,7 @@ def modify_before_deserialization( def read_before_deserialization( self, - context: ResponseContext[Request, TransportRequest, TransportResponse], + context: ResponseContext[_Request, _TransportRequest, _TransportResponse], ) -> None: """A hook called before the transport response is deserialized. @@ -437,7 +442,9 @@ def read_before_deserialization( def read_after_deserialization( self, - context: OutputContext[Request, Response, TransportRequest, TransportResponse], + context: OutputContext[ + _Request, _Response, _TransportRequest, _TransportResponse + ], ) -> None: """A hook called after the transport response is deserialized. @@ -466,9 +473,9 @@ def read_after_deserialization( def modify_before_attempt_completion( self, context: OutputContext[ - Request, Response, TransportRequest, TransportResponse | None + _Request, _Response, _TransportRequest, _TransportResponse | None ], - ) -> Response | Exception: + ) -> _Response | Exception: """A hook called when an attempt is completed. This method has the ability to modify and return a new output message or @@ -496,7 +503,7 @@ def modify_before_attempt_completion( def read_after_attempt( self, context: OutputContext[ - Request, Response, TransportRequest, TransportResponse | None + _Request, _Response, _TransportRequest, _TransportResponse | None ], ) -> None: """A hook called when an attempt is completed. @@ -525,9 +532,9 @@ def read_after_attempt( def modify_before_completion( self, context: OutputContext[ - Request, Response, TransportRequest | None, TransportResponse | None + _Request, _Response, _TransportRequest | None, _TransportResponse | None ], - ) -> Response | Exception: + ) -> _Response | Exception: """A hook called when an execution is completed. This method has the ability to modify and return a new output message or @@ -550,7 +557,7 @@ def modify_before_completion( def read_after_execution( self, context: OutputContext[ - Request, Response, TransportRequest | None, TransportResponse | None + _Request, _Response, _TransportRequest | None, _TransportResponse | None ], ) -> None: """A hook called when an execution is completed. @@ -728,8 +735,8 @@ def _invoke_all(self, hook: Callable[[AnyInterceptor], None]) -> None: if exception is not None: raise exception - def _invoke_all_passing_errors[C: OutputContext[Any, Any, Any, Any]]( - self, context: C, hook: Callable[[AnyInterceptor, C], None] + def _invoke_all_passing_errors( + self, context: _C, hook: Callable[[AnyInterceptor, _C], None] ) -> None: # Like _invoke_all, but each exception also becomes the response that later # interceptors see, since it has replaced the attempt's or execution's result. diff --git a/packages/smithy-core/src/smithy_core/interfaces/__init__.py b/packages/smithy-core/src/smithy_core/interfaces/__init__.py index 6a60238a0..fd00921c8 100644 --- a/packages/smithy-core/src/smithy_core/interfaces/__init__.py +++ b/packages/smithy-core/src/smithy_core/interfaces/__init__.py @@ -1,5 +1,6 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 +import sys from collections.abc import ( AsyncIterable, Awaitable, @@ -17,10 +18,17 @@ Any, Protocol, TypeGuard, + TypeVar, overload, runtime_checkable, ) +if sys.version_info >= (3, 12): + from typing import TypeAliasType +else: + from typing_extensions import TypeAliasType + + __all__ = [ "URI", "AnyStreamingBlob", @@ -56,6 +64,15 @@ from ..serializers import SerializeableShape from ..shapes import ShapeID +_DT = TypeVar("_DT") +_I = TypeVar("_I") +_I_contra = TypeVar("_I_contra", contravariant=True) +_O_co = TypeVar("_O_co", covariant=True) +_O_contra = TypeVar("_O_contra", contravariant=True) +_OperationInput = TypeVar("_OperationInput", bound="SerializeableShape") +_OperationOutput = TypeVar("_OperationOutput", bound="DeserializeableShape") +_T = TypeVar("_T") + class URI(Protocol): """Universal Resource Identifier, target location for a :py:class:`Request`.""" @@ -142,7 +159,7 @@ def seek(self, offset: int, whence: int = 0, /) -> int: # A union of all acceptable streaming blob types. Deserialized payloads will # always return a ByteStream, or AsyncByteStream if async is enabled. -type StreamingBlob = BytesReader | bytes | bytearray +StreamingBlob = TypeAliasType("StreamingBlob", BytesReader | bytes | bytearray) def is_streaming_blob(obj: Any) -> TypeGuard[StreamingBlob]: @@ -164,7 +181,9 @@ def read(self, size: int = -1) -> Awaitable[bytes]: # CAUTION: matches smithy_core.aio.interfaces.StreamingBlob structurally; message # types carry either mode's body, so they can't name the aio alias. -type AnyStreamingBlob = StreamingBlob | AwaitableBytesReader | AsyncIterable[bytes] +AnyStreamingBlob = TypeAliasType( + "AnyStreamingBlob", StreamingBlob | AwaitableBytesReader | AsyncIterable[bytes] +) class Request(Protocol): @@ -215,7 +234,7 @@ class Endpoint(Protocol): @runtime_checkable -class PropertyKey[T](Protocol): +class PropertyKey(Protocol[_T]): """A typed properties key. Used with :py:class:`Context` to set and get typed values. @@ -233,7 +252,7 @@ class PropertyKey[T](Protocol): key: str """The string key used to access the value.""" - value_type: "TypeForm[T]" + value_type: "TypeForm[_T]" """The type of the associated value in the properties bag.""" def __str__(self) -> str: @@ -288,13 +307,13 @@ class TypedProperties(Protocol): """ @overload - def __getitem__[T](self, key: PropertyKey[T]) -> T: ... + def __getitem__(self, key: PropertyKey[_T]) -> _T: ... @overload def __getitem__(self, key: str) -> Any: ... @overload - def __setitem__[T](self, key: PropertyKey[T], value: T) -> None: ... + def __setitem__(self, key: PropertyKey[_T], value: _T) -> None: ... @overload def __setitem__(self, key: str, value: Any) -> None: ... @@ -306,34 +325,34 @@ def __iter__(self) -> Iterator[str]: ... def __contains__(self, key: object) -> bool: ... @overload - def get[T](self, key: PropertyKey[T], default: None = None) -> T | None: ... + def get(self, key: PropertyKey[_T], default: None = None) -> _T | None: ... @overload - def get[T](self, key: PropertyKey[T], default: T) -> T: ... + def get(self, key: PropertyKey[_T], default: _T) -> _T: ... @overload - def get[T, DT](self, key: PropertyKey[T], default: DT) -> T | DT: ... + def get(self, key: PropertyKey[_T], default: _DT) -> _T | _DT: ... @overload def get(self, key: str, default: None = None) -> Any | None: ... @overload - def get[T](self, key: str, default: T) -> Any | T: ... + def get(self, key: str, default: _T) -> Any | _T: ... @overload - def pop[T](self, key: PropertyKey[T], default: None = None) -> T | None: ... + def pop(self, key: PropertyKey[_T], default: None = None) -> _T | None: ... @overload - def pop[T](self, key: PropertyKey[T], default: T) -> T: ... + def pop(self, key: PropertyKey[_T], default: _T) -> _T: ... @overload - def pop[T, DT](self, key: PropertyKey[T], default: DT) -> T | DT: ... + def pop(self, key: PropertyKey[_T], default: _DT) -> _T | _DT: ... @overload def pop(self, key: str, default: None = None) -> Any | None: ... @overload - def pop[T](self, key: str, default: T) -> Any | T: ... + def pop(self, key: str, default: _T) -> Any | _T: ... def items(self) -> ItemsView[str, Any]: """Return a view of the property keys and values.""" @@ -380,7 +399,9 @@ class ProtocolSettings: """ -type ProtocolConstructor[T] = Callable[[ProtocolSettings], T] +ProtocolConstructor = TypeAliasType( + "ProtocolConstructor", Callable[[ProtocolSettings], _T], type_params=(_T,) +) """A callable that builds a protocol instance from ``ProtocolSettings``. A protocol class satisfies this, since calling the class constructs an instance. @@ -398,18 +419,18 @@ def resolve_endpoint(self, params: "EndpointResolverParams[Any]") -> Endpoint: ... -class ClientTransport[I, O](Protocol): +class ClientTransport(Protocol[_I_contra, _O_co]): """Protocol-agnostic representation of a synchronous client transport (e.g. an HTTP client).""" TIMEOUT_EXCEPTIONS: tuple[type[Exception], ...] - def send(self, request: I) -> O: + def send(self, request: _I_contra) -> _O_co: """Send a request over the transport and receive the response.""" ... -class ClientProtocol[I, O](Protocol): +class ClientProtocol(Protocol[_I, _O_contra]): """A protocol used by a synchronous client to communicate with a server.""" @property @@ -417,17 +438,14 @@ def id(self) -> "ShapeID": """The ID of the protocol.""" ... - def serialize_request[ - OperationInput: "SerializeableShape", - OperationOutput: "DeserializeableShape", - ]( + def serialize_request( self, *, - operation: "APIOperation[OperationInput, OperationOutput]", - input: OperationInput, + operation: "APIOperation[_OperationInput, _OperationOutput]", + input: _OperationInput, endpoint: URI, context: TypedProperties, - ) -> I: + ) -> _I: """Serialize an operation input into a transport request. :param operation: The operation whose request is being serialized. @@ -437,7 +455,7 @@ def serialize_request[ """ ... - def set_service_endpoint(self, *, request: I, endpoint: Endpoint) -> I: + def set_service_endpoint(self, *, request: _I, endpoint: Endpoint) -> _I: """Update the endpoint of a transport request. :param request: The request whose endpoint should be updated. @@ -445,19 +463,16 @@ def set_service_endpoint(self, *, request: I, endpoint: Endpoint) -> I: """ ... - def deserialize_response_program[ - OperationInput: "SerializeableShape", - OperationOutput: "DeserializeableShape", - ]( + def deserialize_response_program( self, *, - operation: "APIOperation[OperationInput, OperationOutput]", - request: I, - response: O, + operation: "APIOperation[_OperationInput, _OperationOutput]", + request: _I, + response: _O_contra, error_registry: "TypeRegistry", context: TypedProperties, read_body: Callable[[AnyStreamingBlob], Any], - ) -> "Program[OperationOutput]": + ) -> "Program[_OperationOutput]": """Deserialize the output from the transport response or raise its error. The returned program runs under both the sync and async clients. It reads @@ -474,7 +489,7 @@ def deserialize_response_program[ ... def extract_response_metadata( - self, *, response: O, context: TypedProperties + self, *, response: _O_contra, context: TypedProperties ) -> "ResponseMetadata": """Extract metadata about a transport response. diff --git a/packages/smithy-core/src/smithy_core/interfaces/auth.py b/packages/smithy-core/src/smithy_core/interfaces/auth.py index 660a45966..cf80efaf5 100644 --- a/packages/smithy-core/src/smithy_core/interfaces/auth.py +++ b/packages/smithy-core/src/smithy_core/interfaces/auth.py @@ -1,7 +1,7 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 from collections.abc import Mapping, Sequence -from typing import TYPE_CHECKING, Any, Protocol +from typing import TYPE_CHECKING, Any, Protocol, TypeVar from ..shapes import ShapeID from . import TypedProperties @@ -20,6 +20,13 @@ "Signer", ] +_I_contra = TypeVar("_I_contra", contravariant=True) +_AuthIdentity = TypeVar("_AuthIdentity", bound=Identity) +_IP = TypeVar("_IP", bound=Mapping[str, Any]) +_R = TypeVar("_R") +_SP = TypeVar("_SP", bound=Mapping[str, Any]) +_SP_contra = TypeVar("_SP_contra", bound=Mapping[str, Any], contravariant=True) + class AuthOption(Protocol): """Auth scheme used for signing and identity resolution.""" @@ -48,10 +55,10 @@ def resolve_auth_scheme( ... -class Signer[R, I, SP: Mapping[str, Any]](Protocol): +class Signer(Protocol[_R, _I_contra, _SP_contra]): """A class that signs requests before they are sent.""" - def sign(self, *, request: R, identity: I, properties: SP) -> R: + def sign(self, *, request: _R, identity: _I_contra, properties: _SP_contra) -> _R: """Get a signed version of the request. :param request: The request to be signed. @@ -61,10 +68,10 @@ def sign(self, *, request: R, identity: I, properties: SP) -> R: ... -class EventSigner[I, SP: Mapping[str, Any]](Protocol): +class EventSigner(Protocol[_I_contra, _SP_contra]): """A class that signs event stream events before they are sent.""" - def sign(self, *, event: Any, identity: I, properties: SP) -> Any: + def sign(self, *, event: Any, identity: _I_contra, properties: _SP_contra) -> Any: """Get a signed version of the event. :param event: The event to be signed. @@ -73,7 +80,9 @@ def sign(self, *, event: Any, identity: I, properties: SP) -> Any: """ ... - def sign_empty(self, *, event: Any, identity: I, properties: SP) -> Any: + def sign_empty( + self, *, event: Any, identity: _I_contra, properties: _SP_contra + ) -> Any: """Get a signed version of an empty event. :param event: The empty event to be signed. @@ -83,15 +92,13 @@ def sign_empty(self, *, event: Any, identity: I, properties: SP) -> Any: ... -class AuthScheme[R, I: Identity, IP: Mapping[str, Any], SP: Mapping[str, Any]]( - Protocol -): +class AuthScheme(Protocol[_R, _AuthIdentity, _IP, _SP]): """A class that coordinates identity and auth.""" scheme_id: ShapeID """The ID of the auth scheme.""" - def identity_properties(self, *, context: TypedProperties) -> IP: + def identity_properties(self, *, context: TypedProperties) -> _IP: """Construct identity properties from the request context. :param context: The context of the request. @@ -100,25 +107,25 @@ def identity_properties(self, *, context: TypedProperties) -> IP: def identity_resolver( self, *, context: TypedProperties - ) -> "IdentityResolver[I, IP]": + ) -> "IdentityResolver[_AuthIdentity, _IP]": """Get an identity resolver for the request. :param context: The context of the request. """ ... - def signer_properties(self, *, context: TypedProperties) -> SP: + def signer_properties(self, *, context: TypedProperties) -> _SP: """Construct signer properties from the request context. :param context: The context of the request. """ ... - def signer(self) -> Signer[R, I, SP]: + def signer(self) -> Signer[_R, _AuthIdentity, _SP]: """Get a signer for the request.""" ... - def event_signer(self, *, request: R) -> EventSigner[I, SP] | None: + def event_signer(self, *, request: _R) -> EventSigner[_AuthIdentity, _SP] | None: """Construct a signer for event stream events. :param request: The request that will initiate the event stream. diff --git a/packages/smithy-core/src/smithy_core/interfaces/eventstream.py b/packages/smithy-core/src/smithy_core/interfaces/eventstream.py index f71275403..0cb7c5abb 100644 --- a/packages/smithy-core/src/smithy_core/interfaces/eventstream.py +++ b/packages/smithy-core/src/smithy_core/interfaces/eventstream.py @@ -1,14 +1,17 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 -from typing import Any, Protocol, Self +from typing import Any, Protocol, Self, TypeVar from ..deserializers import DeserializeableShape from ..serializers import SerializeableShape __all__ = ["EventPublisher", "EventReceiver"] +_IE_contra = TypeVar("_IE_contra", bound=SerializeableShape, contravariant=True) +_OE_co = TypeVar("_OE_co", bound=DeserializeableShape, covariant=True) -class EventPublisher[E: SerializeableShape](Protocol): + +class EventPublisher(Protocol[_IE_contra]): """Sends events to a service. This may be used as a context manager to ensure the stream is closed before exiting. @@ -20,7 +23,7 @@ def __enter__(self) -> Self: def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None: self.close() - def send(self, event: E) -> None: + def send(self, event: _IE_contra) -> None: """Sends an event to the service. :param event: The event to send. @@ -32,7 +35,7 @@ def close(self) -> None: ... -class EventReceiver[E: DeserializeableShape](Protocol): +class EventReceiver(Protocol[_OE_co]): """Receives events from a service. Events may be received via the ``receive`` method or by using this class as an @@ -40,7 +43,7 @@ class EventReceiver[E: DeserializeableShape](Protocol): before exiting. """ - def __next__(self) -> E: + def __next__(self) -> _OE_co: result = self.receive() if result is None: self.close() @@ -56,7 +59,7 @@ def __enter__(self) -> Self: def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None: self.close() - def receive(self) -> E | None: + def receive(self) -> _OE_co | None: """Receive a single event from the service. :returns: An event or None. None indicates that no more events will be sent by diff --git a/packages/smithy-core/src/smithy_core/interfaces/identity.py b/packages/smithy-core/src/smithy_core/interfaces/identity.py index e5e3aac42..132ea35cb 100644 --- a/packages/smithy-core/src/smithy_core/interfaces/identity.py +++ b/packages/smithy-core/src/smithy_core/interfaces/identity.py @@ -2,12 +2,15 @@ # SPDX-License-Identifier: Apache-2.0 from collections.abc import Mapping from datetime import UTC, datetime -from typing import Any, Protocol, runtime_checkable +from typing import Any, Protocol, TypeVar, runtime_checkable from ..utils import ensure_utc __all__ = ["Identity", "IdentityResolver"] +_I_co = TypeVar("_I_co", bound="Identity", covariant=True) +_IP_contra = TypeVar("_IP_contra", bound=Mapping[str, Any], contravariant=True) + @runtime_checkable class Identity(Protocol): @@ -31,10 +34,10 @@ def is_expired(self) -> bool: return datetime.now(tz=UTC) >= self.expiration -class IdentityResolver[I: Identity, IP: Mapping[str, Any]](Protocol): +class IdentityResolver(Protocol[_I_co, _IP_contra]): """Loads a user's :py:class:`Identity` from a given source.""" - def get_identity(self, *, properties: IP) -> I: + def get_identity(self, *, properties: _IP_contra) -> _I_co: """Load the user's identity from this resolver. :param properties: Properties used to help determine the identity to return. diff --git a/packages/smithy-core/src/smithy_core/program.py b/packages/smithy-core/src/smithy_core/program.py index 9d30d7918..04aa86531 100644 --- a/packages/smithy-core/src/smithy_core/program.py +++ b/packages/smithy-core/src/smithy_core/program.py @@ -8,19 +8,29 @@ asynchronously over async ones. """ +import sys from collections.abc import Callable, Generator from inspect import isawaitable -from typing import Any +from typing import Any, TypeVar from .exceptions import AsyncBodyError +if sys.version_info >= (3, 12): + from typing import TypeAliasType +else: + from typing_extensions import TypeAliasType + + __all__ = ["Effect", "Program", "run_program"] -type Effect = Callable[[], Any] -type Program[T] = Generator[Effect, Any, T] +_T = TypeVar("_T") + + +Effect = TypeAliasType("Effect", Callable[[], Any]) +Program = TypeAliasType("Program", Generator[Effect, Any, _T], type_params=(_T,)) -def run_program[T](program: Program[T]) -> T: +def run_program(program: Program[_T]) -> _T: """Drive a program to completion, calling each effect synchronously. :raises AsyncBodyError: If an effect returns an awaitable. diff --git a/packages/smithy-core/src/smithy_core/schemas.py b/packages/smithy-core/src/smithy_core/schemas.py index 81482a52a..10efd263e 100644 --- a/packages/smithy-core/src/smithy_core/schemas.py +++ b/packages/smithy-core/src/smithy_core/schemas.py @@ -7,10 +7,12 @@ from typing import ( TYPE_CHECKING, Any, + Generic, NotRequired, Required, Self, TypedDict, + TypeVar, overload, ) @@ -34,6 +36,12 @@ __all__ = ["APIOperation", "MemberSchema", "Schema", "SchemaExtension"] +_I_co = TypeVar("_I_co", bound="SerializeableShape", covariant=True) +_O_co = TypeVar("_O_co", bound="DeserializeableShape", covariant=True) +_T = TypeVar("_T") +_T_co = TypeVar("_T_co", covariant=True) +_TraitT = TypeVar("_TraitT", bound=Trait) + @dataclass(kw_only=True, frozen=True, init=False) class Schema: @@ -199,7 +207,7 @@ def expect_member_index(self) -> int: return self.member_index @overload - def get_trait[T: "Trait"](self, t: type[T]) -> T | None: ... + def get_trait(self, t: type[_TraitT]) -> _TraitT | None: ... @overload def get_trait(self, t: ShapeID) -> "Trait | DynamicTrait | None": ... @@ -224,7 +232,7 @@ def get_trait(self, t: "type[Trait] | ShapeID") -> "Trait | DynamicTrait | None" return result @overload - def expect_trait[T: "Trait"](self, t: type[T]) -> T: ... + def expect_trait(self, t: type[_TraitT]) -> _TraitT: ... @overload def expect_trait(self, t: ShapeID) -> "Trait | DynamicTrait": ... @@ -237,7 +245,7 @@ def expect_trait(self, t: "type[Trait] | ShapeID") -> "Trait | DynamicTrait": id = t if isinstance(t, ShapeID) else t.id return self.traits[id] - def get_extension[T](self, extension: "SchemaExtension[T]") -> T: + def get_extension(self, extension: "SchemaExtension[_T]") -> _T: """Get or lazily build metadata associated with this schema. Extension descriptors are intended to be shared across all codec and protocol @@ -335,7 +343,7 @@ def member( member_index=index, ) - def _compute_extension[T](self, extension: "SchemaExtension[T]") -> T: + def _compute_extension(self, extension: "SchemaExtension[_T]") -> _T: """Grow an extension array or populate an uncomputed extension slot.""" extensions = self._extensions extension_id = extension.id @@ -358,10 +366,10 @@ def _compute_extension[T](self, extension: "SchemaExtension[T]") -> T: @dataclass(frozen=True, slots=True, eq=False) -class SchemaExtension[T]: +class SchemaExtension(Generic[_T_co]): """An integer-indexed provider of lazily cached schema metadata.""" - provider: Callable[[Schema], T] + provider: Callable[[Schema], _T_co] """Build the extension value for a schema.""" id: int = field(init=False) @@ -385,7 +393,7 @@ class MemberSchema(TypedDict): @dataclass(kw_only=True, frozen=True) -class APIOperation[I: "SerializeableShape", O: "DeserializeableShape"]: +class APIOperation(Generic[_I_co, _O_co]): """A modeled Smithy operation. Input, output, and error types are resolved lazily from ``static_schema`` via @@ -426,12 +434,12 @@ class APIOperation[I: "SerializeableShape", O: "DeserializeableShape"]: """ @cached_property - def input(self) -> type[I]: + def input(self) -> type[_I_co]: """The input type of the operation (built on first access).""" return self._build(self.input_schema.id) @cached_property - def output(self) -> type[O]: + def output(self) -> type[_O_co]: """The output type of the operation (built on first access).""" return self._build(self.output_schema.id) diff --git a/packages/smithy-core/src/smithy_core/types.py b/packages/smithy-core/src/smithy_core/types.py index 3a112223d..926c216bc 100644 --- a/packages/smithy-core/src/smithy_core/types.py +++ b/packages/smithy-core/src/smithy_core/types.py @@ -9,7 +9,16 @@ from datetime import datetime from email.utils import format_datetime, parsedate_to_datetime from enum import Enum -from typing import TYPE_CHECKING, Any, ClassVar, Self, overload +from typing import ( + TYPE_CHECKING, + Any, + ClassVar, + Generic, + Self, + TypeAlias, + TypeVar, + overload, +) from .exceptions import ExpectationNotMetError from .interfaces import PropertyKey as _PropertyKey @@ -22,6 +31,11 @@ serialize_rfc3339, ) +if sys.version_info >= (3, 12): + from typing import TypeAliasType +else: + from typing_extensions import TypeAliasType + if TYPE_CHECKING: from typing_extensions import TypeForm @@ -36,11 +50,36 @@ "UnknownEnumMixin", ] +_DT = TypeVar("_DT") +_T = TypeVar("_T") + + _GREEDY_LABEL_RE = re.compile(r"\{(\w+)\+\}") -type Document = ( - Mapping[str, "Document"] | Sequence["Document"] | str | int | float | bool | None -) +# Type checkers read the recursive TypeAlias; at runtime the alias is a named +# TypeAliasType, so annotations that use it resolve without the caller's globals. +# Keep both values identical. +if TYPE_CHECKING: + Document: TypeAlias = ( + Mapping[str, "Document"] + | Sequence["Document"] + | str + | int + | float + | bool + | None + ) +else: + Document = TypeAliasType( + "Document", + Mapping[str, "Document"] + | Sequence["Document"] + | str + | int + | float + | bool + | None, + ) class JsonString(str): @@ -237,7 +276,7 @@ def format(self, *args: object, **kwargs: str) -> str: @dataclass(kw_only=True, frozen=True, slots=True, init=False) -class PropertyKey[T](_PropertyKey[T]): +class PropertyKey(_PropertyKey[_T], Generic[_T]): """A typed property key. .. code-block:: python @@ -251,10 +290,10 @@ class PropertyKey[T](_PropertyKey[T]): key: str """The string key used to access the value.""" - value_type: "TypeForm[T]" + value_type: "TypeForm[_T]" """The type of the associated value in the property bag.""" - def __init__(self, *, key: str, value_type: "TypeForm[T]") -> None: + def __init__(self, *, key: str, value_type: "TypeForm[_T]") -> None: # Intern the key to speed up dict access object.__setattr__(self, "key", sys.intern(key)) object.__setattr__(self, "value_type", value_type) @@ -304,14 +343,14 @@ class TypedProperties(UserDict[str, Any], _TypedProperties): """ @overload - def __getitem__[T](self, key: _PropertyKey[T]) -> T: ... + def __getitem__(self, key: _PropertyKey[_T]) -> _T: ... @overload def __getitem__(self, key: str) -> Any: ... def __getitem__(self, key: str | _PropertyKey[Any]) -> Any: return self.data[key if isinstance(key, str) else key.key] @overload - def __setitem__[T](self, key: _PropertyKey[T], value: T) -> None: ... + def __setitem__(self, key: _PropertyKey[_T], value: _T) -> None: ... @overload def __setitem__(self, key: str, value: Any) -> None: ... def __setitem__(self, key: str | _PropertyKey[Any], value: Any) -> None: @@ -324,15 +363,15 @@ def __contains__(self, key: object) -> bool: return super().__contains__(key.key if isinstance(key, _PropertyKey) else key) @overload - def get[T](self, key: _PropertyKey[T], default: None = None) -> T | None: ... + def get(self, key: _PropertyKey[_T], default: None = None) -> _T | None: ... @overload - def get[T](self, key: _PropertyKey[T], default: T) -> T: ... + def get(self, key: _PropertyKey[_T], default: _T) -> _T: ... @overload - def get[T, DT](self, key: _PropertyKey[T], default: DT) -> T | DT: ... + def get(self, key: _PropertyKey[_T], default: _DT) -> _T | _DT: ... @overload def get(self, key: str, default: None = None) -> Any | None: ... @overload - def get[T](self, key: str, default: T) -> Any | T: ... + def get(self, key: str, default: _T) -> Any | _T: ... # pyright has trouble detecting compatible overrides when both the superclass # and subclass have overloads. @@ -340,15 +379,15 @@ def get(self, key: str | _PropertyKey[Any], default: Any = None) -> Any: # type return self.data.get(key if isinstance(key, str) else key.key, default) @overload - def pop[T](self, key: _PropertyKey[T], default: None = None) -> T | None: ... + def pop(self, key: _PropertyKey[_T], default: None = None) -> _T | None: ... @overload - def pop[T](self, key: _PropertyKey[T], default: T) -> T: ... + def pop(self, key: _PropertyKey[_T], default: _T) -> _T: ... @overload - def pop[T, DT](self, key: _PropertyKey[T], default: DT) -> T | DT: ... + def pop(self, key: _PropertyKey[_T], default: _DT) -> _T | _DT: ... @overload def pop(self, key: str, default: None = None) -> Any | None: ... @overload - def pop[T](self, key: str, default: T) -> Any | T: ... + def pop(self, key: str, default: _T) -> Any | _T: ... # pyright has trouble detecting compatible overrides when both the superclass # and subclass have overloads. diff --git a/packages/smithy-core/src/smithy_core/utils.py b/packages/smithy-core/src/smithy_core/utils.py index e51736574..c77bbd107 100644 --- a/packages/smithy-core/src/smithy_core/utils.py +++ b/packages/smithy-core/src/smithy_core/utils.py @@ -5,7 +5,7 @@ from decimal import Decimal from math import isinf, isnan from types import UnionType -from typing import Any, overload +from typing import Any, TypeVar, overload from urllib.parse import urlsplit from . import URI as _URI @@ -32,6 +32,9 @@ "strict_parse_float", ] +_T = TypeVar("_T") + + RFC3339 = "%Y-%m-%dT%H:%M:%SZ" """``strftime`` format for RFC 3339 timestamps in whole seconds.""" # Same as RFC3339, but with microsecond precision. @@ -93,7 +96,7 @@ def epoch_seconds_to_datetime(value: int | float) -> datetime: @overload -def expect_type[T](typ: type[T], value: Any) -> T: ... +def expect_type(typ: type[_T], value: Any) -> _T: ... # For some reason, mypy and other type checkers don't treat Union like a full type diff --git a/packages/smithy-core/tests/unit/test_input_conversion.py b/packages/smithy-core/tests/unit/test_input_conversion.py index 393ba8590..fec8c40f7 100644 --- a/packages/smithy-core/tests/unit/test_input_conversion.py +++ b/packages/smithy-core/tests/unit/test_input_conversion.py @@ -4,7 +4,7 @@ """Keyword operation inputs: building input models from keyword arguments.""" from types import ModuleType -from typing import Any +from typing import Any, TypeAlias import pytest from smithy_core._dynamic_models import ModelRegistry @@ -26,7 +26,7 @@ _DEFAULT = "smithy.api#default" _REQUIRED = "smithy.api#required" -type _Member = tuple[str, object] | tuple[str, object, object] +_Member: TypeAlias = tuple[str, object] | tuple[str, object, object] def _collection( diff --git a/packages/smithy-core/tests/unit/test_recursive_aliases.py b/packages/smithy-core/tests/unit/test_recursive_aliases.py new file mode 100644 index 000000000..a75cbee44 --- /dev/null +++ b/packages/smithy-core/tests/unit/test_recursive_aliases.py @@ -0,0 +1,66 @@ +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 +"""Public recursive aliases stay named runtime aliases for customer annotations.""" + +import pickle +from collections.abc import Callable +from typing import Any, get_args, get_type_hints + +import pytest +import smithy_core.documents +import smithy_core.types +from smithy_core.documents import DocumentValue as CustomerDocumentValue +from smithy_core.types import Document as CustomerDocument + + +def _renamed_document_value(value: CustomerDocumentValue) -> None: ... +def _qualified_document_value(value: smithy_core.documents.DocumentValue) -> None: ... +def _renamed_document(value: CustomerDocument) -> None: ... +def _qualified_document(value: smithy_core.types.Document) -> None: ... + + +_ALIASES = [ + pytest.param( + smithy_core.documents.DocumentValue, + "smithy_core.documents", + "DocumentValue", + [_renamed_document_value, _qualified_document_value], + id="DocumentValue", + ), + pytest.param( + smithy_core.types.Document, + "smithy_core.types", + "Document", + [_renamed_document, _qualified_document], + id="Document", + ), +] + + +@pytest.mark.parametrize("alias, module, name, annotated", _ALIASES) +def test_alias_is_named_at_runtime( + alias: Any, module: str, name: str, annotated: list[Callable[..., None]] +) -> None: + assert alias.__name__ == name + assert alias.__module__ == module + assert alias.__type_params__ == () + assert {str, int, float, bool, type(None)} <= set(get_args(alias.__value__)) + assert pickle.loads(pickle.dumps(alias)) is alias + + +@pytest.mark.parametrize("alias, module, name, annotated", _ALIASES) +def test_renamed_and_qualified_annotations_resolve( + alias: Any, module: str, name: str, annotated: list[Callable[..., None]] +) -> None: + for function in annotated: + assert get_type_hints(function)["value"] is alias + + +@pytest.mark.parametrize("alias, module, name, annotated", _ALIASES) +def test_customer_global_with_alias_name_is_ignored( + alias: Any, module: str, name: str, annotated: list[Callable[..., None]] +) -> None: + # A customer module that also defines a global with the alias's own name. + namespace = {**globals(), name: int} + for function in annotated: + assert get_type_hints(function, globalns=namespace)["value"] is alias diff --git a/packages/smithy-http/.changes/next-release/smithy-http-feature-c0136388a3ca46b29fbf8a8cffc5965b.json b/packages/smithy-http/.changes/next-release/smithy-http-feature-c0136388a3ca46b29fbf8a8cffc5965b.json new file mode 100644 index 000000000..ffde5984f --- /dev/null +++ b/packages/smithy-http/.changes/next-release/smithy-http-feature-c0136388a3ca46b29fbf8a8cffc5965b.json @@ -0,0 +1,4 @@ +{ + "type": "feature", + "description": "Added support for Python 3.11, including retry classification of protocol errors." +} diff --git a/packages/smithy-http/pyproject.toml b/packages/smithy-http/pyproject.toml index 4f755b09c..58cd8c54e 100644 --- a/packages/smithy-http/pyproject.toml +++ b/packages/smithy-http/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "smithy-http" dynamic = ["version"] -requires-python = ">=3.12" +requires-python = ">=3.11" authors = [ {name = "Amazon Web Services"}, ] @@ -19,6 +19,7 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", @@ -29,6 +30,7 @@ classifiers = [ ] dependencies = [ "smithy-core~=0.13.0", + "typing-extensions>=4.14.0; python_version < '3.12'", ] [project.urls] diff --git a/packages/smithy-http/src/smithy_http/aio/protocols.py b/packages/smithy-http/src/smithy_http/aio/protocols.py index 0e921d8b8..fdfbd3f53 100644 --- a/packages/smithy-http/src/smithy_http/aio/protocols.py +++ b/packages/smithy-http/src/smithy_http/aio/protocols.py @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 from collections.abc import Callable from inspect import iscoroutinefunction -from typing import TYPE_CHECKING, Any, cast +from typing import TYPE_CHECKING, Any, TypeVar, cast from smithy_core.aio.interfaces import ( AsyncByteStream, @@ -46,6 +46,12 @@ "AsyncRpcV2JsonClientProtocol", ] +_IE = TypeVar("_IE", bound=SerializeableShape) +_OE = TypeVar("_OE", bound=DeserializeableShape) +_OperationInput = TypeVar("_OperationInput", bound=SerializeableShape) +_OperationOutput = TypeVar("_OperationOutput", bound=DeserializeableShape) + + try: from smithy_aws_event_stream._private.deserializers import ( EventDeserializer as _EventDeserializer, @@ -126,19 +132,15 @@ class AsyncHttpEventStreamMixin( ``class AsyncRestJson(AsyncHttpEventStreamMixin, RestJsonClientProtocol)``. """ - async def create_event_publisher[ - OperationInput: SerializeableShape, - OperationOutput: DeserializeableShape, - Event: SerializeableShape, - ]( + async def create_event_publisher( self, *, - operation: "APIOperation[OperationInput, OperationOutput]", + operation: "APIOperation[_OperationInput, _OperationOutput]", request: HTTPRequest, - event_type: "TypeForm[Event]", + event_type: "TypeForm[_IE]", context: TypedProperties, auth_scheme: AsyncAuthScheme[Any, Any, Any, Any] | None = None, - ) -> AsyncEventPublisher[Event]: + ) -> AsyncEventPublisher[_IE]: _assert_event_stream() signing_config: SigningConfig[Any, Any, Any, Any] | None = None if auth_scheme is not None: @@ -165,7 +167,7 @@ async def create_event_publisher[ initial_message = cast( "_EventMessage | None", context.get(_INITIAL_REQUEST_EVENT) ) - publisher = AsyncAWSEventPublisher[Event]( + publisher = AsyncAWSEventPublisher[_IE]( payload_codec=self.payload_codec, async_writer=body, signing_config=signing_config, @@ -176,20 +178,16 @@ async def create_event_publisher[ await publisher.prepare() return publisher - def create_event_receiver[ - OperationInput: SerializeableShape, - OperationOutput: DeserializeableShape, - Event: DeserializeableShape, - ]( + def create_event_receiver( self, *, - operation: "APIOperation[OperationInput, OperationOutput]", + operation: "APIOperation[_OperationInput, _OperationOutput]", request: HTTPRequest, response: HTTPResponse, - event_type: "TypeForm[Event]", - event_deserializer: Callable[[ShapeDeserializer], Event], + event_type: "TypeForm[_OE]", + event_deserializer: Callable[[ShapeDeserializer], _OE], context: TypedProperties, - ) -> AsyncEventReceiver[Event]: + ) -> AsyncEventReceiver[_OE]: _assert_event_stream() return AsyncAWSEventReceiver( payload_codec=self.payload_codec, @@ -209,20 +207,16 @@ class AsyncRpcEventStreamMixin(AsyncHttpEventStreamMixin, RpcClientProtocol): and ``initial-response`` events at the head of the stream. """ - def create_event_receiver[ - OperationInput: SerializeableShape, - OperationOutput: DeserializeableShape, - Event: DeserializeableShape, - ]( + def create_event_receiver( self, *, - operation: "APIOperation[OperationInput, OperationOutput]", + operation: "APIOperation[_OperationInput, _OperationOutput]", request: HTTPRequest, response: HTTPResponse, - event_type: "TypeForm[Event]", - event_deserializer: Callable[[ShapeDeserializer], Event], + event_type: "TypeForm[_OE]", + event_deserializer: Callable[[ShapeDeserializer], _OE], context: TypedProperties, - ) -> AsyncEventReceiver[Event]: + ) -> AsyncEventReceiver[_OE]: _assert_event_stream() # Continue from the reader that already consumed the initial-response frame in # deserialization, so subsequent events stay in order. @@ -259,16 +253,13 @@ def _build_initial_request_body( context[_INITIAL_REQUEST_EVENT] = initial return AsyncBytesProvider() - def _deserialize_event_stream_response[ - OperationInput: SerializeableShape, - OperationOutput: DeserializeableShape, - ]( + def _deserialize_event_stream_response( self, *, - operation: APIOperation[OperationInput, OperationOutput], + operation: APIOperation[_OperationInput, _OperationOutput], response: HTTPResponse, context: TypedProperties, - ) -> Program[OperationOutput]: + ) -> Program[_OperationOutput]: # initial-response is optional: the spec omits it when every non-stream output # member is optional. Peek the first frame's :event-type -- consume it as the # output only when it IS the initial-response; otherwise synthesize the default diff --git a/packages/smithy-http/src/smithy_http/protocols.py b/packages/smithy-http/src/smithy_http/protocols.py index b728736ce..79112c7e8 100644 --- a/packages/smithy-http/src/smithy_http/protocols.py +++ b/packages/smithy-http/src/smithy_http/protocols.py @@ -4,7 +4,7 @@ import os from collections.abc import Callable, Mapping, Sequence from io import BytesIO -from typing import TYPE_CHECKING, Any, cast +from typing import TYPE_CHECKING, Any, TypeVar, cast from smithy_core import URI as _URI from smithy_core.codecs import Codec @@ -71,6 +71,11 @@ "RpcV2JsonClientProtocol", ] +_OperationInput = TypeVar("_OperationInput", bound=SerializeableShape) +_OperationOutput = TypeVar("_OperationOutput", bound=DeserializeableShape) +_CallErrorT = TypeVar("_CallErrorT", bound=CallError) + + _EVENT_STREAM_CONTENT_TYPE = "application/vnd.amazon.eventstream" # Read by ID so smithy-http needs no dependency on the AWS trait classes. @@ -195,9 +200,9 @@ def _document_error_id(self, document: Document) -> ShapeID | None: except DiscriminatorError: return None - def _classify_error_for_retry[E: CallError]( - self, error: E, response: HTTPResponse, code: str | None - ) -> E: + def _classify_error_for_retry( + self, error: _CallErrorT, response: HTTPResponse, code: str | None + ) -> _CallErrorT: """Mark the error as retryable if it's a throttling, timeout or transient error.""" if error.is_retry_safe is False: return error @@ -233,14 +238,11 @@ def error_identifier(self) -> HTTPErrorIdentifier: response information.""" raise NotImplementedError() - def serialize_request[ - OperationInput: "SerializeableShape", - OperationOutput: "DeserializeableShape", - ]( + def serialize_request( self, *, - operation: APIOperation[OperationInput, OperationOutput], - input: OperationInput, + operation: APIOperation[_OperationInput, _OperationOutput], + input: _OperationInput, endpoint: URI, context: TypedProperties, ) -> HTTPRequest: @@ -274,19 +276,16 @@ def serialize_request[ ) return serializer.result - def deserialize_response_program[ - OperationInput: "SerializeableShape", - OperationOutput: "DeserializeableShape", - ]( + def deserialize_response_program( self, *, - operation: APIOperation[OperationInput, OperationOutput], + operation: APIOperation[_OperationInput, _OperationOutput], request: HTTPRequest, response: HTTPResponse, error_registry: TypeRegistry, context: TypedProperties, read_body: Callable[[AnyStreamingBlob], Any], - ) -> Program[OperationOutput]: + ) -> Program[_OperationOutput]: if not self._is_success(operation, context, response): body = yield lambda: read_body(response.body) raise self._create_error( @@ -314,15 +313,12 @@ def _has_streaming_output(self, operation: APIOperation[Any, Any]) -> bool: ).response return response_metadata.streaming_member is not None - def _deserialize_output[ - OperationInput: "SerializeableShape", - OperationOutput: "DeserializeableShape", - ]( + def _deserialize_output( self, - operation: APIOperation[OperationInput, OperationOutput], + operation: APIOperation[_OperationInput, _OperationOutput], response: HTTPResponse, body: SyncStreamingBlob | None, - ) -> OperationOutput: + ) -> _OperationOutput: deserializer = HTTPResponseDeserializer( payload_codec=self.payload_codec, response=response, @@ -451,19 +447,16 @@ class RpcClientProtocol(HttpClientProtocol): # Whether the service carries @awsQueryCompatible. _query_compatible: bool = False - def deserialize_response_program[ - OperationInput: SerializeableShape, - OperationOutput: DeserializeableShape, - ]( + def deserialize_response_program( self, *, - operation: APIOperation[OperationInput, OperationOutput], + operation: APIOperation[_OperationInput, _OperationOutput], request: HTTPRequest, response: HTTPResponse, error_registry: TypeRegistry, context: TypedProperties, read_body: Callable[[AnyStreamingBlob], Any], - ) -> Program[OperationOutput]: + ) -> Program[_OperationOutput]: if ( self._is_event_stream_member(operation.output_stream_member) and response.status == 200 @@ -482,41 +475,32 @@ def deserialize_response_program[ context=context, ) - def _deserialize_body[ - OperationInput: SerializeableShape, - OperationOutput: DeserializeableShape, - ]( + def _deserialize_body( self, *, - operation: APIOperation[OperationInput, OperationOutput], + operation: APIOperation[_OperationInput, _OperationOutput], response: HTTPResponse, body: bytes, error_registry: TypeRegistry, context: TypedProperties, - ) -> OperationOutput: + ) -> _OperationOutput: raise NotImplementedError - def _deserialize_event_stream_response[ - OperationInput: SerializeableShape, - OperationOutput: DeserializeableShape, - ]( + def _deserialize_event_stream_response( self, *, - operation: APIOperation[OperationInput, OperationOutput], + operation: APIOperation[_OperationInput, _OperationOutput], response: HTTPResponse, context: TypedProperties, - ) -> Program[OperationOutput]: + ) -> Program[_OperationOutput]: raise UnsupportedStreamError( "Event streams are not supported by synchronous clients." ) yield # pyright: ignore[reportUnreachable] - def _default_output[ - OperationInput: SerializeableShape, - OperationOutput: DeserializeableShape, - ]( - self, operation: APIOperation[OperationInput, OperationOutput] - ) -> OperationOutput: + def _default_output( + self, operation: APIOperation[_OperationInput, _OperationOutput] + ) -> _OperationOutput: """Build the output when no ``initial-response`` precedes the event stream. :raises MissingInitialResponse: when the output has a required member without @@ -680,14 +664,11 @@ def payload_codec(self) -> Codec: def content_type(self) -> str: return self._content_type - def serialize_request[ - OperationInput: SerializeableShape, - OperationOutput: DeserializeableShape, - ]( + def serialize_request( self, *, - operation: APIOperation[OperationInput, OperationOutput], - input: OperationInput, + operation: APIOperation[_OperationInput, _OperationOutput], + input: _OperationInput, endpoint: URI, context: TypedProperties, ) -> HTTPRequest: @@ -745,19 +726,16 @@ def serialize_request[ http2_required=http2_required, ) - def deserialize_response_program[ - OperationInput: SerializeableShape, - OperationOutput: DeserializeableShape, - ]( + def deserialize_response_program( self, *, - operation: APIOperation[OperationInput, OperationOutput], + operation: APIOperation[_OperationInput, _OperationOutput], request: HTTPRequest, response: HTTPResponse, error_registry: TypeRegistry, context: TypedProperties, read_body: Callable[[AnyStreamingBlob], Any], - ) -> Program[OperationOutput]: + ) -> Program[_OperationOutput]: # A response whose Smithy-Protocol header differs from the request's is # malformed: the spec requires handling it on the status code alone, without # interpreting the body or other headers. Checked first, for every status @@ -813,18 +791,15 @@ def _decode_document(self, body: bytes) -> object: """ raise NotImplementedError - def _deserialize_body[ - OperationInput: SerializeableShape, - OperationOutput: DeserializeableShape, - ]( + def _deserialize_body( self, *, - operation: APIOperation[OperationInput, OperationOutput], + operation: APIOperation[_OperationInput, _OperationOutput], response: HTTPResponse, body: bytes, error_registry: TypeRegistry, context: TypedProperties, - ) -> OperationOutput: + ) -> _OperationOutput: if response.status != 200: raise self._create_error( operation=operation, diff --git a/packages/smithy-http/src/smithy_http/schema_extensions.py b/packages/smithy-http/src/smithy_http/schema_extensions.py index 497371f78..b4854c907 100644 --- a/packages/smithy-http/src/smithy_http/schema_extensions.py +++ b/packages/smithy-http/src/smithy_http/schema_extensions.py @@ -1,5 +1,6 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 +import sys from collections.abc import Mapping from dataclasses import dataclass from types import MappingProxyType @@ -22,6 +23,12 @@ from .bindings import Binding, RequestBindingMatcher, ResponseBindingMatcher +if sys.version_info >= (3, 12): + from typing import TypeAliasType +else: + from typing_extensions import TypeAliasType + + __all__ = [ "HTTP_BINDING_SCHEMA_EXTENSION", "HTTP_OPERATION_SCHEMA_EXTENSION", @@ -34,15 +41,18 @@ "HTTPResponseBindingMetadata", ] -type HTTPResponseBindingDispatch = tuple[ - Schema, - Binding, - str | None, - bool, - TimestampFormat | None, - ShapeType, - bool, -] +HTTPResponseBindingDispatch = TypeAliasType( + "HTTPResponseBindingDispatch", + tuple[ + Schema, + Binding, + str | None, + bool, + TimestampFormat | None, + ShapeType, + bool, + ], +) """Compact response binding entry used by the deserialization hot path.""" diff --git a/packages/smithy-http/tests/unit/test_fields.py b/packages/smithy-http/tests/unit/test_fields.py index bf563b283..c03b4ef19 100644 --- a/packages/smithy-http/tests/unit/test_fields.py +++ b/packages/smithy-http/tests/unit/test_fields.py @@ -4,6 +4,8 @@ # mypy: allow-untyped-defs # mypy: allow-incomplete-defs +import sys + import pytest from smithy_http import Field, Fields, tuples_to_fields @@ -216,9 +218,15 @@ def test_fields_length_value(fields: Fields, expected_length: int) -> None: [ ( Fields([Field(name="fname1")]), + # Python 3.12 changed OrderedDict's repr to the dict form. ( "Fields(OrderedDict({'fname1': Field(name='fname1', value=[], " "kind='header')}))" + ) + if sys.version_info >= (3, 12) + else ( + "Fields(OrderedDict([('fname1', Field(name='fname1', value=[], " + "kind='header'))]))" ), ), ], diff --git a/packages/smithy-http/tests/unit/test_rpcv2_json.py b/packages/smithy-http/tests/unit/test_rpcv2_json.py index d3eefdcdd..1df32ef2b 100644 --- a/packages/smithy-http/tests/unit/test_rpcv2_json.py +++ b/packages/smithy-http/tests/unit/test_rpcv2_json.py @@ -14,7 +14,7 @@ from datetime import UTC, datetime from decimal import Decimal from io import BytesIO -from typing import Any, ClassVar, Self +from typing import Any, ClassVar, Self, TypeAlias, TypeVar import pytest @@ -64,6 +64,8 @@ from smithy_http.protocols import RpcV2JsonClientProtocol from smithy_json import JSONCodec +_T = TypeVar("_T") + _NAMESPACE = "smithy.example" _SERVICE_NAME = "JsonService" @@ -278,7 +280,7 @@ class MyUnionUnknown: tag: str -type MyUnion = MyUnionStr | MyUnionNum | MyUnionUnknown +MyUnion: TypeAlias = MyUnionStr | MyUnionNum | MyUnionUnknown class _MyUnionDeserializer: @@ -377,7 +379,7 @@ async def read(self, body: Any) -> bytes: return await read_streaming_blob_async(body) return read_streaming_blob(body) - async def run[T](self, program: Program[T]) -> T: + async def run(self, program: Program[_T]) -> _T: if self.is_async: return await run_program_async(program) return run_program(program) diff --git a/packages/smithy-json/.changes/next-release/smithy-json-feature-ee44ecc9573440c5bc6d44f3c065a860.json b/packages/smithy-json/.changes/next-release/smithy-json-feature-ee44ecc9573440c5bc6d44f3c065a860.json new file mode 100644 index 000000000..7c6cf0df2 --- /dev/null +++ b/packages/smithy-json/.changes/next-release/smithy-json-feature-ee44ecc9573440c5bc6d44f3c065a860.json @@ -0,0 +1,4 @@ +{ + "type": "feature", + "description": "Added support for Python 3.11." +} \ No newline at end of file diff --git a/packages/smithy-json/pyproject.toml b/packages/smithy-json/pyproject.toml index 31764dcad..2b4da478b 100644 --- a/packages/smithy-json/pyproject.toml +++ b/packages/smithy-json/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "smithy-json" dynamic = ["version"] -requires-python = ">=3.12" +requires-python = ">=3.11" authors = [ {name = "Amazon Web Services"}, ] @@ -19,6 +19,7 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", diff --git a/packages/smithy-json/src/smithy_json/_private/__init__.py b/packages/smithy-json/src/smithy_json/_private/__init__.py index 87c224b0a..f5f760746 100644 --- a/packages/smithy-json/src/smithy_json/_private/__init__.py +++ b/packages/smithy-json/src/smithy_json/_private/__init__.py @@ -3,7 +3,7 @@ import re from collections.abc import Mapping, Sequence from decimal import Decimal -from typing import Protocol, cast, runtime_checkable +from typing import Protocol, TypeAlias, cast, runtime_checkable from smithy_core.exceptions import SmithyError @@ -15,7 +15,7 @@ class Flushable(Protocol): def flush(self) -> None: ... -type JSONValue = ( +JSONValue: TypeAlias = ( Mapping[str, "JSONValue"] | Sequence["JSONValue"] | str diff --git a/packages/smithy-python/.changes/next-release/smithy-python-feature-a88e06bcfac446efb0ae17afa583e500.json b/packages/smithy-python/.changes/next-release/smithy-python-feature-a88e06bcfac446efb0ae17afa583e500.json new file mode 100644 index 000000000..e24a78186 --- /dev/null +++ b/packages/smithy-python/.changes/next-release/smithy-python-feature-a88e06bcfac446efb0ae17afa583e500.json @@ -0,0 +1,4 @@ +{ + "type": "feature", + "description": "Added support for Python 3.11, both to run the generator and in generated packages, which now require Python 3.11 or newer. This includes clients with API key auth, endpoint rules and RPCv2 JSON. Retained named recursive aliases and customer type-checker compatibility." +} diff --git a/packages/smithy-python/pyproject.toml b/packages/smithy-python/pyproject.toml index f067aa0d9..ed5376435 100644 --- a/packages/smithy-python/pyproject.toml +++ b/packages/smithy-python/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "smithy-python" dynamic = ["version"] -requires-python = ">=3.12" +requires-python = ">=3.11" authors = [ {name = "Amazon Web Services"}, ] @@ -18,6 +18,7 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", @@ -26,7 +27,9 @@ classifiers = [ "Programming Language :: Python :: Free Threading :: 2 - Beta", "Topic :: Software Development :: Code Generators", ] -dependencies = [] +dependencies = [ + "typing-extensions>=4.14.0; python_version < '3.12'", +] [project.scripts] smithy-python = "smithy_python.cli:main" diff --git a/packages/smithy-python/src/smithy_python/_auth.py b/packages/smithy-python/src/smithy_python/_auth.py index 8bc8937cc..2491ccaf9 100644 --- a/packages/smithy-python/src/smithy_python/_auth.py +++ b/packages/smithy-python/src/smithy_python/_auth.py @@ -9,6 +9,7 @@ from __future__ import annotations +import sys from collections.abc import Callable, Mapping from dataclasses import dataclass from types import MappingProxyType @@ -20,7 +21,12 @@ from . import models as _models from .symbols import TypeReference -type Part = str | TypeReference +if sys.version_info >= (3, 12): + from typing import TypeAliasType +else: + from typing_extensions import TypeAliasType + +Part = TypeAliasType("Part", str | TypeReference) """A piece of a generated line.""" diff --git a/packages/smithy-python/src/smithy_python/_client_emitter.py b/packages/smithy-python/src/smithy_python/_client_emitter.py index 690927595..06a7d364a 100644 --- a/packages/smithy-python/src/smithy_python/_client_emitter.py +++ b/packages/smithy-python/src/smithy_python/_client_emitter.py @@ -152,6 +152,7 @@ def _typing(name: str) -> TypeReference: _OVERLOAD: Final = _typing("overload") _UNPACK: Final = _typing("Unpack") _TYPE_CHECKING: Final = _typing("TYPE_CHECKING") +_TYPE_ALIAS: Final = _typing("TypeAlias") _CALLABLE: Final = TypeReference("Callable", "collections.abc") _DATACLASS: Final = TypeReference("dataclass", "dataclasses") _IMPORT_MODULE: Final = TypeReference("import_module", "importlib") @@ -470,7 +471,9 @@ def _write_config( writer.line("self.auth_schemes[scheme.scheme_id] = scheme") writer.line() writer.line() - writer.line("type Plugin = ", _CALLABLE, "[[", mode.config, "], None]") + writer.line( + "Plugin: ", _TYPE_ALIAS, " = ", _CALLABLE, "[[", mode.config, "], None]" + ) writer.line( _models._quote( # pyright: ignore[reportPrivateUsage] "A callable that customizes the client configuration." diff --git a/packages/smithy-python/src/smithy_python/_endpoints.py b/packages/smithy-python/src/smithy_python/_endpoints.py index ee71da60a..622f5f18e 100644 --- a/packages/smithy-python/src/smithy_python/_endpoints.py +++ b/packages/smithy-python/src/smithy_python/_endpoints.py @@ -15,9 +15,10 @@ import binascii import re import struct +import sys from collections.abc import Collection, Mapping from dataclasses import dataclass -from typing import TYPE_CHECKING, Final +from typing import TYPE_CHECKING, Final, TypeAlias from . import dependencies as _dependencies from . import exceptions as _exceptions @@ -25,11 +26,22 @@ from . import symbols as _symbols from .symbols import TypeReference +if sys.version_info >= (3, 12): + from typing import TypeAliasType +else: + from typing_extensions import TypeAliasType + if TYPE_CHECKING: from .writer import PythonWriter -type Value = None | bool | int | str | tuple[Value, ...] -"""A lowered value: a Python literal, with tuples for every sequence.""" +# Type checkers read the recursive TypeAlias; at runtime the alias is a named +# TypeAliasType, so annotations that use it resolve without the caller's globals. +# Keep both values identical. +if TYPE_CHECKING: + Value: TypeAlias = None | bool | int | str | tuple["Value", ...] + """A lowered value: a Python literal, with tuples for every sequence.""" +else: + Value = TypeAliasType("Value", None | bool | int | str | tuple["Value", ...]) @dataclass(frozen=True, slots=True) diff --git a/packages/smithy-python/src/smithy_python/_package.py b/packages/smithy-python/src/smithy_python/_package.py index 374ee5068..7a8d989e1 100644 --- a/packages/smithy-python/src/smithy_python/_package.py +++ b/packages/smithy-python/src/smithy_python/_package.py @@ -20,7 +20,7 @@ typeCheckingMode = "strict" [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] ignore = ["F841"] @@ -86,7 +86,7 @@ def _render_pyproject( version = {_toml_string(settings.package_version)} description = {_toml_string(description)} readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" keywords = ["smithy", {_toml_string(settings.package)}] license = {{text = "Apache-2.0"}} dependencies = {_toml_array(map(_requirement, dependencies.for_group("runtime")))}{groups} diff --git a/packages/smithy-python/src/smithy_python/_selector.py b/packages/smithy-python/src/smithy_python/_selector.py index 2209ddb9e..9dc549291 100644 --- a/packages/smithy-python/src/smithy_python/_selector.py +++ b/packages/smithy-python/src/smithy_python/_selector.py @@ -5,12 +5,13 @@ from __future__ import annotations import re +import sys from collections import deque from collections.abc import Callable, Iterable, Mapping, Sequence from dataclasses import dataclass from decimal import Decimal, InvalidOperation from types import MappingProxyType -from typing import Final, NoReturn, Self, cast +from typing import Final, NoReturn, Self, TypeAlias, cast from .exceptions import SelectorSyntaxError from .model import ( @@ -27,8 +28,14 @@ ShapeType, ) -type _Receiver = Callable[[Shape], bool] -type _ValueData = ( +if sys.version_info >= (3, 12): + from typing import TypeAliasType +else: + from typing_extensions import TypeAliasType + + +_Receiver = TypeAliasType("_Receiver", Callable[[Shape], bool]) +_ValueData: TypeAlias = ( None | bool | int @@ -37,7 +44,7 @@ | Shape | ShapeId | tuple[Node, ...] - | tuple[_Value, ...] + | tuple["_Value", ...] | Mapping[str, Node] ) diff --git a/packages/smithy-python/src/smithy_python/dependencies.py b/packages/smithy-python/src/smithy_python/dependencies.py index 676bacfc5..05f7e5c31 100644 --- a/packages/smithy-python/src/smithy_python/dependencies.py +++ b/packages/smithy-python/src/smithy_python/dependencies.py @@ -4,12 +4,19 @@ from __future__ import annotations +import sys from collections.abc import Collection, Iterable, Iterator from dataclasses import dataclass from typing import Literal from . import exceptions as _exceptions +if sys.version_info >= (3, 12): + from typing import TypeAliasType +else: + from typing_extensions import TypeAliasType + + __all__ = [ "HATCHLING", "PYTEST", @@ -22,7 +29,9 @@ "DependencySet", ] -type DependencyGroup = Literal["runtime", "build", "test", "docs"] +DependencyGroup = TypeAliasType( + "DependencyGroup", Literal["runtime", "build", "test", "docs"] +) _GROUP_ORDER: dict[DependencyGroup, int] = { "runtime": 0, diff --git a/packages/smithy-python/src/smithy_python/files.py b/packages/smithy-python/src/smithy_python/files.py index 17ba2da47..7fe2990be 100644 --- a/packages/smithy-python/src/smithy_python/files.py +++ b/packages/smithy-python/src/smithy_python/files.py @@ -8,6 +8,7 @@ import itertools import json import os +import sys import tempfile from dataclasses import dataclass from pathlib import Path, PurePosixPath @@ -17,6 +18,12 @@ from . import exceptions as _exceptions from . import writer as _writer +if sys.version_info >= (3, 12): + from typing import TypeAliasType +else: + from typing_extensions import TypeAliasType + + __all__ = ["FileManifest"] _MANIFEST_PATH: Final = ".smithy-python-manifest.json" @@ -282,7 +289,7 @@ class _TextFile: content: str -type _GeneratedFile = _PythonFile | _TextFile +_GeneratedFile = TypeAliasType("_GeneratedFile", _PythonFile | _TextFile) def _normalize_path(path: str) -> str: diff --git a/packages/smithy-python/src/smithy_python/generation.py b/packages/smithy-python/src/smithy_python/generation.py index 4d06d3068..0082c5f70 100644 --- a/packages/smithy-python/src/smithy_python/generation.py +++ b/packages/smithy-python/src/smithy_python/generation.py @@ -7,7 +7,7 @@ from collections.abc import Mapping from dataclasses import dataclass, field from types import MappingProxyType -from typing import Protocol +from typing import Generic, Protocol, TypeVar from . import dependencies as _dependencies from . import files as _files @@ -28,6 +28,12 @@ "TypesSettings", ] +_SettingsT_co = TypeVar("_SettingsT_co", bound="ArtifactSettings", covariant=True) +_SettingsT_contra = TypeVar( + "_SettingsT_contra", bound="ArtifactSettings", contravariant=True +) + + _SERVICE_ERROR = "ServiceError" _UNIT = _model.ShapeId("smithy.api", "Unit") @@ -209,12 +215,12 @@ def from_selection( @dataclass(frozen=True, slots=True) -class GenerationContext[SettingsT: ArtifactSettings]: +class GenerationContext(Generic[_SettingsT_co]): """State shared by one artifact generation.""" model: _model.Model selection: _selection.Selection - settings: SettingsT + settings: _SettingsT_co symbols: _symbols.SymbolProvider plan: GenerationPlan dependencies: _dependencies.DependencySet @@ -227,9 +233,9 @@ def __post_init__(self) -> None: ) -class ArtifactGenerator[SettingsT: ArtifactSettings](Protocol): +class ArtifactGenerator(Protocol[_SettingsT_contra]): """Generate one artifact into the context's file manifest.""" - def generate(self, context: GenerationContext[SettingsT]) -> None: + def generate(self, context: GenerationContext[_SettingsT_contra]) -> None: """Register every generated file and dependency.""" ... diff --git a/packages/smithy-python/src/smithy_python/model/_loader.py b/packages/smithy-python/src/smithy_python/model/_loader.py index 326421b6e..529603913 100644 --- a/packages/smithy-python/src/smithy_python/model/_loader.py +++ b/packages/smithy-python/src/smithy_python/model/_loader.py @@ -25,6 +25,7 @@ from __future__ import annotations import json +import sys from collections.abc import Iterable, Mapping, Sequence from dataclasses import dataclass, field from types import MappingProxyType @@ -48,11 +49,17 @@ SimpleShape, ) +if sys.version_info >= (3, 12): + from typing import TypeAliasType +else: + from typing_extensions import TypeAliasType + + # Smithy 1.0 differs semantically (set shapes, boxing), so only 2.x is loaded. SUPPORTED_MAJOR_VERSION: Final = "2" -type _Json = dict[str, object] -type _Traits = dict[ShapeId, Node] +_Json = TypeAliasType("_Json", dict[str, object]) +_Traits = TypeAliasType("_Traits", dict[ShapeId, Node]) _LIFECYCLE: Final = ("create", "put", "read", "update", "delete", "list") diff --git a/packages/smithy-python/src/smithy_python/model/_model.py b/packages/smithy-python/src/smithy_python/model/_model.py index e26dd3074..fda636aff 100644 --- a/packages/smithy-python/src/smithy_python/model/_model.py +++ b/packages/smithy-python/src/smithy_python/model/_model.py @@ -6,12 +6,14 @@ from collections.abc import Iterator, Mapping from types import MappingProxyType -from typing import overload +from typing import TypeVar, overload from ..exceptions import ModelError, ShapeNotFoundError from ._shape_id import PRELUDE_NAMESPACE, ShapeId, as_shape_id from ._shapes import MemberShape, Node, ServiceShape, Shape, ShapeType +_T = TypeVar("_T", bound=Shape) + class Model: """A loaded, mixin-flattened Smithy model. @@ -72,7 +74,7 @@ def get_shape(self, shape_id: ShapeId | str) -> Shape: raise ShapeNotFoundError(f"Shape {shape_id} is not defined in the model") return shape - def expect_shape[T: Shape](self, shape_id: ShapeId | str, kind: type[T]) -> T: + def expect_shape(self, shape_id: ShapeId | str, kind: type[_T]) -> _T: """Return the shape with this ID, requiring it to be a ``kind``.""" shape = self.get_shape(shape_id) if not isinstance(shape, kind): @@ -97,9 +99,9 @@ def iter_shapes( ) -> Iterator[Shape]: ... @overload - def iter_shapes[T: Shape]( - self, kind: type[T], *, include_prelude: bool = False - ) -> Iterator[T]: ... + def iter_shapes( + self, kind: type[_T], *, include_prelude: bool = False + ) -> Iterator[_T]: ... @overload def iter_shapes( diff --git a/packages/smithy-python/src/smithy_python/model/_shapes.py b/packages/smithy-python/src/smithy_python/model/_shapes.py index f77561eb0..db367d89c 100644 --- a/packages/smithy-python/src/smithy_python/model/_shapes.py +++ b/packages/smithy-python/src/smithy_python/model/_shapes.py @@ -4,21 +4,44 @@ from __future__ import annotations +import sys from collections.abc import Mapping from dataclasses import dataclass, field from enum import StrEnum from types import MappingProxyType -from typing import Final +from typing import TYPE_CHECKING, Final, TypeAlias from ._shape_id import PRELUDE_NAMESPACE, ShapeId, as_shape_id -type Node = None | bool | int | float | str | tuple[Node, ...] | Mapping[str, Node] -"""A deeply immutable JSON value: arrays are tuples, objects read-only mappings.""" +if sys.version_info >= (3, 12): + from typing import TypeAliasType +else: + from typing_extensions import TypeAliasType + +# Type checkers read the recursive TypeAliases; at runtime each alias is a named +# TypeAliasType, so annotations that use it resolve without the caller's globals. +# Keep both values of each alias identical. +if TYPE_CHECKING: + Node: TypeAlias = ( + None | bool | int | float | str | tuple["Node", ...] | Mapping[str, "Node"] + ) + """A deeply immutable JSON value: arrays are tuples, objects read-only mappings.""" +else: + Node = TypeAliasType( + "Node", + None | bool | int | float | str | tuple["Node", ...] | Mapping[str, "Node"], + ) -type JsonValue = ( - None | bool | int | float | str | list[JsonValue] | dict[str, JsonValue] -) -"""A mutable JSON value, as produced by :func:`to_json`.""" +if TYPE_CHECKING: + JsonValue: TypeAlias = ( + None | bool | int | float | str | list["JsonValue"] | dict[str, "JsonValue"] + ) + """A mutable JSON value, as produced by :func:`to_json`.""" +else: + JsonValue = TypeAliasType( + "JsonValue", + None | bool | int | float | str | list["JsonValue"] | dict[str, "JsonValue"], + ) def to_json(node: Node) -> JsonValue: @@ -87,6 +110,8 @@ class ShapeType(StrEnum): MIXIN_TRAIT: Final = ShapeId(PRELUDE_NAMESPACE, "mixin") UNIT: Final = ShapeId(PRELUDE_NAMESPACE, "Unit") +# Shared empty defaults. Python 3.11 rejects an unhashable mappingproxy as a +# dataclass default, so fields return these from a default factory instead. _EMPTY_TRAITS: Final[Mapping[ShapeId, Node]] = MappingProxyType({}) _EMPTY_MEMBERS: Final[Mapping[str, MemberShape]] = MappingProxyType({}) @@ -103,7 +128,7 @@ class Shape: id: ShapeId type: ShapeType - traits: Mapping[ShapeId, Node] = _EMPTY_TRAITS + traits: Mapping[ShapeId, Node] = field(default_factory=lambda: _EMPTY_TRAITS) """Trait ID to JSON node value, in merge order (see the loader docs).""" mixins: tuple[ShapeId, ...] = () """The mixins this shape declared, in declaration order. @@ -111,7 +136,7 @@ class Shape: Informational only: members, traits, and properties already include everything inherited from these mixins. """ - members: Mapping[str, MemberShape] = _EMPTY_MEMBERS + members: Mapping[str, MemberShape] = field(default_factory=lambda: _EMPTY_MEMBERS) """Members by name, in order: inherited mixin members, then local ones.""" def has_trait(self, trait: ShapeId | str) -> bool: diff --git a/packages/smithy-python/src/smithy_python/models.py b/packages/smithy-python/src/smithy_python/models.py index fe3e409ae..251f8e362 100644 --- a/packages/smithy-python/src/smithy_python/models.py +++ b/packages/smithy-python/src/smithy_python/models.py @@ -4,6 +4,7 @@ from __future__ import annotations +import sys from collections.abc import Callable, Collection, Mapping from dataclasses import replace from json import dumps @@ -15,6 +16,12 @@ from . import model as _model from . import symbols as _symbols +if sys.version_info >= (3, 12): + from typing import TypeAliasType +else: + from typing_extensions import TypeAliasType + + if TYPE_CHECKING: from .generation import GenerationContext, ModelArtifactSettings, ModelPlan from .writer import PythonWriter @@ -89,7 +96,7 @@ def _core_reference(name: str, module: str) -> _symbols.TypeReference: _MAPPING: Final = _symbols.TypeReference("Mapping", "collections.abc") _UNIT_ID: Final = _model.ShapeId("smithy.api", "Unit") -type _SourcePart = str | _symbols.TypeReference +_SourcePart = TypeAliasType("_SourcePart", str | _symbols.TypeReference) _ERROR_MESSAGE_NAMES: Final = frozenset({"errormessage", "error_message", "message"}) _DOCSTRING_WIDTH: Final = 72 diff --git a/packages/smithy-python/src/smithy_python/schemas.py b/packages/smithy-python/src/smithy_python/schemas.py index fb97fc516..490f66550 100644 --- a/packages/smithy-python/src/smithy_python/schemas.py +++ b/packages/smithy-python/src/smithy_python/schemas.py @@ -4,6 +4,7 @@ from __future__ import annotations +import sys from collections.abc import Collection, Mapping from dataclasses import dataclass from math import ceil, isfinite, sqrt @@ -15,6 +16,12 @@ from . import model as _model from . import symbols as _symbols +if sys.version_info >= (3, 12): + from typing import TypeAliasType +else: + from typing_extensions import TypeAliasType + + if TYPE_CHECKING: from .generation import GenerationContext, ModelArtifactSettings from .writer import PythonWriter @@ -379,8 +386,8 @@ def _shape_id(value: str) -> _model.ShapeId: ), ) -type _SourcePart = str | _symbols.TypeReference -type _TraitPlan = int | Mapping[_model.ShapeId, _model.Node] +_SourcePart = TypeAliasType("_SourcePart", str | _symbols.TypeReference) +_TraitPlan = TypeAliasType("_TraitPlan", int | Mapping[_model.ShapeId, _model.Node]) def _write_shape( diff --git a/packages/smithy-python/src/smithy_python/symbols.py b/packages/smithy-python/src/smithy_python/symbols.py index 0cccdce44..6d4cd9979 100644 --- a/packages/smithy-python/src/smithy_python/symbols.py +++ b/packages/smithy-python/src/smithy_python/symbols.py @@ -423,7 +423,7 @@ def model_names(self) -> frozenset[str]: ) -# Union of Python 3.12-3.15 hard keywords, independent of the host interpreter. +# Union of Python 3.11-3.15 hard keywords, independent of the host interpreter. # Soft keywords (match, case, type, lazy, _) remain ordinary identifiers here. # Update this when adding support for another Python version. _KEYWORDS = frozenset( diff --git a/packages/smithy-python/src/smithy_python/writer.py b/packages/smithy-python/src/smithy_python/writer.py index ddd1e696d..18d747bc3 100644 --- a/packages/smithy-python/src/smithy_python/writer.py +++ b/packages/smithy-python/src/smithy_python/writer.py @@ -13,7 +13,7 @@ from collections.abc import Callable, Generator, Iterable from contextlib import contextmanager from dataclasses import dataclass, field -from typing import Literal +from typing import Literal, TypeAlias from unicodedata import normalize from . import dependencies as _dependencies @@ -22,7 +22,7 @@ __all__ = ["PythonWriter"] -# Union of Python 3.12-3.15 builtins, including platform-specific names. +# Union of Python 3.11-3.15 builtins, including platform-specific names. # Keep this fixed so import planning does not depend on the generator host. _BUILTINS = frozenset( "ArithmeticError AssertionError AttributeError BaseException BaseExceptionGroup " @@ -50,7 +50,7 @@ ) -type _Kind = Literal["module", "class", "function", "comprehension", "annotation"] +_Kind: TypeAlias = Literal["module", "class", "function", "comprehension"] _COMPREHENSIONS = (ast.ListComp, ast.SetComp, ast.DictComp, ast.GeneratorExp) @@ -129,18 +129,26 @@ def _names(self) -> tuple[frozenset[str], list[frozenset[str]]]: prefix = _placeholder_prefix("".join(self._body(lambda _: ""))) numbers = itertools.count() source = "\n".join(self._body(lambda _: f"{prefix}{next(numbers)}_")) + # The 3.11 grammar reports what 3.12+ reports as SyntaxWarning, such as + # invalid escape sequences, as DeprecationWarning. + categories = (SyntaxWarning, DeprecationWarning) with warnings.catch_warnings(record=True) as caught: - warnings.simplefilter("always", SyntaxWarning) + for category in categories: + warnings.simplefilter("always", category) try: - tree = ast.parse(source, feature_version=(3, 12)) + # Generated code must run on the oldest supported Python. Python + # 3.12+ hosts reject newer statements such as PEP 695 type + # parameters here, but only a 3.11 host also rejects PEP 701 + # f-strings, which CI covers. + tree = ast.parse(source, feature_version=(3, 11)) except SyntaxError as error: raise CodegenError( - f"Written lines are not valid Python 3.12 (line {error.lineno}): " + f"Written lines are not valid Python 3.11 (line {error.lineno}): " f"{error.msg}" ) from error for warning in caught: # Invalid escape sequences become errors in future Python versions. - if issubclass(warning.category, SyntaxWarning): + if issubclass(warning.category, categories): raise CodegenError( f"Written lines raise SyntaxWarning (line {warning.lineno}): " f"{warning.message}" @@ -306,9 +314,8 @@ class _Import: class _Scope: """A Python scope found in the written lines. - Class names are visible only to code directly in the class body and to its - annotation scopes (type parameters). Functions, lambdas and comprehensions - nested in a class cannot see them. + Class names are visible only to code directly in the class body. Functions, + lambdas and comprehensions nested in a class cannot see them. """ kind: _Kind @@ -329,7 +336,7 @@ def visible_names(self) -> set[str]: names: set[str] = set() scope, child = self, None while scope.parent is not None: - if scope.kind != "class" or child is None or child.kind == "annotation": + if scope.kind != "class" or child is None: names |= scope.names scope, child = scope.parent, scope return names @@ -421,15 +428,13 @@ def _placeholder_prefix(text: str) -> str: def _bound_name(node: ast.AST) -> str | None: - """Return the name that a pattern, handler, import or type parameter binds.""" + """Return the name that a pattern, handler or import binds.""" if isinstance(node, ast.alias): return None if node.name == "*" else node.asname or node.name.split(".")[0] if isinstance(node, (ast.ExceptHandler, ast.MatchAs, ast.MatchStar)): return node.name if isinstance(node, ast.MatchMapping): return node.rest - if isinstance(node, (ast.TypeVar, ast.ParamSpec, ast.TypeVarTuple)): - return node.name return None @@ -453,16 +458,6 @@ def _analyze( (node, module, False) for node in tree.body ] - def type_scope( - node: ast.FunctionDef | ast.AsyncFunctionDef | ast.ClassDef | ast.TypeAlias, - scope: _Scope, - ) -> _Scope: - if not node.type_params: - return scope - inner = _Scope("annotation", scope) - pending.extend((param, inner, True) for param in node.type_params) - return inner - while pending: node, scope, lazy = pending.pop() if node is None: @@ -473,7 +468,7 @@ def type_scope( elif prefix in node.id: pass # A reference joined to raw text; its scope is unknown. elif isinstance(node.ctx, ast.Load): - if scope.kind in ("class", "annotation"): + if scope.kind == "class": position = (node.lineno, node.col_offset) loads.append((scope, node.id, lazy, position)) else: @@ -501,29 +496,24 @@ def type_scope( else: bindings.append((scope, node.name, False)) pending.extend((item, scope, False) for item in node.decorator_list) - outer = type_scope(node, scope) pending.extend( - (annotation, outer, True) + (annotation, scope, True) for annotation in ( *(parameter.annotation for parameter in parameters), node.returns, ) ) - inner = _Scope("function", outer) + inner = _Scope("function", scope) pending.extend((item, inner, False) for item in node.body) bindings.extend((inner, parameter.arg, False) for parameter in parameters) elif isinstance(node, ast.ClassDef): bindings.append((scope, node.name, True)) pending.extend((item, scope, False) for item in node.decorator_list) - outer = type_scope(node, scope) pending.extend( - (item, outer, False) for item in (*node.bases, *node.keywords) + (item, scope, False) for item in (*node.bases, *node.keywords) ) - inner = _Scope("class", outer, node.name) + inner = _Scope("class", scope, node.name) pending.extend((item, inner, False) for item in node.body) - elif isinstance(node, ast.TypeAlias): - bindings.append((scope, node.name.id, False)) - pending.append((node.value, type_scope(node, scope), True)) elif isinstance(node, _COMPREHENSIONS): # Only the first iterable is evaluated in the enclosing scope. first, *rest = node.generators @@ -584,13 +574,6 @@ def type_scope( outside = module.names | _BUILTINS shadowed: list[tuple[tuple[int, int], str, str]] = [] for scope, name, lazy, position in loads: - if scope.kind == "annotation": - # Type parameter scopes see the names of a directly enclosing class. - if scope.parent is None or scope.parent.kind != "class": - continue - if name in scope.names: - continue - scope = scope.parent if name not in outside: continue # Annotations are evaluated later, against the finished class. Other diff --git a/packages/smithy-python/tests/unit/model/test_recursive_aliases.py b/packages/smithy-python/tests/unit/model/test_recursive_aliases.py new file mode 100644 index 000000000..7958c8b5a --- /dev/null +++ b/packages/smithy-python/tests/unit/model/test_recursive_aliases.py @@ -0,0 +1,63 @@ +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 +"""Public recursive aliases stay named runtime aliases for customer annotations.""" + +import pickle +from collections.abc import Callable +from typing import Any, get_args, get_type_hints + +import pytest +import smithy_python.model +from smithy_python.model import JsonValue as CustomerJsonValue +from smithy_python.model import Node as CustomerNode + + +def _renamed_node(value: CustomerNode) -> None: ... +def _qualified_node(value: smithy_python.model.Node) -> None: ... +def _renamed_json_value(value: CustomerJsonValue) -> None: ... +def _qualified_json_value(value: smithy_python.model.JsonValue) -> None: ... + + +_ALIASES = [ + pytest.param( + smithy_python.model.Node, + "Node", + [_renamed_node, _qualified_node], + id="Node", + ), + pytest.param( + smithy_python.model.JsonValue, + "JsonValue", + [_renamed_json_value, _qualified_json_value], + id="JsonValue", + ), +] + + +@pytest.mark.parametrize("alias, name, annotated", _ALIASES) +def test_alias_is_named_at_runtime( + alias: Any, name: str, annotated: list[Callable[..., None]] +) -> None: + assert alias.__name__ == name + assert alias.__module__ == "smithy_python.model._shapes" + assert alias.__type_params__ == () + assert {str, int, float, bool, type(None)} <= set(get_args(alias.__value__)) + assert pickle.loads(pickle.dumps(alias)) is alias + + +@pytest.mark.parametrize("alias, name, annotated", _ALIASES) +def test_renamed_and_qualified_annotations_resolve( + alias: Any, name: str, annotated: list[Callable[..., None]] +) -> None: + for function in annotated: + assert get_type_hints(function)["value"] is alias + + +@pytest.mark.parametrize("alias, name, annotated", _ALIASES) +def test_customer_global_with_alias_name_is_ignored( + alias: Any, name: str, annotated: list[Callable[..., None]] +) -> None: + # A customer module that also defines a global with the alias's own name. + namespace = {**globals(), name: int} + for function in annotated: + assert get_type_hints(function, globalns=namespace)["value"] is alias diff --git a/packages/smithy-python/tests/unit/test_cli.py b/packages/smithy-python/tests/unit/test_cli.py index 4c0128199..1b2befae0 100644 --- a/packages/smithy-python/tests/unit/test_cli.py +++ b/packages/smithy-python/tests/unit/test_cli.py @@ -175,7 +175,7 @@ def test_types_generation_writes_complete_package( "version": "1.2.3", "description": "example_types types package", "readme": "README.md", - "requires-python": ">=3.12", + "requires-python": ">=3.11", "keywords": ["smithy", "example_types"], "license": {"text": "Apache-2.0"}, "dependencies": ["smithy-core~=0.13.0"], @@ -184,6 +184,7 @@ def test_types_generation_writes_complete_package( "requires": ["hatchling"], "build-backend": "hatchling.build", } + assert project["tool"]["ruff"]["target-version"] == "py311" monkeypatch.syspath_prepend( # pyright: ignore[reportUnknownMemberType] str(output / "src") ) diff --git a/packages/smithy-python/tests/unit/test_writer.py b/packages/smithy-python/tests/unit/test_writer.py index 8ced66c1e..10922b186 100644 --- a/packages/smithy-python/tests/unit/test_writer.py +++ b/packages/smithy-python/tests/unit/test_writer.py @@ -127,7 +127,7 @@ def test_nested_same_module_annotations( "__lazy_import__", # Added in Python 3.15. "frozendict", # Added in Python 3.15. "sentinel", # Added in Python 3.15. - "WindowsError", # Windows-only, present throughout Python 3.12-3.15. + "WindowsError", # Windows-only, present throughout Python 3.11-3.15. ], ) def test_imports_reserve_builtins_across_supported_versions( @@ -402,8 +402,6 @@ def test_module_names_can_be_rebound( "values = [{ref} for list in ()]", "match None:\n case list:\n pass\nvalue: {ref}", "match {}:\n case {**list}:\n pass\nvalue: {ref}", - "type Alias[list] = {ref}", - "def build[list](value: {ref}) -> None: ...", "class Holder:\n list = None\n def build(self) -> {ref}: ...", ], ) @@ -506,10 +504,6 @@ def test_placeholder_spelling_cannot_hide_a_name() -> None: ), ("class Node:\n list: int = 0\n def build(self, kind=list): ...", "list"), ("class Node:\n list = None\n def build(self) -> list: ...", "list"), - ( - "class Node:\n list = None\n def build[T](self) -> list[T]: ...", - "list", - ), ("class Node:\n def list(self): ...\n items: list[int]", "list"), ("class Node:\n list: int = 0\n class Inner(list): ...", "list"), ( @@ -552,11 +546,6 @@ def test_raw_names_shadowed_in_class_fail(source: str, name: str) -> None: "class Config: ...\nclass Node:\n class Config: ...\n config: Config", # Class bodies do not see an enclosing class's members. "class Node:\n list = None\n class Inner:\n items = list", - # Type parameters are not class members. - "class Node:\n def build[T](self, value: T) -> T: ...", - "def build[T](value: T) -> T: ...", - # Base classes run in order, including those of generic classes. - "class Node:\n list = None\n class Inner[T](list): ...", "class Node:\n values = [list for list in ()]", ], ) @@ -571,12 +560,16 @@ def test_raw_names_not_shadowed_in_class_pass(source: str) -> None: [ "class Node", # Missing colon. "value = t'text'", # Template strings need Python 3.14. + # Generated code must run on Python 3.11, which predates PEP 695. + "type Alias = int", + "def build[T](value: T) -> T: ...", + "class Node[T]: ...", ], ) def test_invalid_python_fails_at_render(line: str) -> None: writer = PythonWriter("models") writer.line(line) - message = "Written lines are not valid Python 3.12" + message = "Written lines are not valid Python 3.11" with pytest.raises(CodegenError, match="^" + re.escape(message)): writer.render() @@ -739,13 +732,20 @@ def test_relative_reference_modules_are_valid(module: str) -> None: compile(writer.render(), "", "exec") -def test_generation_without_runtime_packages() -> None: +def test_generation_without_runtime_packages(tmp_path: Path) -> None: + import shutil import subprocess - source_path = Path(__file__).resolve().parents[2] / "src" + paths = [str(Path(__file__).resolve().parents[2] / "src")] + if sys.version_info < (3, 12): + # The generator's only dependency, and only on Python 3.11. + import typing_extensions + + shutil.copy(typing_extensions.__file__, tmp_path) + paths.append(str(tmp_path)) program = ( "import sys, importlib.util\n" - f"sys.path.insert(0, {str(source_path)!r})\n" + f"sys.path[:0] = {paths!r}\n" "assert importlib.util.find_spec('smithy_core') is None\n" "from smithy_python.writer import PythonWriter\n" "from smithy_python.symbols import TypeReference\n" diff --git a/packages/smithy-test/.changes/next-release/smithy-test-feature-ea0c2d8cfdce43d0bacaf3ec552276ea.json b/packages/smithy-test/.changes/next-release/smithy-test-feature-ea0c2d8cfdce43d0bacaf3ec552276ea.json new file mode 100644 index 000000000..7c6cf0df2 --- /dev/null +++ b/packages/smithy-test/.changes/next-release/smithy-test-feature-ea0c2d8cfdce43d0bacaf3ec552276ea.json @@ -0,0 +1,4 @@ +{ + "type": "feature", + "description": "Added support for Python 3.11." +} \ No newline at end of file diff --git a/packages/smithy-test/pyproject.toml b/packages/smithy-test/pyproject.toml index 63f1f090e..66796ecea 100644 --- a/packages/smithy-test/pyproject.toml +++ b/packages/smithy-test/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "smithy-test" dynamic = ["version"] -requires-python = ">=3.12" +requires-python = ">=3.11" authors = [ {name = "Amazon Web Services"}, ] @@ -19,6 +19,7 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", @@ -31,6 +32,7 @@ dependencies = [ "smithy-core~=0.13.0", "smithy-http~=0.10.0", "smithy-aws-core~=0.16.0", + "typing-extensions>=4.14.0; python_version < '3.12'", ] [project.urls] diff --git a/packages/smithy-test/src/smithy_test/aio/_endpoints.py b/packages/smithy-test/src/smithy_test/aio/_endpoints.py index b9540162d..9e436e568 100644 --- a/packages/smithy-test/src/smithy_test/aio/_endpoints.py +++ b/packages/smithy-test/src/smithy_test/aio/_endpoints.py @@ -8,7 +8,7 @@ """ from collections.abc import Awaitable, Callable, Mapping, Sequence -from typing import Any, Concatenate +from typing import Any, Concatenate, TypeVar from smithy_core.endpoints import RulesExtension from smithy_core.exceptions import EndpointResolutionError @@ -22,10 +22,12 @@ check_error, ) +_C = TypeVar("_C") -async def check_client_case_async[C]( - client: Callable[[Interceptor[Any, Any, Any, Any]], Awaitable[C]], - operation: Callable[Concatenate[C, ...], Awaitable[Any]], + +async def check_client_case_async( + client: Callable[[Interceptor[Any, Any, Any, Any]], Awaitable[_C]], + operation: Callable[Concatenate[_C, ...], Awaitable[Any]], input: Mapping[str, Any], expect: Mapping[str, Any], *, diff --git a/packages/smithy-test/src/smithy_test/aio/http_mock.py b/packages/smithy-test/src/smithy_test/aio/http_mock.py index e85a6f34a..5abee86e6 100644 --- a/packages/smithy-test/src/smithy_test/aio/http_mock.py +++ b/packages/smithy-test/src/smithy_test/aio/http_mock.py @@ -7,7 +7,7 @@ from copy import copy from dataclasses import dataclass from types import TracebackType -from typing import Any, Self +from typing import Any, Self, TypeVar from smithy_core.aio.client import AsyncClient from smithy_core.aio.types import AsyncBytesProvider @@ -22,8 +22,10 @@ __all__ = ["AsyncHTTPMockController", "mock_async"] +_C = TypeVar("_C") -async def mock_async[C](client: AsyncClient[C]) -> "AsyncHTTPMockController": + +async def mock_async(client: AsyncClient[_C]) -> "AsyncHTTPMockController": """Take over a client so its requests are matched and answered, never sent. :raises TypeError: If the client isn't an async client this mock can take over. diff --git a/packages/smithy-test/src/smithy_test/http_mock.py b/packages/smithy-test/src/smithy_test/http_mock.py index a70e68129..8a272236c 100644 --- a/packages/smithy-test/src/smithy_test/http_mock.py +++ b/packages/smithy-test/src/smithy_test/http_mock.py @@ -1,10 +1,11 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 # pyright: reportPrivateUsage=false +import sys from collections.abc import Callable, Mapping from copy import copy from types import TracebackType -from typing import Any, Self +from typing import Any, Self, TypeVar from smithy_core.client import Client from smithy_core.exceptions import SmithyError @@ -16,6 +17,12 @@ from ._private.http_mock import NoResponse, mismatches, take_over +if sys.version_info >= (3, 12): + from typing import TypeAliasType +else: + from typing_extensions import TypeAliasType + + __all__ = [ "HTTPMockController", "HTTPMockError", @@ -24,17 +31,24 @@ "mock", ] -type _Matcher[T] = str | Callable[[T], bool | None] +_C = TypeVar("_C") +_T = TypeVar("_T") + + +_Matcher = TypeAliasType( + "_Matcher", str | Callable[[_T], bool | None], type_params=(_T,) +) """An exact string, a ``"/regex/"`` string, or a callable returning True or None.""" -type _EntriesMatcher = ( - Mapping[str, _Matcher[str]] | Callable[[dict[str, str]], bool | None] +_EntriesMatcher = TypeAliasType( + "_EntriesMatcher", + (Mapping[str, _Matcher[str]] | Callable[[dict[str, str]], bool | None]), ) -type _ResponseBody = str | AnyStreamingBlob +_ResponseBody = TypeAliasType("_ResponseBody", str | AnyStreamingBlob) -def mock[C](client: Client[C]) -> "HTTPMockController": +def mock(client: Client[_C]) -> "HTTPMockController": """Take over a client so its requests are matched and answered, never sent. :raises TypeError: If the client isn't a sync client this mock can take over. diff --git a/packages/smithy-xml/.changes/next-release/smithy-xml-feature-02a2e1e3445f4d3c9873f5758b5796d6.json b/packages/smithy-xml/.changes/next-release/smithy-xml-feature-02a2e1e3445f4d3c9873f5758b5796d6.json new file mode 100644 index 000000000..7c6cf0df2 --- /dev/null +++ b/packages/smithy-xml/.changes/next-release/smithy-xml-feature-02a2e1e3445f4d3c9873f5758b5796d6.json @@ -0,0 +1,4 @@ +{ + "type": "feature", + "description": "Added support for Python 3.11." +} \ No newline at end of file diff --git a/packages/smithy-xml/pyproject.toml b/packages/smithy-xml/pyproject.toml index f35f40f4a..967c4cadf 100644 --- a/packages/smithy-xml/pyproject.toml +++ b/packages/smithy-xml/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "smithy-xml" dynamic = ["version"] -requires-python = ">=3.12" +requires-python = ">=3.11" authors = [ {name = "Amazon Web Services"}, ] @@ -19,6 +19,7 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", diff --git a/packages/smithy-xml/src/smithy_xml/_private/traits.py b/packages/smithy-xml/src/smithy_xml/_private/traits.py index 95e70d1e8..1a60ced5d 100644 --- a/packages/smithy-xml/src/smithy_xml/_private/traits.py +++ b/packages/smithy-xml/src/smithy_xml/_private/traits.py @@ -1,11 +1,15 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 +from typing import TypeVar + from smithy_core.schemas import Schema from smithy_core.shapes import ShapeID from smithy_core.traits import ORIGINAL_SHAPE_ID, Trait, XMLNameTrait +_T = TypeVar("_T", bound=Trait) + -def direct_trait[T: Trait](schema: Schema, trait: type[T]) -> T | None: +def direct_trait(schema: Schema, trait: type[_T]) -> _T | None: """Get a trait applied to the member itself rather than inherited from its target. Member schemas carry their target's traits, but a structure's ``@xmlName`` or diff --git a/pyproject.toml b/pyproject.toml index a2d0c228e..cb3af0842 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ name = "smithy-python-workspace" version = "0.1.0" description = "Add your description here" readme = "README.md" -requires-python = ">=3.12" +requires-python = ">=3.11" dependencies = [] [dependency-groups] @@ -65,7 +65,7 @@ addopts = [ "--import-mode=importlib", "--cov", "--cov-report=term-missing" ] consider_namespace_packages = true [tool.ruff] -target-version = "py312" +target-version = "py311" [tool.ruff.lint] # candidates: DTZ, EM, INP, ISC, PERF, SIM118, SIM401, SLOT diff --git a/scripts/api-snapshot/api-rex.json b/scripts/api-snapshot/api-rex.json index fe92a8951..c48c3d778 100644 --- a/scripts/api-snapshot/api-rex.json +++ b/scripts/api-snapshot/api-rex.json @@ -38,10 +38,6 @@ "identity": "rex-module", "io": "rex-module" }, - "aws_sdk_signers.interfaces.events": { - "HEADERS_DICT": "rex-type_alias", - "HEADER_VALUE": "rex-type_alias" - }, "aws_sdk_signers.signers": { "AWSRequest": "rex-class", "ResourceLifecycleError": "rex-exception", @@ -64,7 +60,6 @@ "HTTPRequest": "rex-protocol", "PropertyKey": "rex-class", "SigV4EventSigner": "rex-class", - "SigV4Signer": "rex-type_alias", "SigV4SigningProperties": "rex-class" }, "smithy_aws_core.aio.checksums": { @@ -105,7 +100,6 @@ "smithy_aws_core.aio.identity": { "AWSCredentialsIdentity": "rex-class", "AWSIdentityProperties": "rex-class", - "AsyncAWSCredentialsResolver": "rex-type_alias", "AsyncContainerCredentialsResolver": "rex-class[async]", "AsyncEnvironmentCredentialsResolver": "rex-class[async]", "AsyncIMDSCredentialsResolver": "rex-class[async]", @@ -265,6 +259,7 @@ "Program": "rex-type_alias", "Resolved": "rex-class", "RetryStrategyOptions": "rex-class", + "RetryStrategyType": "rex-type_alias", "SharedConfigContext": "rex-class", "UNSET": "rex-_UnsetType", "run_program": "rex-function", @@ -290,8 +285,6 @@ "smithy_aws_core.config.file_parser": { "ConfigParseError": "rex-exception", "Program": "rex-type_alias", - "RawParsedSections": "rex-type_alias", - "SectionMap": "rex-type_alias", "run_program": "rex-function" }, "smithy_aws_core.config.merged_config": { @@ -309,16 +302,13 @@ "UNSET": "rex-_UnsetType", "run_program": "rex-function" }, - "smithy_aws_core.config.types": { - "RequestChecksumCalculation": "rex-type_alias", - "ResponseChecksumValidation": "rex-type_alias" - }, "smithy_aws_core.config.validators": { "ConfigSource": "rex-class", "ConfigValidationError": "rex-exception", "ProfileNotFoundError": "rex-exception", "RequestChecksumCalculation": "rex-type_alias", - "ResponseChecksumValidation": "rex-type_alias" + "ResponseChecksumValidation": "rex-type_alias", + "RetryStrategyType": "rex-type_alias" }, "smithy_aws_core.endpoints": { "AWS_RULES_EXTENSION": "rex-RulesExtension" @@ -363,7 +353,6 @@ "SmithyIdentityError": "rex-exception" }, "smithy_aws_core.identity.chain.ordering": { - "OrderingConstraint": "rex-type_alias", "shared_config_files_exist": "rex-function" }, "smithy_aws_core.identity.chain.provider": { @@ -441,7 +430,6 @@ "run_program": "rex-function" }, "smithy_aws_core.identity.components": { - "AWSCredentialsResolver": "rex-type_alias", "AwsFeatureId": "rex-class", "Identity": "rex-protocol", "IdentityResolver": "rex-protocol" @@ -639,8 +627,6 @@ "BytesReader": "rex-protocol", "ChecksumMismatch": "rex-exception", "DuplicateHeader": "rex-exception", - "HEADERS_DICT": "rex-type_alias", - "HEADER_VALUE": "rex-type_alias", "InvalidEventBytes": "rex-exception", "InvalidHeaderValue": "rex-exception", "InvalidHeaderValueLength": "rex-exception", @@ -648,7 +634,6 @@ "InvalidIntegerValue": "rex-exception", "InvalidPayloadLength": "rex-exception", "Program": "rex-type_alias", - "SizedInt": "rex-type_alias", "TimestampFormat": "rex-class", "run_program": "rex-function" }, @@ -745,7 +730,6 @@ "ProtocolSettings": "rex-class", "Request": "rex-protocol", "Response": "rex-protocol", - "StreamingBlob": "rex-type_alias", "TypedProperties": "rex-protocol", "UnsupportedStreamError": "rex-exception", "auth": "rex-module", @@ -859,7 +843,6 @@ }, "smithy_core.exceptions": { "EMPTY_RESPONSE_METADATA": "rex-ResponseMetadata", - "Fault": "rex-type_alias", "ResponseMetadata": "rex-class" }, "smithy_core.identity": { @@ -875,9 +858,6 @@ "TypedProperties": "rex-protocol" }, "smithy_core.interfaces": { - "AnyStreamingBlob": "rex-type_alias", - "ProtocolConstructor": "rex-type_alias", - "StreamingBlob": "rex-type_alias", "auth": "rex-module", "identity": "rex-module", "retries": "rex-module" @@ -905,9 +885,7 @@ "UnitTypeTrait": "rex-class" }, "smithy_core.program": { - "AsyncBodyError": "rex-exception", - "Effect": "rex-type_alias", - "Program": "rex-type_alias" + "AsyncBodyError": "rex-exception" }, "smithy_core.retries": { "PropertyKey": "rex-class", @@ -958,6 +936,7 @@ }, "smithy_http": { "AnyStreamingBlob": "rex-type_alias", + "FieldPosition": "rex-type_alias", "URI": "rex-protocol", "aio": "rex-module", "bindings": "rex-module", @@ -1230,7 +1209,6 @@ "HTTPLabelTrait": "rex-class", "HTTPPrefixHeadersTrait": "rex-class", "HTTPQueryTrait": "rex-class", - "HTTPResponseBindingDispatch": "rex-type_alias", "HTTPTrait": "rex-class", "MediaTypeTrait": "rex-class", "PathPattern": "rex-class", @@ -1335,9 +1313,6 @@ "load_model": "rex-function", "select_shapes": "rex-function" }, - "smithy_python.dependencies": { - "DependencyGroup": "rex-type_alias" - }, "smithy_python.model": { "EnumShape": "rex-class", "IntEnumShape": "rex-class", diff --git a/scripts/api-snapshot/api.json b/scripts/api-snapshot/api.json index 1b89da49d..bc36b8d4c 100644 --- a/scripts/api-snapshot/api.json +++ b/scripts/api-snapshot/api.json @@ -18,7 +18,9 @@ "aws_sdk_signers.interfaces": {}, "aws_sdk_signers.interfaces.events": { "EventHeaderEncoder": "protocol", - "EventMessage": "protocol" + "EventMessage": "protocol", + "HEADERS_DICT": "type_alias", + "HEADER_VALUE": "type_alias" }, "aws_sdk_signers.interfaces.http": { "Field": "protocol", @@ -58,7 +60,8 @@ "smithy_aws_core.aio.auth.sigv4": { "AsyncSigV4AuthScheme": "class", "AsyncSigV4Config": "protocol", - "SIGV4_CONFIG": "PropertyKey" + "SIGV4_CONFIG": "PropertyKey", + "SigV4Signer": "type_alias" }, "smithy_aws_core.aio.checksums": { "AsyncChecksumStream": "class[async]" @@ -79,7 +82,9 @@ "AsyncDefaultFileSystem": "class[async]", "AsyncFileSystem": "protocol[async]" }, - "smithy_aws_core.aio.identity": {}, + "smithy_aws_core.aio.identity": { + "AsyncAWSCredentialsResolver": "type_alias" + }, "smithy_aws_core.aio.identity.chain": { "AsyncIdentityChain": "class[async]", "logger": "Logger" @@ -156,7 +161,9 @@ }, "smithy_aws_core.config.file_parser": { "FileType": "class", + "RawParsedSections": "type_alias", "Section": "class", + "SectionMap": "type_alias", "StandardizedOutput": "class", "logger": "Logger", "parse_config_file": "function", @@ -193,7 +200,9 @@ "smithy_aws_core.config.types": { "ConfigSource": "class", "FieldSpec": "class", + "RequestChecksumCalculation": "type_alias", "Resolved": "class", + "ResponseChecksumValidation": "type_alias", "UNSET": "_UnsetType" }, "smithy_aws_core.config.validators": { @@ -221,6 +230,7 @@ "smithy_aws_core.identity.chain.ordering": { "After": "class", "Before": "class", + "OrderingConstraint": "type_alias", "Standard": "class", "StandardProvider": "class" }, @@ -250,6 +260,7 @@ }, "smithy_aws_core.identity.components": { "AWSCredentialsIdentity": "class", + "AWSCredentialsResolver": "type_alias", "AWSIdentityConfig": "protocol", "AWSIdentityProperties": "class" }, @@ -317,17 +328,20 @@ }, "smithy_aws_event_stream.events": { "Byte": "class", - "BytesLike": "UnionType", + "BytesLike": "type_alias", "Event": "class", "EventHeaderDecoder": "class", "EventHeaderEncoder": "class", "EventMessage": "class", "EventPrelude": "class", + "HEADERS_DICT": "type_alias", + "HEADER_VALUE": "type_alias", "Long": "class", "MAX_HEADERS_LENGTH": "int", "MAX_HEADER_VALUE_BYTE_LENGTH": "int", "MAX_PAYLOAD_LENGTH": "int", - "Short": "class" + "Short": "class", + "SizedInt": "type_alias" }, "smithy_aws_event_stream.exceptions": { "ChecksumMismatch": "exception", @@ -377,7 +391,8 @@ "AsyncClientTransport": "protocol[async]", "AsyncDuplexClientTransport": "protocol[async]", "AsyncEndpointResolver": "protocol[async]", - "AsyncWriter": "protocol[async]" + "AsyncWriter": "protocol[async]", + "StreamingBlob": "type_alias" }, "smithy_core.aio.interfaces.auth": { "AsyncAuthScheme": "protocol", @@ -437,6 +452,7 @@ "DiscriminatorError": "exception", "EndpointResolutionError": "exception", "ExpectationNotMetError": "exception", + "Fault": "type_alias", "MissingDependencyError": "exception", "ModeledError": "exception", "ResourceLifecycleError": "exception", @@ -463,6 +479,7 @@ "ResponseContext": "class" }, "smithy_core.interfaces": { + "AnyStreamingBlob": "type_alias", "AwaitableBytesReader": "protocol", "BytesReader": "protocol", "BytesWriter": "protocol", @@ -471,10 +488,12 @@ "Endpoint": "protocol", "EndpointResolver": "protocol", "PropertyKey": "protocol", + "ProtocolConstructor": "type_alias", "ProtocolSettings": "class", "Request": "protocol", "Response": "protocol", "SeekableBytesReader": "protocol", + "StreamingBlob": "type_alias", "TypedProperties": "protocol", "URI": "protocol", "is_bytes_reader": "function", @@ -528,6 +547,8 @@ "UNIT": "Schema" }, "smithy_core.program": { + "Effect": "type_alias", + "Program": "type_alias", "run_program": "function" }, "smithy_core.response": { @@ -786,6 +807,7 @@ "HTTPOperationSchemaMetadata": "class", "HTTPPayloadMetadata": "class", "HTTPRequestBindingMetadata": "class", + "HTTPResponseBindingDispatch": "type_alias", "HTTPResponseBindingMetadata": "class", "HTTP_BINDING_SCHEMA_EXTENSION": "SchemaExtension", "HTTP_OPERATION_SCHEMA_EXTENSION": "SchemaExtension" @@ -847,6 +869,7 @@ }, "smithy_python.dependencies": { "Dependency": "class", + "DependencyGroup": "type_alias", "DependencySet": "class", "HATCHLING": "Dependency", "PYTEST": "Dependency", diff --git a/scripts/api-snapshot/api_snapshot.py b/scripts/api-snapshot/api_snapshot.py index d4d2358eb..d0a10d603 100644 --- a/scripts/api-snapshot/api_snapshot.py +++ b/scripts/api-snapshot/api_snapshot.py @@ -112,6 +112,7 @@ def _public_module_paths(src: Path) -> list[str]: def _module_surface(modname: str) -> dict[str, str]: module = importlib.import_module(modname) defined = _defined_here(modname) + imported = _imported_from_owned(modname) surface: dict[str, str] = {} for name in dir(module): if name.startswith("_"): @@ -120,11 +121,13 @@ def _module_surface(modname: str) -> dict[str, str]: if name in defined: # Defined in this module's own source: our surface, plain kind. surface[name] = _kind(obj) - elif _is_owned(obj): + elif _is_owned(obj) or (name in imported and _is_type_alias(obj)): # Reachable here but defined in another of our packages: we own and # must track it, but mark it rex (re-export) so the defining module # and the re-export are distinguishable. surface[name] = f"rex-{_kind(obj)}" + # A PEP 604 union alias has no __module__, so it is attributed by + # the import that brought it here. # else: re-exported third-party/stdlib (Protocol, os, TYPE_CHECKING) -- # reachable, but not ours to keep stable, so excluded from the surface. return surface @@ -150,6 +153,20 @@ def _defined_here(modname: str) -> set[str]: return names +def _imported_from_owned(modname: str) -> set[str]: + """Names this module's source imports from one of our modules.""" + path = _source_path(modname) + if path is None: + return set() + names: set[str] = set() + for node in ast.parse(path.read_text()).body: + if isinstance(node, ast.ImportFrom) and ( + node.level or (node.module or "").split(".")[0] in _OWNED_ROOTS + ): + names.update(a.asname or a.name for a in node.names) + return names + + def _source_path(modname: str) -> Path | None: for src in PACKAGES_DIR.glob("*/src"): base = src.joinpath(*modname.split(".")) @@ -207,7 +224,8 @@ def _is_type_alias(obj: object) -> bool: # as type aliases, not runtime values. if isinstance(obj, typing.TypeAliasType): return True - if type(obj) is types.GenericAlias: + if type(obj) is types.GenericAlias or type(obj) is types.UnionType: + # PEP 585 builtin generics (`list[int]`) and PEP 604 unions (`A | B`). return True return getattr(obj, "__module__", None) == "typing" and hasattr(obj, "__origin__") diff --git a/scripts/verifications/lowest_bounds.py b/scripts/verifications/lowest_bounds.py index d91a41589..38ce3da52 100644 --- a/scripts/verifications/lowest_bounds.py +++ b/scripts/verifications/lowest_bounds.py @@ -40,7 +40,9 @@ def check() -> list[Finding]: targets.append(f"{package.dir}[{extras}]" if extras else str(package.dir)) with tempfile.TemporaryDirectory(prefix="lowest-bounds-") as tmp: venv = Path(tmp) / "venv" - created = run(["uv", "venv", "--quiet", "--python", "3.12", str(venv)]) + # The oldest supported Python, where Python-version-gated dependencies + # such as typing-extensions apply. + created = run(["uv", "venv", "--quiet", "--python", "3.11", str(venv)]) if created.returncode != 0: return [*findings, Finding(f"uv venv failed: {created.stderr[-500:]}")] python = str(venv / "bin" / "python") diff --git a/uv.lock b/uv.lock index 9ddbfc4fb..d64942ebf 100644 --- a/uv.lock +++ b/uv.lock @@ -1,6 +1,6 @@ version = 1 revision = 5 -requires-python = ">=3.12" +requires-python = ">=3.11" [manifest] members = [ @@ -43,6 +43,24 @@ dependencies = [ ] sdist = { url = "https://files.pythonhosted.org/packages/93/2f/6a91adaa2dc26877d6ed2f54c0370c8910f019db7d77c5c6a194611e93ea/aiohttp-3.14.4.tar.gz", hash = "sha256:831fc5bd39ec2517851e348f613ddb5447a47cf4b71cb09845af7ad7ed45d8f9", size = 8077839, upload-time = "2026-10-05T17:43:48.309Z" } wheels = [ + { url = "https://files.pythonhosted.org/packages/81/e3/998dc75634ecd2a24f33bab480b57313059d55bcadff8825a46b7c80a8af/aiohttp-3.14.4-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:eb0093ca0817019d539f0d27bdf98e823944e05bb7efd9d2337a45b92e4d1b06", size = 832892, upload-time = "2026-10-05T17:38:16.373Z" }, + { url = "https://files.pythonhosted.org/packages/58/c9/9bacc26397854440d169f70ae00ea51721f504611d3a64cf043643792c32/aiohttp-3.14.4-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:f482dc9c8309801b4259dd218609d3dae0a7bcdedeac56d90500eabaa0c23465", size = 559893, upload-time = "2026-10-05T17:38:18.74Z" }, + { url = "https://files.pythonhosted.org/packages/fa/f3/90c5856014328a8b1e9a753de794edea282182b776ff65f0602ad4ffa520/aiohttp-3.14.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:aa800bb7c1d00e166493931f2ddacb982db913292503dc2f4884db1f2bc5f105", size = 552850, upload-time = "2026-10-05T17:38:20.385Z" }, + { url = "https://files.pythonhosted.org/packages/9b/88/e71c29ce6daa78fcee0feb1992f0fdc408f09f42c3311b1f1c68c36f16ea/aiohttp-3.14.4-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d90e4dae71b26597f6d1fd12af7d092ae67551edf0e524b73e0687214b79ee33", size = 1928941, upload-time = "2026-10-05T17:38:22.218Z" }, + { url = "https://files.pythonhosted.org/packages/3a/4f/f0f3bebfa521a2ce5fd4302c937701cbc50cd6d908beaa597388639b0b98/aiohttp-3.14.4-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:5b681054b8c3b86aa6a0384b6ad7f5cb78dccbabab1f4a3a6793f98ad1378959", size = 1882092, upload-time = "2026-10-05T17:38:24.016Z" }, + { url = "https://files.pythonhosted.org/packages/b5/0d/5df041fd25dceb4f4cafbbee49bb2c1e2d54a91aedecaf03b77cbb404c44/aiohttp-3.14.4-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:6dfe80b41bcf8d80d2125fb99a171adeb86db2fcb35c1a68e0226acba0ba7f03", size = 1986051, upload-time = "2026-10-05T17:38:26.022Z" }, + { url = "https://files.pythonhosted.org/packages/1a/07/e95eddafffef7c3a74446f67ac4e477a49cec2c78f2ab6c86d1acfd90d2d/aiohttp-3.14.4-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:71e4a59c6a8c5a6ae8b0b696c32635913e8f526cc01448762eaf5a3c59df8a4f", size = 2107840, upload-time = "2026-10-05T17:38:28.112Z" }, + { url = "https://files.pythonhosted.org/packages/da/6c/1f83990fea249dcb10f48086726953546efc9199c96b6be7114532ac361f/aiohttp-3.14.4-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:f887c3b7fb3058fc1ccd917f52078540c18d938d12018cb9edd64b6811d20c57", size = 1930721, upload-time = "2026-10-05T17:38:30.046Z" }, + { url = "https://files.pythonhosted.org/packages/6f/d1/48184a186ea26df4f81dd466144dcab7f9cdd1e131bfee0f0e41278c6f0d/aiohttp-3.14.4-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:0da4525e9ba145a11617d2cd7e44fe1acaf471f9c72a0cad28e72879c1020fbb", size = 1774508, upload-time = "2026-10-05T17:38:31.8Z" }, + { url = "https://files.pythonhosted.org/packages/0f/ef/a9ec758c6d3850453838c31b56d1e4499eb47c80883753a12dcb203f9afa/aiohttp-3.14.4-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:f7e8d3c5caa44fdbee3eba1aa1417aa58c74c95d4089fe3c451911117fcbb2f3", size = 1902311, upload-time = "2026-10-05T17:38:33.791Z" }, + { url = "https://files.pythonhosted.org/packages/d6/49/9a2be54900f2dea6e63bbf9628fced604686a2e301130ccde0b1aa2e7e53/aiohttp-3.14.4-cp311-cp311-musllinux_1_2_armv7l.whl", hash = "sha256:09092cf906c18c824b6b16881da5a89cc9cfa9b15344e496bcf880e9045bee33", size = 1912107, upload-time = "2026-10-05T17:38:35.614Z" }, + { url = "https://files.pythonhosted.org/packages/a2/2b/151254abfc0fe5cbb8e6c41ad04d52122db0af176fb31dbf3bc44e081bda/aiohttp-3.14.4-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:dfd144837e92264878bba6d3a7ffa8206668b21e87748740afd45d193e48c87e", size = 1960207, upload-time = "2026-10-05T17:38:37.322Z" }, + { url = "https://files.pythonhosted.org/packages/23/99/92c8dce336ac5784755a3144623528516f2e3b6b4871d02cad5a0642ae66/aiohttp-3.14.4-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:9413cffe4e0d654b9b524f9c99dde8cbdb37e0ed9a2c4edd2e63adbac6b374e8", size = 1760168, upload-time = "2026-10-05T17:38:39.214Z" }, + { url = "https://files.pythonhosted.org/packages/66/3e/f05fd8d1a9595730db8d522882eea76429b9be2ed5337609f7c6e3d9d49c/aiohttp-3.14.4-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:f50d719f97ba488dfb8e306cf8c8cc172ff0683ec0af53917b288229aa555ba5", size = 1979946, upload-time = "2026-10-05T17:38:40.927Z" }, + { url = "https://files.pythonhosted.org/packages/b9/14/8941aa73ffceabc2a0eb26878b4f1b2958fb7b5358f97cc49b1c00ed9258/aiohttp-3.14.4-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:68ed4824d96b7afec1f3a8d7fba190fe282718041c5772e20298003e1e3e5d66", size = 1923375, upload-time = "2026-10-05T17:38:43.184Z" }, + { url = "https://files.pythonhosted.org/packages/18/b5/ef275b63c8bfe0a21e7e8d3ef0e67c4745ed403f1894fe5205057cedd3b9/aiohttp-3.14.4-cp311-cp311-win32.whl", hash = "sha256:d7a41d1427136828e6b11d3f3fd194d4357d5205a5b610be7ae07b1ba52ab974", size = 488414, upload-time = "2026-10-05T17:38:44.978Z" }, + { url = "https://files.pythonhosted.org/packages/e7/0b/21bdd70a1e072222d9dbd96bed4fbed26f7c46c5a20af11b78d32fd049d6/aiohttp-3.14.4-cp311-cp311-win_amd64.whl", hash = "sha256:2efbdb87e79d596325c4eefaef0f4495d701145e882351310ebc538e854dc7a3", size = 512755, upload-time = "2026-10-05T17:38:47.036Z" }, + { url = "https://files.pythonhosted.org/packages/b7/4c/bb324a7d20a9598187bb028ca8d6bcf66c63589c8632420919dd576964ed/aiohttp-3.14.4-cp311-cp311-win_arm64.whl", hash = "sha256:ac6e6f90d9360e460c873f945f11dc8698db0a71fec6612823f1aaaab2c11faa", size = 492960, upload-time = "2026-10-05T17:38:49.006Z" }, { url = "https://files.pythonhosted.org/packages/22/02/db5935d45347fa8ede56b777930740fb0e72bbb4473ddb6ff8541f6f2afa/aiohttp-3.14.4-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:55b0b335982b0db7117dff7f6a8e3aad43c4105f9e392ca04f9fc8d958a95cce", size = 817689, upload-time = "2026-10-05T17:38:50.69Z" }, { url = "https://files.pythonhosted.org/packages/e6/56/f00aa46127e6342f019d567853eeeb932e04fb9b9424b5fb981ad68f4178/aiohttp-3.14.4-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:2d0d8e435582b0d53009dac99e26a3d2be932ed7c9dbfcfc70f3fce1cf943bd5", size = 549599, upload-time = "2026-10-05T17:38:52.525Z" }, { url = "https://files.pythonhosted.org/packages/3f/bc/825c09b09962253a2103e4a88c04374ee939c0c8ea31c270daa0308efb07/aiohttp-3.14.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:bf734016932d68e1324cfb638cac7a0866a83933a33badf15e836a7e24efb8c0", size = 548132, upload-time = "2026-10-05T17:38:54.629Z" }, @@ -194,6 +212,12 @@ wheels = [ [[package]] name = "aws-sdk-signers" source = { editable = "packages/aws-sdk-signers" } +dependencies = [ + { name = "typing-extensions", marker = "python_full_version < '3.12'" }, +] + +[package.metadata] +requires-dist = [{ name = "typing-extensions", marker = "python_full_version < '3.12'", specifier = ">=4.14.0" }] [[package]] name = "awscrt" @@ -244,6 +268,19 @@ version = "7.12.0" source = { registry = "https://pypi.org/simple" } sdist = { url = "https://files.pythonhosted.org/packages/89/26/4a96807b193b011588099c3b5c89fbb05294e5b90e71018e065465f34eb6/coverage-7.12.0.tar.gz", hash = "sha256:fc11e0a4e372cb5f282f16ef90d4a585034050ccda536451901abfb19a57f40c", size = 819341, upload-time = "2025-11-18T13:34:20.766Z" } wheels = [ + { url = "https://files.pythonhosted.org/packages/5a/0c/0dfe7f0487477d96432e4815537263363fb6dd7289743a796e8e51eabdf2/coverage-7.12.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:aa124a3683d2af98bd9d9c2bfa7a5076ca7e5ab09fdb96b81fa7d89376ae928f", size = 217535, upload-time = "2025-11-18T13:32:08.812Z" }, + { url = "https://files.pythonhosted.org/packages/9b/f5/f9a4a053a5bbff023d3bec259faac8f11a1e5a6479c2ccf586f910d8dac7/coverage-7.12.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:d93fbf446c31c0140208dcd07c5d882029832e8ed7891a39d6d44bd65f2316c3", size = 218044, upload-time = "2025-11-18T13:32:10.329Z" }, + { url = "https://files.pythonhosted.org/packages/95/c5/84fc3697c1fa10cd8571919bf9693f693b7373278daaf3b73e328d502bc8/coverage-7.12.0-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:52ca620260bd8cd6027317bdd8b8ba929be1d741764ee765b42c4d79a408601e", size = 248440, upload-time = "2025-11-18T13:32:12.536Z" }, + { url = "https://files.pythonhosted.org/packages/f4/36/2d93fbf6a04670f3874aed397d5a5371948a076e3249244a9e84fb0e02d6/coverage-7.12.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:f3433ffd541380f3a0e423cff0f4926d55b0cc8c1d160fdc3be24a4c03aa65f7", size = 250361, upload-time = "2025-11-18T13:32:13.852Z" }, + { url = "https://files.pythonhosted.org/packages/5d/49/66dc65cc456a6bfc41ea3d0758c4afeaa4068a2b2931bf83be6894cf1058/coverage-7.12.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f7bbb321d4adc9f65e402c677cd1c8e4c2d0105d3ce285b51b4d87f1d5db5245", size = 252472, upload-time = "2025-11-18T13:32:15.068Z" }, + { url = "https://files.pythonhosted.org/packages/35/1f/ebb8a18dffd406db9fcd4b3ae42254aedcaf612470e8712f12041325930f/coverage-7.12.0-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:22a7aade354a72dff3b59c577bfd18d6945c61f97393bc5fb7bd293a4237024b", size = 248592, upload-time = "2025-11-18T13:32:16.328Z" }, + { url = "https://files.pythonhosted.org/packages/da/a8/67f213c06e5ea3b3d4980df7dc344d7fea88240b5fe878a5dcbdfe0e2315/coverage-7.12.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:3ff651dcd36d2fea66877cd4a82de478004c59b849945446acb5baf9379a1b64", size = 250167, upload-time = "2025-11-18T13:32:17.687Z" }, + { url = "https://files.pythonhosted.org/packages/f0/00/e52aef68154164ea40cc8389c120c314c747fe63a04b013a5782e989b77f/coverage-7.12.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:31b8b2e38391a56e3cea39d22a23faaa7c3fc911751756ef6d2621d2a9daf742", size = 248238, upload-time = "2025-11-18T13:32:19.2Z" }, + { url = "https://files.pythonhosted.org/packages/1f/a4/4d88750bcf9d6d66f77865e5a05a20e14db44074c25fd22519777cb69025/coverage-7.12.0-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:297bc2da28440f5ae51c845a47c8175a4db0553a53827886e4fb25c66633000c", size = 247964, upload-time = "2025-11-18T13:32:21.027Z" }, + { url = "https://files.pythonhosted.org/packages/a7/6b/b74693158899d5b47b0bf6238d2c6722e20ba749f86b74454fac0696bb00/coverage-7.12.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:6ff7651cc01a246908eac162a6a86fc0dbab6de1ad165dfb9a1e2ec660b44984", size = 248862, upload-time = "2025-11-18T13:32:22.304Z" }, + { url = "https://files.pythonhosted.org/packages/18/de/6af6730227ce0e8ade307b1cc4a08e7f51b419a78d02083a86c04ccceb29/coverage-7.12.0-cp311-cp311-win32.whl", hash = "sha256:313672140638b6ddb2c6455ddeda41c6a0b208298034544cfca138978c6baed6", size = 220033, upload-time = "2025-11-18T13:32:23.714Z" }, + { url = "https://files.pythonhosted.org/packages/e2/a1/e7f63021a7c4fe20994359fcdeae43cbef4a4d0ca36a5a1639feeea5d9e1/coverage-7.12.0-cp311-cp311-win_amd64.whl", hash = "sha256:a1783ed5bd0d5938d4435014626568dc7f93e3cb99bc59188cc18857c47aa3c4", size = 220966, upload-time = "2025-11-18T13:32:25.599Z" }, + { url = "https://files.pythonhosted.org/packages/77/e8/deae26453f37c20c3aa0c4433a1e32cdc169bf415cce223a693117aa3ddd/coverage-7.12.0-cp311-cp311-win_arm64.whl", hash = "sha256:4648158fd8dd9381b5847622df1c90ff314efbfc1df4550092ab6013c238a5fc", size = 219637, upload-time = "2025-11-18T13:32:27.265Z" }, { url = "https://files.pythonhosted.org/packages/02/bf/638c0427c0f0d47638242e2438127f3c8ee3cfc06c7fdeb16778ed47f836/coverage-7.12.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:29644c928772c78512b48e14156b81255000dcfd4817574ff69def189bcb3647", size = 217704, upload-time = "2025-11-18T13:32:28.906Z" }, { url = "https://files.pythonhosted.org/packages/08/e1/706fae6692a66c2d6b871a608bbde0da6281903fa0e9f53a39ed441da36a/coverage-7.12.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:8638cbb002eaa5d7c8d04da667813ce1067080b9a91099801a0053086e52b736", size = 218064, upload-time = "2025-11-18T13:32:30.161Z" }, { url = "https://files.pythonhosted.org/packages/a9/8b/eb0231d0540f8af3ffda39720ff43cb91926489d01524e68f60e961366e4/coverage-7.12.0-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:083631eeff5eb9992c923e14b810a179798bb598e6a0dd60586819fc23be6e60", size = 249560, upload-time = "2025-11-18T13:32:31.835Z" }, @@ -312,6 +349,11 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/ce/a3/43b749004e3c09452e39bb56347a008f0a0668aad37324a99b5c8ca91d9e/coverage-7.12.0-py3-none-any.whl", hash = "sha256:159d50c0b12e060b15ed3d39f87ed43d4f7f7ad40b8a534f4dd331adbb51104a", size = 209503, upload-time = "2025-11-18T13:34:18.892Z" }, ] +[package.optional-dependencies] +toml = [ + { name = "tomli", marker = "python_full_version <= '3.11'" }, +] + [[package]] name = "freezegun" version = "1.5.5" @@ -330,6 +372,23 @@ version = "1.6.0" source = { registry = "https://pypi.org/simple" } sdist = { url = "https://files.pythonhosted.org/packages/ee/f4/d744cba2da59b5c1d88823cf9e8a6c74e4659e2b27604ed973be2a0bf5ab/frozenlist-1.6.0.tar.gz", hash = "sha256:b99655c32c1c8e06d111e7f41c06c29a5318cb1835df23a45518e02a47c63b68", size = 42831, upload-time = "2025-04-17T22:38:53.099Z" } wheels = [ + { url = "https://files.pythonhosted.org/packages/53/b5/bc883b5296ec902115c00be161da93bf661199c465ec4c483feec6ea4c32/frozenlist-1.6.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:ae8337990e7a45683548ffb2fee1af2f1ed08169284cd829cdd9a7fa7470530d", size = 160912, upload-time = "2025-04-17T22:36:17.235Z" }, + { url = "https://files.pythonhosted.org/packages/6f/93/51b058b563d0704b39c56baa222828043aafcac17fd3734bec5dbeb619b1/frozenlist-1.6.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:8c952f69dd524558694818a461855f35d36cc7f5c0adddce37e962c85d06eac0", size = 124315, upload-time = "2025-04-17T22:36:18.735Z" }, + { url = "https://files.pythonhosted.org/packages/c9/e0/46cd35219428d350558b874d595e132d1c17a9471a1bd0d01d518a261e7c/frozenlist-1.6.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:8f5fef13136c4e2dee91bfb9a44e236fff78fc2cd9f838eddfc470c3d7d90afe", size = 122230, upload-time = "2025-04-17T22:36:20.6Z" }, + { url = "https://files.pythonhosted.org/packages/d1/0f/7ad2ce928ad06d6dd26a61812b959ded573d3e9d0ee6109d96c2be7172e9/frozenlist-1.6.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:716bbba09611b4663ecbb7cd022f640759af8259e12a6ca939c0a6acd49eedba", size = 314842, upload-time = "2025-04-17T22:36:22.088Z" }, + { url = "https://files.pythonhosted.org/packages/34/76/98cbbd8a20a5c3359a2004ae5e5b216af84a150ccbad67c8f8f30fb2ea91/frozenlist-1.6.0-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:7b8c4dc422c1a3ffc550b465090e53b0bf4839047f3e436a34172ac67c45d595", size = 304919, upload-time = "2025-04-17T22:36:24.247Z" }, + { url = "https://files.pythonhosted.org/packages/9a/fa/258e771ce3a44348c05e6b01dffc2bc67603fba95761458c238cd09a2c77/frozenlist-1.6.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b11534872256e1666116f6587a1592ef395a98b54476addb5e8d352925cb5d4a", size = 324074, upload-time = "2025-04-17T22:36:26.291Z" }, + { url = "https://files.pythonhosted.org/packages/d5/a4/047d861fd8c538210e12b208c0479912273f991356b6bdee7ea8356b07c9/frozenlist-1.6.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1c6eceb88aaf7221f75be6ab498dc622a151f5f88d536661af3ffc486245a626", size = 321292, upload-time = "2025-04-17T22:36:27.909Z" }, + { url = "https://files.pythonhosted.org/packages/c0/25/cfec8af758b4525676cabd36efcaf7102c1348a776c0d1ad046b8a7cdc65/frozenlist-1.6.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:62c828a5b195570eb4b37369fcbbd58e96c905768d53a44d13044355647838ff", size = 301569, upload-time = "2025-04-17T22:36:29.448Z" }, + { url = "https://files.pythonhosted.org/packages/87/2f/0c819372fa9f0c07b153124bf58683b8d0ca7bb73ea5ccde9b9ef1745beb/frozenlist-1.6.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e1c6bd2c6399920c9622362ce95a7d74e7f9af9bfec05fff91b8ce4b9647845a", size = 313625, upload-time = "2025-04-17T22:36:31.55Z" }, + { url = "https://files.pythonhosted.org/packages/50/5f/f0cf8b0fdedffdb76b3745aa13d5dbe404d63493cc211ce8250f2025307f/frozenlist-1.6.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:49ba23817781e22fcbd45fd9ff2b9b8cdb7b16a42a4851ab8025cae7b22e96d0", size = 312523, upload-time = "2025-04-17T22:36:33.078Z" }, + { url = "https://files.pythonhosted.org/packages/e1/6c/38c49108491272d3e84125bbabf2c2d0b304899b52f49f0539deb26ad18d/frozenlist-1.6.0-cp311-cp311-musllinux_1_2_armv7l.whl", hash = "sha256:431ef6937ae0f853143e2ca67d6da76c083e8b1fe3df0e96f3802fd37626e606", size = 322657, upload-time = "2025-04-17T22:36:34.688Z" }, + { url = "https://files.pythonhosted.org/packages/bd/4b/3bd3bad5be06a9d1b04b1c22be80b5fe65b502992d62fab4bdb25d9366ee/frozenlist-1.6.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:9d124b38b3c299ca68433597ee26b7819209cb8a3a9ea761dfe9db3a04bba584", size = 303414, upload-time = "2025-04-17T22:36:36.363Z" }, + { url = "https://files.pythonhosted.org/packages/5b/89/7e225a30bef6e85dbfe22622c24afe932e9444de3b40d58b1ea589a14ef8/frozenlist-1.6.0-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:118e97556306402e2b010da1ef21ea70cb6d6122e580da64c056b96f524fbd6a", size = 320321, upload-time = "2025-04-17T22:36:38.16Z" }, + { url = "https://files.pythonhosted.org/packages/22/72/7e3acef4dd9e86366cb8f4d8f28e852c2b7e116927e9722b31a6f71ea4b0/frozenlist-1.6.0-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:fb3b309f1d4086b5533cf7bbcf3f956f0ae6469664522f1bde4feed26fba60f1", size = 323975, upload-time = "2025-04-17T22:36:40.289Z" }, + { url = "https://files.pythonhosted.org/packages/d8/85/e5da03d20507e13c66ce612c9792b76811b7a43e3320cce42d95b85ac755/frozenlist-1.6.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:54dece0d21dce4fdb188a1ffc555926adf1d1c516e493c2914d7c370e454bc9e", size = 316553, upload-time = "2025-04-17T22:36:42.045Z" }, + { url = "https://files.pythonhosted.org/packages/ac/8e/6c609cbd0580ae8a0661c408149f196aade7d325b1ae7adc930501b81acb/frozenlist-1.6.0-cp311-cp311-win32.whl", hash = "sha256:654e4ba1d0b2154ca2f096bed27461cf6160bc7f504a7f9a9ef447c293caf860", size = 115511, upload-time = "2025-04-17T22:36:44.067Z" }, + { url = "https://files.pythonhosted.org/packages/f2/13/a84804cfde6de12d44ed48ecbf777ba62b12ff09e761f76cdd1ff9e14bb1/frozenlist-1.6.0-cp311-cp311-win_amd64.whl", hash = "sha256:3e911391bffdb806001002c1f860787542f45916c3baf764264a52765d5a5603", size = 120863, upload-time = "2025-04-17T22:36:45.465Z" }, { url = "https://files.pythonhosted.org/packages/9c/8a/289b7d0de2fbac832ea80944d809759976f661557a38bb8e77db5d9f79b7/frozenlist-1.6.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:c5b9e42ace7d95bf41e19b87cec8f262c41d3510d8ad7514ab3862ea2197bfb1", size = 160193, upload-time = "2025-04-17T22:36:47.382Z" }, { url = "https://files.pythonhosted.org/packages/19/80/2fd17d322aec7f430549f0669f599997174f93ee17929ea5b92781ec902c/frozenlist-1.6.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:ca9973735ce9f770d24d5484dcb42f68f135351c2fc81a7a9369e48cf2998a29", size = 123831, upload-time = "2025-04-17T22:36:49.401Z" }, { url = "https://files.pythonhosted.org/packages/99/06/f5812da431273f78c6543e0b2f7de67dfd65eb0a433978b2c9c63d2205e4/frozenlist-1.6.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:6ac40ec76041c67b928ca8aaffba15c2b2ee3f5ae8d0cb0617b5e63ec119ca25", size = 121862, upload-time = "2025-04-17T22:36:51.899Z" }, @@ -420,6 +479,16 @@ version = "3.0.2" source = { registry = "https://pypi.org/simple" } sdist = { url = "https://files.pythonhosted.org/packages/b2/97/5d42485e71dfc078108a86d6de8fa46db44a1a9295e89c5d6d4a06e23a62/markupsafe-3.0.2.tar.gz", hash = "sha256:ee55d3edf80167e48ea11a923c7386f4669df67d7994554387f84e7d8b0a2bf0", size = 20537, upload-time = "2024-10-18T15:21:54.129Z" } wheels = [ + { url = "https://files.pythonhosted.org/packages/6b/28/bbf83e3f76936960b850435576dd5e67034e200469571be53f69174a2dfd/MarkupSafe-3.0.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:9025b4018f3a1314059769c7bf15441064b2207cb3f065e6ea1e7359cb46db9d", size = 14353, upload-time = "2024-10-18T15:21:02.187Z" }, + { url = "https://files.pythonhosted.org/packages/6c/30/316d194b093cde57d448a4c3209f22e3046c5bb2fb0820b118292b334be7/MarkupSafe-3.0.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:93335ca3812df2f366e80509ae119189886b0f3c2b81325d39efdb84a1e2ae93", size = 12392, upload-time = "2024-10-18T15:21:02.941Z" }, + { url = "https://files.pythonhosted.org/packages/f2/96/9cdafba8445d3a53cae530aaf83c38ec64c4d5427d975c974084af5bc5d2/MarkupSafe-3.0.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2cb8438c3cbb25e220c2ab33bb226559e7afb3baec11c4f218ffa7308603c832", size = 23984, upload-time = "2024-10-18T15:21:03.953Z" }, + { url = "https://files.pythonhosted.org/packages/f1/a4/aefb044a2cd8d7334c8a47d3fb2c9f328ac48cb349468cc31c20b539305f/MarkupSafe-3.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a123e330ef0853c6e822384873bef7507557d8e4a082961e1defa947aa59ba84", size = 23120, upload-time = "2024-10-18T15:21:06.495Z" }, + { url = "https://files.pythonhosted.org/packages/8d/21/5e4851379f88f3fad1de30361db501300d4f07bcad047d3cb0449fc51f8c/MarkupSafe-3.0.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1e084f686b92e5b83186b07e8a17fc09e38fff551f3602b249881fec658d3eca", size = 23032, upload-time = "2024-10-18T15:21:07.295Z" }, + { url = "https://files.pythonhosted.org/packages/00/7b/e92c64e079b2d0d7ddf69899c98842f3f9a60a1ae72657c89ce2655c999d/MarkupSafe-3.0.2-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:d8213e09c917a951de9d09ecee036d5c7d36cb6cb7dbaece4c71a60d79fb9798", size = 24057, upload-time = "2024-10-18T15:21:08.073Z" }, + { url = "https://files.pythonhosted.org/packages/f9/ac/46f960ca323037caa0a10662ef97d0a4728e890334fc156b9f9e52bcc4ca/MarkupSafe-3.0.2-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:5b02fb34468b6aaa40dfc198d813a641e3a63b98c2b05a16b9f80b7ec314185e", size = 23359, upload-time = "2024-10-18T15:21:09.318Z" }, + { url = "https://files.pythonhosted.org/packages/69/84/83439e16197337b8b14b6a5b9c2105fff81d42c2a7c5b58ac7b62ee2c3b1/MarkupSafe-3.0.2-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:0bff5e0ae4ef2e1ae4fdf2dfd5b76c75e5c2fa4132d05fc1b0dabcd20c7e28c4", size = 23306, upload-time = "2024-10-18T15:21:10.185Z" }, + { url = "https://files.pythonhosted.org/packages/9a/34/a15aa69f01e2181ed8d2b685c0d2f6655d5cca2c4db0ddea775e631918cd/MarkupSafe-3.0.2-cp311-cp311-win32.whl", hash = "sha256:6c89876f41da747c8d3677a2b540fb32ef5715f97b66eeb0c6b66f5e3ef6f59d", size = 15094, upload-time = "2024-10-18T15:21:11.005Z" }, + { url = "https://files.pythonhosted.org/packages/da/b8/3a3bd761922d416f3dc5d00bfbed11f66b1ab89a0c2b6e887240a30b0f6b/MarkupSafe-3.0.2-cp311-cp311-win_amd64.whl", hash = "sha256:70a87b411535ccad5ef2f1df5136506a10775d267e197e4cf531ced10537bd6b", size = 15521, upload-time = "2024-10-18T15:21:12.911Z" }, { url = "https://files.pythonhosted.org/packages/22/09/d1f21434c97fc42f09d290cbb6350d44eb12f09cc62c9476effdb33a18aa/MarkupSafe-3.0.2-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:9778bd8ab0a994ebf6f84c2b949e65736d5575320a17ae8984a77fab08db94cf", size = 14274, upload-time = "2024-10-18T15:21:13.777Z" }, { url = "https://files.pythonhosted.org/packages/6b/b0/18f76bba336fa5aecf79d45dcd6c806c280ec44538b3c13671d49099fdd0/MarkupSafe-3.0.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:846ade7b71e3536c4e56b386c2a47adf5741d2d8b94ec9dc3e92e5e1ee1e2225", size = 12348, upload-time = "2024-10-18T15:21:14.822Z" }, { url = "https://files.pythonhosted.org/packages/e0/25/dd5c0f6ac1311e9b40f4af06c78efde0f3b5cbf02502f8ef9501294c425b/MarkupSafe-3.0.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1c99d261bd2d5f6b59325c92c73df481e05e57f19837bdca8413b9eac4bd8028", size = 24149, upload-time = "2024-10-18T15:21:15.642Z" }, @@ -458,6 +527,23 @@ version = "6.4.3" source = { registry = "https://pypi.org/simple" } sdist = { url = "https://files.pythonhosted.org/packages/da/2c/e367dfb4c6538614a0c9453e510d75d66099edf1c4e69da1b5ce691a1931/multidict-6.4.3.tar.gz", hash = "sha256:3ada0b058c9f213c5f95ba301f922d402ac234f1111a7d8fd70f1b99f3c281ec", size = 89372, upload-time = "2025-04-10T22:20:17.956Z" } wheels = [ + { url = "https://files.pythonhosted.org/packages/16/e0/53cf7f27eda48fffa53cfd4502329ed29e00efb9e4ce41362cbf8aa54310/multidict-6.4.3-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:f6f19170197cc29baccd33ccc5b5d6a331058796485857cf34f7635aa25fb0cd", size = 65259, upload-time = "2025-04-10T22:17:59.632Z" }, + { url = "https://files.pythonhosted.org/packages/44/79/1dcd93ce7070cf01c2ee29f781c42b33c64fce20033808f1cc9ec8413d6e/multidict-6.4.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:f2882bf27037eb687e49591690e5d491e677272964f9ec7bc2abbe09108bdfb8", size = 38451, upload-time = "2025-04-10T22:18:01.202Z" }, + { url = "https://files.pythonhosted.org/packages/f4/35/2292cf29ab5f0d0b3613fad1b75692148959d3834d806be1885ceb49a8ff/multidict-6.4.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:fbf226ac85f7d6b6b9ba77db4ec0704fde88463dc17717aec78ec3c8546c70ad", size = 37706, upload-time = "2025-04-10T22:18:02.276Z" }, + { url = "https://files.pythonhosted.org/packages/f6/d1/6b157110b2b187b5a608b37714acb15ee89ec773e3800315b0107ea648cd/multidict-6.4.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2e329114f82ad4b9dd291bef614ea8971ec119ecd0f54795109976de75c9a852", size = 226669, upload-time = "2025-04-10T22:18:03.436Z" }, + { url = "https://files.pythonhosted.org/packages/40/7f/61a476450651f177c5570e04bd55947f693077ba7804fe9717ee9ae8de04/multidict-6.4.3-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:1f4e0334d7a555c63f5c8952c57ab6f1c7b4f8c7f3442df689fc9f03df315c08", size = 223182, upload-time = "2025-04-10T22:18:04.922Z" }, + { url = "https://files.pythonhosted.org/packages/51/7b/eaf7502ac4824cdd8edcf5723e2e99f390c879866aec7b0c420267b53749/multidict-6.4.3-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:740915eb776617b57142ce0bb13b7596933496e2f798d3d15a20614adf30d229", size = 235025, upload-time = "2025-04-10T22:18:06.274Z" }, + { url = "https://files.pythonhosted.org/packages/3b/f6/facdbbd73c96b67a93652774edd5778ab1167854fa08ea35ad004b1b70ad/multidict-6.4.3-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:255dac25134d2b141c944b59a0d2f7211ca12a6d4779f7586a98b4b03ea80508", size = 231481, upload-time = "2025-04-10T22:18:07.742Z" }, + { url = "https://files.pythonhosted.org/packages/70/57/c008e861b3052405eebf921fd56a748322d8c44dcfcab164fffbccbdcdc4/multidict-6.4.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d4e8535bd4d741039b5aad4285ecd9b902ef9e224711f0b6afda6e38d7ac02c7", size = 223492, upload-time = "2025-04-10T22:18:09.095Z" }, + { url = "https://files.pythonhosted.org/packages/30/4d/7d8440d3a12a6ae5d6b202d6e7f2ac6ab026e04e99aaf1b73f18e6bc34bc/multidict-6.4.3-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:30c433a33be000dd968f5750722eaa0991037be0be4a9d453eba121774985bc8", size = 217279, upload-time = "2025-04-10T22:18:10.474Z" }, + { url = "https://files.pythonhosted.org/packages/7f/e7/bca0df4dd057597b94138d2d8af04eb3c27396a425b1b0a52e082f9be621/multidict-6.4.3-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:4eb33b0bdc50acd538f45041f5f19945a1f32b909b76d7b117c0c25d8063df56", size = 228733, upload-time = "2025-04-10T22:18:11.793Z" }, + { url = "https://files.pythonhosted.org/packages/88/f5/383827c3f1c38d7c92dbad00a8a041760228573b1c542fbf245c37bbca8a/multidict-6.4.3-cp311-cp311-musllinux_1_2_armv7l.whl", hash = "sha256:75482f43465edefd8a5d72724887ccdcd0c83778ded8f0cb1e0594bf71736cc0", size = 218089, upload-time = "2025-04-10T22:18:13.153Z" }, + { url = "https://files.pythonhosted.org/packages/36/8a/a5174e8a7d8b94b4c8f9c1e2cf5d07451f41368ffe94d05fc957215b8e72/multidict-6.4.3-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:ce5b3082e86aee80b3925ab4928198450d8e5b6466e11501fe03ad2191c6d777", size = 225257, upload-time = "2025-04-10T22:18:14.654Z" }, + { url = "https://files.pythonhosted.org/packages/8c/76/1d4b7218f0fd00b8e5c90b88df2e45f8af127f652f4e41add947fa54c1c4/multidict-6.4.3-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:e413152e3212c4d39f82cf83c6f91be44bec9ddea950ce17af87fbf4e32ca6b2", size = 234728, upload-time = "2025-04-10T22:18:16.236Z" }, + { url = "https://files.pythonhosted.org/packages/64/44/18372a4f6273fc7ca25630d7bf9ae288cde64f29593a078bff450c7170b6/multidict-6.4.3-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:8aac2eeff69b71f229a405c0a4b61b54bade8e10163bc7b44fcd257949620618", size = 230087, upload-time = "2025-04-10T22:18:17.979Z" }, + { url = "https://files.pythonhosted.org/packages/0f/ae/28728c314a698d8a6d9491fcacc897077348ec28dd85884d09e64df8a855/multidict-6.4.3-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:ab583ac203af1d09034be41458feeab7863c0635c650a16f15771e1386abf2d7", size = 223137, upload-time = "2025-04-10T22:18:19.362Z" }, + { url = "https://files.pythonhosted.org/packages/22/50/785bb2b3fe16051bc91c70a06a919f26312da45c34db97fc87441d61e343/multidict-6.4.3-cp311-cp311-win32.whl", hash = "sha256:1b2019317726f41e81154df636a897de1bfe9228c3724a433894e44cd2512378", size = 34959, upload-time = "2025-04-10T22:18:20.728Z" }, + { url = "https://files.pythonhosted.org/packages/2f/63/2a22e099ae2f4d92897618c00c73a09a08a2a9aa14b12736965bf8d59fd3/multidict-6.4.3-cp311-cp311-win_amd64.whl", hash = "sha256:43173924fa93c7486402217fab99b60baf78d33806af299c56133a3755f69589", size = 38541, upload-time = "2025-04-10T22:18:22.001Z" }, { url = "https://files.pythonhosted.org/packages/fc/bb/3abdaf8fe40e9226ce8a2ba5ecf332461f7beec478a455d6587159f1bf92/multidict-6.4.3-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:1f1c2f58f08b36f8475f3ec6f5aeb95270921d418bf18f90dffd6be5c7b0e676", size = 64019, upload-time = "2025-04-10T22:18:23.174Z" }, { url = "https://files.pythonhosted.org/packages/7e/b5/1b2e8de8217d2e89db156625aa0fe4a6faad98972bfe07a7b8c10ef5dd6b/multidict-6.4.3-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:26ae9ad364fc61b936fb7bf4c9d8bd53f3a5b4417142cd0be5c509d6f767e2f1", size = 37925, upload-time = "2025-04-10T22:18:24.834Z" }, { url = "https://files.pythonhosted.org/packages/b4/e2/3ca91c112644a395c8eae017144c907d173ea910c913ff8b62549dcf0bbf/multidict-6.4.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:659318c6c8a85f6ecfc06b4e57529e5a78dfdd697260cc81f683492ad7e9435a", size = 37008, upload-time = "2025-04-10T22:18:26.069Z" }, @@ -545,6 +631,22 @@ version = "0.3.1" source = { registry = "https://pypi.org/simple" } sdist = { url = "https://files.pythonhosted.org/packages/07/c8/fdc6686a986feae3541ea23dcaa661bd93972d3940460646c6bb96e21c40/propcache-0.3.1.tar.gz", hash = "sha256:40d980c33765359098837527e18eddefc9a24cea5b45e078a7f3bb5b032c6ecf", size = 43651, upload-time = "2025-03-26T03:06:12.05Z" } wheels = [ + { url = "https://files.pythonhosted.org/packages/90/0f/5a5319ee83bd651f75311fcb0c492c21322a7fc8f788e4eef23f44243427/propcache-0.3.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:7f30241577d2fef2602113b70ef7231bf4c69a97e04693bde08ddab913ba0ce5", size = 80243, upload-time = "2025-03-26T03:04:01.912Z" }, + { url = "https://files.pythonhosted.org/packages/ce/84/3db5537e0879942783e2256616ff15d870a11d7ac26541336fe1b673c818/propcache-0.3.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:43593c6772aa12abc3af7784bff4a41ffa921608dd38b77cf1dfd7f5c4e71371", size = 46503, upload-time = "2025-03-26T03:04:03.704Z" }, + { url = "https://files.pythonhosted.org/packages/e2/c8/b649ed972433c3f0d827d7f0cf9ea47162f4ef8f4fe98c5f3641a0bc63ff/propcache-0.3.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:a75801768bbe65499495660b777e018cbe90c7980f07f8aa57d6be79ea6f71da", size = 45934, upload-time = "2025-03-26T03:04:05.257Z" }, + { url = "https://files.pythonhosted.org/packages/59/f9/4c0a5cf6974c2c43b1a6810c40d889769cc8f84cea676cbe1e62766a45f8/propcache-0.3.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f6f1324db48f001c2ca26a25fa25af60711e09b9aaf4b28488602776f4f9a744", size = 233633, upload-time = "2025-03-26T03:04:07.044Z" }, + { url = "https://files.pythonhosted.org/packages/e7/64/66f2f4d1b4f0007c6e9078bd95b609b633d3957fe6dd23eac33ebde4b584/propcache-0.3.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:5cdb0f3e1eb6dfc9965d19734d8f9c481b294b5274337a8cb5cb01b462dcb7e0", size = 241124, upload-time = "2025-03-26T03:04:08.676Z" }, + { url = "https://files.pythonhosted.org/packages/aa/bf/7b8c9fd097d511638fa9b6af3d986adbdf567598a567b46338c925144c1b/propcache-0.3.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1eb34d90aac9bfbced9a58b266f8946cb5935869ff01b164573a7634d39fbcb5", size = 240283, upload-time = "2025-03-26T03:04:10.172Z" }, + { url = "https://files.pythonhosted.org/packages/fa/c9/e85aeeeaae83358e2a1ef32d6ff50a483a5d5248bc38510d030a6f4e2816/propcache-0.3.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f35c7070eeec2cdaac6fd3fe245226ed2a6292d3ee8c938e5bb645b434c5f256", size = 232498, upload-time = "2025-03-26T03:04:11.616Z" }, + { url = "https://files.pythonhosted.org/packages/8e/66/acb88e1f30ef5536d785c283af2e62931cb934a56a3ecf39105887aa8905/propcache-0.3.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b23c11c2c9e6d4e7300c92e022046ad09b91fd00e36e83c44483df4afa990073", size = 221486, upload-time = "2025-03-26T03:04:13.102Z" }, + { url = "https://files.pythonhosted.org/packages/f5/f9/233ddb05ffdcaee4448508ee1d70aa7deff21bb41469ccdfcc339f871427/propcache-0.3.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:3e19ea4ea0bf46179f8a3652ac1426e6dcbaf577ce4b4f65be581e237340420d", size = 222675, upload-time = "2025-03-26T03:04:14.658Z" }, + { url = "https://files.pythonhosted.org/packages/98/b8/eb977e28138f9e22a5a789daf608d36e05ed93093ef12a12441030da800a/propcache-0.3.1-cp311-cp311-musllinux_1_2_armv7l.whl", hash = "sha256:bd39c92e4c8f6cbf5f08257d6360123af72af9f4da75a690bef50da77362d25f", size = 215727, upload-time = "2025-03-26T03:04:16.207Z" }, + { url = "https://files.pythonhosted.org/packages/89/2d/5f52d9c579f67b8ee1edd9ec073c91b23cc5b7ff7951a1e449e04ed8fdf3/propcache-0.3.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:b0313e8b923b3814d1c4a524c93dfecea5f39fa95601f6a9b1ac96cd66f89ea0", size = 217878, upload-time = "2025-03-26T03:04:18.11Z" }, + { url = "https://files.pythonhosted.org/packages/7a/fd/5283e5ed8a82b00c7a989b99bb6ea173db1ad750bf0bf8dff08d3f4a4e28/propcache-0.3.1-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:e861ad82892408487be144906a368ddbe2dc6297074ade2d892341b35c59844a", size = 230558, upload-time = "2025-03-26T03:04:19.562Z" }, + { url = "https://files.pythonhosted.org/packages/90/38/ab17d75938ef7ac87332c588857422ae126b1c76253f0f5b1242032923ca/propcache-0.3.1-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:61014615c1274df8da5991a1e5da85a3ccb00c2d4701ac6f3383afd3ca47ab0a", size = 233754, upload-time = "2025-03-26T03:04:21.065Z" }, + { url = "https://files.pythonhosted.org/packages/06/5d/3b921b9c60659ae464137508d3b4c2b3f52f592ceb1964aa2533b32fcf0b/propcache-0.3.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:71ebe3fe42656a2328ab08933d420df5f3ab121772eef78f2dc63624157f0ed9", size = 226088, upload-time = "2025-03-26T03:04:22.718Z" }, + { url = "https://files.pythonhosted.org/packages/54/6e/30a11f4417d9266b5a464ac5a8c5164ddc9dd153dfa77bf57918165eb4ae/propcache-0.3.1-cp311-cp311-win32.whl", hash = "sha256:58aa11f4ca8b60113d4b8e32d37e7e78bd8af4d1a5b5cb4979ed856a45e62005", size = 40859, upload-time = "2025-03-26T03:04:24.039Z" }, + { url = "https://files.pythonhosted.org/packages/1d/3a/8a68dd867da9ca2ee9dfd361093e9cb08cb0f37e5ddb2276f1b5177d7731/propcache-0.3.1-cp311-cp311-win_amd64.whl", hash = "sha256:9532ea0b26a401264b1365146c440a6d78269ed41f83f23818d4b79497aeabe7", size = 45153, upload-time = "2025-03-26T03:04:25.211Z" }, { url = "https://files.pythonhosted.org/packages/41/aa/ca78d9be314d1e15ff517b992bebbed3bdfef5b8919e85bf4940e57b6137/propcache-0.3.1-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:f78eb8422acc93d7b69964012ad7048764bb45a54ba7a39bb9e146c72ea29723", size = 80430, upload-time = "2025-03-26T03:04:26.436Z" }, { url = "https://files.pythonhosted.org/packages/1a/d8/f0c17c44d1cda0ad1979af2e593ea290defdde9eaeb89b08abbe02a5e8e1/propcache-0.3.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:89498dd49c2f9a026ee057965cdf8192e5ae070ce7d7a7bd4b66a8e257d0c976", size = 46637, upload-time = "2025-03-26T03:04:27.932Z" }, { url = "https://files.pythonhosted.org/packages/ae/bd/c1e37265910752e6e5e8a4c1605d0129e5b7933c3dc3cf1b9b48ed83b364/propcache-0.3.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:09400e98545c998d57d10035ff623266927cb784d13dd2b31fd33b8a5316b85b", size = 46123, upload-time = "2025-03-26T03:04:30.659Z" }, @@ -652,7 +754,7 @@ name = "pytest-cov" version = "7.0.0" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "coverage" }, + { name = "coverage", extra = ["toml"] }, { name = "pluggy" }, { name = "pytest" }, ] @@ -711,6 +813,12 @@ wheels = [ name = "smithy-aws-checksums" version = "0.1.1" source = { editable = "packages/smithy-aws-checksums" } +dependencies = [ + { name = "typing-extensions", marker = "python_full_version < '3.12'" }, +] + +[package.metadata] +requires-dist = [{ name = "typing-extensions", marker = "python_full_version < '3.12'", specifier = ">=4.14.0" }] [[package]] name = "smithy-aws-core" @@ -719,6 +827,7 @@ dependencies = [ { name = "aws-sdk-signers" }, { name = "smithy-core" }, { name = "smithy-http" }, + { name = "typing-extensions", marker = "python_full_version < '3.12'" }, ] [package.optional-dependencies] @@ -744,6 +853,7 @@ requires-dist = [ { name = "smithy-http", editable = "packages/smithy-http" }, { name = "smithy-json", marker = "extra == 'json'", editable = "packages/smithy-json" }, { name = "smithy-xml", marker = "extra == 'xml'", editable = "packages/smithy-xml" }, + { name = "typing-extensions", marker = "python_full_version < '3.12'", specifier = ">=4.14.0" }, ] provides-extras = ["checksums", "eventstream", "json", "xml"] @@ -752,24 +862,35 @@ name = "smithy-aws-event-stream" source = { editable = "packages/smithy-aws-event-stream" } dependencies = [ { name = "smithy-core" }, + { name = "typing-extensions", marker = "python_full_version < '3.12'" }, ] [package.metadata] -requires-dist = [{ name = "smithy-core", editable = "packages/smithy-core" }] +requires-dist = [ + { name = "smithy-core", editable = "packages/smithy-core" }, + { name = "typing-extensions", marker = "python_full_version < '3.12'", specifier = ">=4.14.0" }, +] [[package]] name = "smithy-cbor" source = { editable = "packages/smithy-cbor" } dependencies = [ { name = "smithy-core" }, + { name = "typing-extensions", marker = "python_full_version < '3.12'" }, ] [package.metadata] -requires-dist = [{ name = "smithy-core", editable = "packages/smithy-core" }] +requires-dist = [ + { name = "smithy-core", editable = "packages/smithy-core" }, + { name = "typing-extensions", marker = "python_full_version < '3.12'", specifier = ">=4.14.0" }, +] [[package]] name = "smithy-core" source = { editable = "packages/smithy-core" } +dependencies = [ + { name = "typing-extensions", marker = "python_full_version < '3.12'" }, +] [package.dev-dependencies] typing = [ @@ -777,6 +898,7 @@ typing = [ ] [package.metadata] +requires-dist = [{ name = "typing-extensions", marker = "python_full_version < '3.12'", specifier = ">=4.14.0" }] [package.metadata.requires-dev] typing = [{ name = "typing-extensions", specifier = ">=4.14.0" }] @@ -786,6 +908,7 @@ name = "smithy-http" source = { editable = "packages/smithy-http" } dependencies = [ { name = "smithy-core" }, + { name = "typing-extensions", marker = "python_full_version < '3.12'" }, ] [package.optional-dependencies] @@ -817,6 +940,7 @@ requires-dist = [ { name = "smithy-cbor", marker = "extra == 'cbor'", editable = "packages/smithy-cbor" }, { name = "smithy-core", editable = "packages/smithy-core" }, { name = "smithy-json", marker = "extra == 'json'", editable = "packages/smithy-json" }, + { name = "typing-extensions", marker = "python_full_version < '3.12'", specifier = ">=4.14.0" }, { name = "urllib3", marker = "extra == 'urllib3'", specifier = ">=2.0,<3.0" }, { name = "yarl", marker = "extra == 'aiohttp'", specifier = ">=1.17.0" }, ] @@ -835,6 +959,12 @@ requires-dist = [{ name = "smithy-core", editable = "packages/smithy-core" }] [[package]] name = "smithy-python" source = { editable = "packages/smithy-python" } +dependencies = [ + { name = "typing-extensions", marker = "python_full_version < '3.12'" }, +] + +[package.metadata] +requires-dist = [{ name = "typing-extensions", marker = "python_full_version < '3.12'", specifier = ">=4.14.0" }] [[package]] name = "smithy-python-workspace" @@ -883,6 +1013,7 @@ dependencies = [ { name = "smithy-aws-core" }, { name = "smithy-core" }, { name = "smithy-http" }, + { name = "typing-extensions", marker = "python_full_version < '3.12'" }, ] [package.metadata] @@ -890,6 +1021,7 @@ requires-dist = [ { name = "smithy-aws-core", editable = "packages/smithy-aws-core" }, { name = "smithy-core", editable = "packages/smithy-core" }, { name = "smithy-http", editable = "packages/smithy-http" }, + { name = "typing-extensions", marker = "python_full_version < '3.12'", specifier = ">=4.14.0" }, ] [[package]] @@ -902,6 +1034,78 @@ dependencies = [ [package.metadata] requires-dist = [{ name = "smithy-core", editable = "packages/smithy-core" }] +[[package]] +name = "tomli" +version = "2.5.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/b0/78/9ad63712633ed3ab5cc1a648d863d7e7da371e9425e209555a0fe711b695/tomli-2.5.0.tar.gz", hash = "sha256:264507556cd8b8c8e7c6ee037cdf443a463f03f4c958e57195e3d369711b8ff6", size = 17662, upload-time = "2026-10-07T12:23:37.892Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/22/a6/ab99b60ee52acd949684febabc3005d0045d0f66bebd9cdebd67372d26dd/tomli-2.5.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:c4dc1c1781f2f716de763d1e9a7b34c6a894e167e291c7c5d16c72f7a9538545", size = 163901, upload-time = "2026-10-07T12:22:15.601Z" }, + { url = "https://files.pythonhosted.org/packages/bc/00/ee01b7ed4579180fff07142d290257f25ba786f23f3ec6005f620933c2f5/tomli-2.5.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:eff8babca5a7999bc137acbc7482a8b7e17ffca5075ab41f5d770ab408c7bfef", size = 163756, upload-time = "2026-10-07T12:22:16.957Z" }, + { url = "https://files.pythonhosted.org/packages/72/c2/4efebf65372f6583185f79799312109dddb61102d47e5c33dcfd1a297aca/tomli-2.5.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:86665cee9c4835b7a7f1e8ec2c719b5258d4dc782887aded5a8ae7352a96843b", size = 268038, upload-time = "2026-10-07T12:22:18.135Z" }, + { url = "https://files.pythonhosted.org/packages/53/07/5850468e925d898abb36038666f9c333a94d2a223e802a8ba5b6d319d23f/tomli-2.5.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d7e369fd63331746182360977b1892bfc215476a30d61612d732425311639f56", size = 276422, upload-time = "2026-10-07T12:22:19.567Z" }, + { url = "https://files.pythonhosted.org/packages/b4/87/f293984cdcf83c054196d4fd3dad44fc68ae55b4b8c44bc76cef360c3150/tomli-2.5.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:7ad1ea345759240d6463efa0ed1c704402752e49aa21476620738d74d72d8aa1", size = 272616, upload-time = "2026-10-07T12:22:20.794Z" }, + { url = "https://files.pythonhosted.org/packages/ce/ce/db582886b3c1219d3fec93ebd669332482e5aee7a91e0f7838d84f2d1759/tomli-2.5.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:96243987194634bd411066ce40c952e108f86af04db533ecd8ac3ff2a85b1885", size = 276593, upload-time = "2026-10-07T12:22:22.12Z" }, + { url = "https://files.pythonhosted.org/packages/bf/72/7619b87dea4261fc27dd7b54c4461c129c1f7d9bb7ba3aec89c797a431b8/tomli-2.5.0-cp311-cp311-win32.whl", hash = "sha256:610b27d99f28ec5f191c7064a48f3ddb179a1fe6ca73d571483ae859f57b605e", size = 101830, upload-time = "2026-10-07T12:22:23.651Z" }, + { url = "https://files.pythonhosted.org/packages/1e/74/220106da34502304b6751a2a9b8a9fbca6c3fd47e737a2e2e3da7c61c9db/tomli-2.5.0-cp311-cp311-win_amd64.whl", hash = "sha256:c804ae44fe7b4bab5da295e4f980a1ff04670bca9d23fe0a4e887e08ebd741a8", size = 112742, upload-time = "2026-10-07T12:22:24.972Z" }, + { url = "https://files.pythonhosted.org/packages/27/99/7d9c8b41837a7773613e169504147375c157a290167aa59ad74a085f521f/tomli-2.5.0-cp311-cp311-win_arm64.whl", hash = "sha256:cfac177ebd6236003846ea339981f71457cb6eb748f23381eb257e45092e3980", size = 109332, upload-time = "2026-10-07T12:22:26.117Z" }, + { url = "https://files.pythonhosted.org/packages/52/ed/7baa86f87493646a594de388c7c1c40a39dd0461f7e9c0359cbeefc91fe8/tomli-2.5.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:1f4a40d03fb9f63424f0979855bdeaf44dd7696b8d59501822c10ed30ba532df", size = 164854, upload-time = "2026-10-07T12:22:27.444Z" }, + { url = "https://files.pythonhosted.org/packages/a5/b1/44c0341f2224397855723c7a8a39f718ea6fcbcc3dacc66e5aeca0f334e3/tomli-2.5.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:9ebf8d19b17bd0daeb7b7dec81a946a439b753942fd0210d6e96c532249eea6b", size = 164074, upload-time = "2026-10-07T12:22:28.679Z" }, + { url = "https://files.pythonhosted.org/packages/23/04/e2d5b7d3fba47adedb23de616c16d428ea076c79a3d8e1d95d649ffe197e/tomli-2.5.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:bf0b5e8e0f68ebb494356e577c06c139161efd8d3b9050f93b39b7c26cc54ff0", size = 274274, upload-time = "2026-10-07T12:22:29.804Z" }, + { url = "https://files.pythonhosted.org/packages/43/90/6090e706ff27a6f89f4a40578e3324b95c3cd8c4150868aabf33a8f414c3/tomli-2.5.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6cf74416bdc94ae458b14e37286c1073081850ac8459a00d0c5efef5d44294c6", size = 286435, upload-time = "2026-10-07T12:22:31.297Z" }, + { url = "https://files.pythonhosted.org/packages/0a/9e/a2c40768df16c408f22430afb0a73e9d7e5f79c950884954649d1146b74d/tomli-2.5.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:61ea1ebe1e55a34ea8199cc8dbff398d35027b82271c8ac4802fd3a1fd5b1bcc", size = 278119, upload-time = "2026-10-07T12:22:32.601Z" }, + { url = "https://files.pythonhosted.org/packages/12/25/3c0cb485b98e9cfac495629b1c93c87ccf0b72fbe9d2689fd8fe62c6d5a3/tomli-2.5.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:ed53f7e89bb04f6d9e8e7799112360b0c4d5cbff067de0814c98c37c39b920f7", size = 286177, upload-time = "2026-10-07T12:22:33.745Z" }, + { url = "https://files.pythonhosted.org/packages/77/8b/0144c65f0e37e51c18d04ae15c21b19431c165002d0131fe9aa8b0b8b1e8/tomli-2.5.0-cp312-cp312-win32.whl", hash = "sha256:e7ad033e27a516a233bea839cdb77b80146facb3b4f40bf02cd0cac165cdd5c2", size = 102760, upload-time = "2026-10-07T12:22:34.887Z" }, + { url = "https://files.pythonhosted.org/packages/de/32/5d6d8f42fc9a05fce69354e00ff256484192f5f2fc9a2165718fa0de61ec/tomli-2.5.0-cp312-cp312-win_amd64.whl", hash = "sha256:bd05de8c1698f8413dd7d869492693a0bf2211543b787ac78cd5e7536af1a6d7", size = 112722, upload-time = "2026-10-07T12:22:36.162Z" }, + { url = "https://files.pythonhosted.org/packages/30/65/df18032218db0fb9b769fb23c8039a051f15c811993995ea04c350273a32/tomli-2.5.0-cp312-cp312-win_arm64.whl", hash = "sha256:069435bd5480429b98c5e5afb02ab21c219b6f0064680671c6dc0d46817346ea", size = 109534, upload-time = "2026-10-07T12:22:37.296Z" }, + { url = "https://files.pythonhosted.org/packages/42/e5/51736d70da209350969e15aca5c5ab6e2ce1ea87a0a892a6c13aec172a86/tomli-2.5.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:943276cf269e0071948d9ff697159c1735e623c1151d88abb09b74659ef0cbea", size = 163328, upload-time = "2026-10-07T12:22:38.373Z" }, + { url = "https://files.pythonhosted.org/packages/ec/55/086f80dab4ab497602644274e6dea7ec5dd0b4e262e443a8ad3bb7edee2d/tomli-2.5.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:463b16086865b97facd8d0b3fb4cb7c544e3f58d2a69dc3113d6db9653fdb043", size = 162246, upload-time = "2026-10-07T12:22:39.673Z" }, + { url = "https://files.pythonhosted.org/packages/aa/eb/3ecc94459f3635c92321f4e7bde571323fdb2267c50e19e3188a281eae3b/tomli-2.5.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1245a6638fc4bb0a60af38a7d45413db34a13842027c77597c712c998c62fdf0", size = 272655, upload-time = "2026-10-07T12:22:41.08Z" }, + { url = "https://files.pythonhosted.org/packages/c0/d7/494fd1f0c37a621f1ad9975c2efadb523e8101f144ed6edb2e7fe64738f2/tomli-2.5.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:5d8bac3d603c97e6854424e5b2b5b741bdbde387e09f162fb0446812b4a8362b", size = 283595, upload-time = "2026-10-07T12:22:42.222Z" }, + { url = "https://files.pythonhosted.org/packages/70/51/bb8d62b1317e6640866f6949b2d5855e5300f2c99d46de1cd245570bba65/tomli-2.5.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:21e4cae4114aba25aa0d4f85cdf486d290fb35c0954d7bba536248da64d43066", size = 276253, upload-time = "2026-10-07T12:22:43.625Z" }, + { url = "https://files.pythonhosted.org/packages/66/f4/f46bd7f0763cd47de2db697dca9257c6a4adfd1a93b018cc75c8190ed5a8/tomli-2.5.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:bbaefc84548d754be821bba7c4141c4787dda182f9e77f2f87b71213529efa7b", size = 283582, upload-time = "2026-10-07T12:22:44.983Z" }, + { url = "https://files.pythonhosted.org/packages/ac/03/70f2bcb2923a6db37818d917e124270a7f4cfd38ea576f5aa753a91c0ef5/tomli-2.5.0-cp313-cp313-win32.whl", hash = "sha256:abdbf6313b8d9efe157edeb7ab6eae4de064b1300ad31abf73755154b30abe68", size = 102628, upload-time = "2026-10-07T12:22:46.508Z" }, + { url = "https://files.pythonhosted.org/packages/dc/98/d52024bb5b0ff68b4f0d276d867f634c84a67319a7e9f6b7708a37742333/tomli-2.5.0-cp313-cp313-win_amd64.whl", hash = "sha256:fd4dc129784e0c5335bd4e61dfcc4487499a013419e655cf2da1d091b7e0efdc", size = 113301, upload-time = "2026-10-07T12:22:47.647Z" }, + { url = "https://files.pythonhosted.org/packages/6f/f2/540db3a70572a8c23a28aba3e9c358ce0ffffbafc990905c1343aa265b31/tomli-2.5.0-cp313-cp313-win_arm64.whl", hash = "sha256:69491c143d2fe063046e0301e62a810bed338fa4d1ce0fd870c27dc1e09b0d84", size = 109744, upload-time = "2026-10-07T12:22:48.925Z" }, + { url = "https://files.pythonhosted.org/packages/e4/49/caf6b307766eb9567664a8707e9d6be5fcc0e8903f18781c6677a60d80c7/tomli-2.5.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:d3182ee2d887e507bd67319a0a61105d1dd33facc111329559a233b772c1a105", size = 162899, upload-time = "2026-10-07T12:22:50.088Z" }, + { url = "https://files.pythonhosted.org/packages/d3/c8/68cfce773a2733a49c74f99d627fb461bd990756860099eac25617889585/tomli-2.5.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:521345fd1f19d45b8df87657aaa38b6f2ca3800059fadf428e7ebf479a383646", size = 162080, upload-time = "2026-10-07T12:22:51.558Z" }, + { url = "https://files.pythonhosted.org/packages/7e/b2/e5bb8651fdad593f670501a7d718b1a7f73f064d44dea15e04c04dfef45d/tomli-2.5.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6e95c7614e705bfe2b04b27aa124adec59752d15813df37e2156747cab3a006b", size = 273380, upload-time = "2026-10-07T12:22:52.918Z" }, + { url = "https://files.pythonhosted.org/packages/8d/d2/9e2d7f8b1dfe0e2b34c245986ebd55c4c553ea4ce6c47c443b332673253f/tomli-2.5.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:7ac2027d37c3afbdf4bdd377f2676f6f1d2122a5be1f1137b49dced590b37e75", size = 283228, upload-time = "2026-10-07T12:22:54.173Z" }, + { url = "https://files.pythonhosted.org/packages/ba/df/ec7b876b7b1a2718bd74a3743c076fff565b04029ba33e8f61fac262739f/tomli-2.5.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:c414be4ed9d3cac80c42e348fa5a956117d1a48227f48026e31f59cb4a7671eb", size = 277189, upload-time = "2026-10-07T12:22:55.342Z" }, + { url = "https://files.pythonhosted.org/packages/7d/7b/e192d9eed0b9cb80da799f4d77052297fb9a2c3cc9b19f571f56ea88add6/tomli-2.5.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:9b03d7dc168353b4132965bde20feceabaa470e570c6f59660dfae59b1f9eeb3", size = 283632, upload-time = "2026-10-07T12:22:56.735Z" }, + { url = "https://files.pythonhosted.org/packages/84/50/ff94454e75461d75623e47401ed323d65c10aab8fe9033242c20cd2fdf32/tomli-2.5.0-cp314-cp314-win32.whl", hash = "sha256:6f041843c4d3a37245c0c056fd955b186bf8b1fb85690cbe40b81230891dc34b", size = 103535, upload-time = "2026-10-07T12:22:58.084Z" }, + { url = "https://files.pythonhosted.org/packages/54/0b/bdacf05f963bd6026ebf6eeb0beda847d1d60e03e440725c64a4e08a0afd/tomli-2.5.0-cp314-cp314-win_amd64.whl", hash = "sha256:f4b653094e18f9031102d3a1da5c729c8f222d85225b18037dac621695e46e1a", size = 114621, upload-time = "2026-10-07T12:22:59.2Z" }, + { url = "https://files.pythonhosted.org/packages/61/99/53f438fa6ae4f9d4ed0ddde3e7242b3bdc34b48c8f9948b72b9e9b127676/tomli-2.5.0-cp314-cp314-win_arm64.whl", hash = "sha256:3f89d10c1ff6a38d992c27fc8a4816af71a909e08a40ec66934240b1e74347c3", size = 111572, upload-time = "2026-10-07T12:23:00.479Z" }, + { url = "https://files.pythonhosted.org/packages/b9/20/1f88f19427d380a40e90a770e087489eaafe4aeee070ae88ed2bbec00acd/tomli-2.5.0-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:e9e15b4a6c7dd6b85b5fbab29488a73f1f70de516942308daa266bf0e0aeb0d4", size = 171814, upload-time = "2026-10-07T12:23:01.914Z" }, + { url = "https://files.pythonhosted.org/packages/d0/56/cbe5079c9f9a54b9b3e27fc82f08f3cb36edee75561679f53d2380c801d6/tomli-2.5.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:e12bbcd32897272fb05929110362ae9ff4c1b9bb26bd9e971e71dcd3275b4c3d", size = 171324, upload-time = "2026-10-07T12:23:03.18Z" }, + { url = "https://files.pythonhosted.org/packages/2b/30/1d53fd3b0f1cb3ba542e345ec32c26aefdddc4e829e4f3429af8a4f27782/tomli-2.5.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:20aa36de8f2cf87237143bc1fa1aae8d6612c09118f4da21c6a684db5dd1f6f9", size = 297441, upload-time = "2026-10-07T12:23:04.345Z" }, + { url = "https://files.pythonhosted.org/packages/66/d9/0800acb6a111686f764c1b91ef15cc42a20a66a46013bb42220f1d2c61c1/tomli-2.5.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:22185fad8a1e622f064e78008018a0dd3323550dcb479cb7a1d296888d74024f", size = 307476, upload-time = "2026-10-07T12:23:05.671Z" }, + { url = "https://files.pythonhosted.org/packages/e8/63/30a8f3cd51b5bec37f04744bad0b0dc6160df84aad4f27b0e9283d66f221/tomli-2.5.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:984012f71908165449a951de2050d52f276bfe3aa5d5f570f63ddad814370374", size = 296113, upload-time = "2026-10-07T12:23:07.202Z" }, + { url = "https://files.pythonhosted.org/packages/ab/18/0b9ffc597e69c5a1e20a7823cb60d54b39a9f54e91edcb8574f022186758/tomli-2.5.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:f79203b3965b4000e91808aaa7c040206093f2b8bf86f455982f2274c9ccf442", size = 307725, upload-time = "2026-10-07T12:23:08.508Z" }, + { url = "https://files.pythonhosted.org/packages/ab/c7/18f8baae0b5607a60e8e19b4a7fedee43a8ff6458e3896dcbbadeeac9c22/tomli-2.5.0-cp314-cp314t-win32.whl", hash = "sha256:91294a9fb94a75542f6e46e4a2ae709bd8d9b51134098cae5cf3bea5478b6d03", size = 108546, upload-time = "2026-10-07T12:23:09.956Z" }, + { url = "https://files.pythonhosted.org/packages/72/34/4cca9739254130627bde87500b3f2b512154fe2f278efa7e2a5e10ad4bcb/tomli-2.5.0-cp314-cp314t-win_amd64.whl", hash = "sha256:f15e3e0b835a6d68b10c86bf80a3149780498d6911c93c3ffd1861d19f9200f1", size = 117814, upload-time = "2026-10-07T12:23:11.486Z" }, + { url = "https://files.pythonhosted.org/packages/7d/fb/afa530d47dd80a78fce43beac6bc6e00f84558eafcffbc6f37b21e80d056/tomli-2.5.0-cp314-cp314t-win_arm64.whl", hash = "sha256:6664b7ae7af7294256c53960a6103077f4914cec8ff98479c352f622c6f6b2f0", size = 115188, upload-time = "2026-10-07T12:23:12.728Z" }, + { url = "https://files.pythonhosted.org/packages/66/98/316fdc00f8c0939e6fe50461dd343c162d3ad51d1286eb25b7db54361d50/tomli-2.5.0-cp315-cp315-macosx_10_15_x86_64.whl", hash = "sha256:a525685c2f97da40762b8695eb7aa0af4c8344ca1905c73e4e29cb04d34607dc", size = 162775, upload-time = "2026-10-07T12:23:13.941Z" }, + { url = "https://files.pythonhosted.org/packages/c5/22/7b10fa5bb01c9539f53f69b619361b19350acc73657772ea7ac70ba309a8/tomli-2.5.0-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:9dbb18c1cfb2f6517942fc9314437f66aa06d94436ffb1f06102ef3572f35276", size = 161406, upload-time = "2026-10-07T12:23:15.215Z" }, + { url = "https://files.pythonhosted.org/packages/9c/e7/1a069d86dfd20f1f84f71c63faed9f83c1d890bc06c27d82dc7d888fb573/tomli-2.5.0-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:752e8b1aa6a4367ef8bf6a1a1e005540f7ed055ba36d7193796812ca5404eb52", size = 273855, upload-time = "2026-10-07T12:23:16.471Z" }, + { url = "https://files.pythonhosted.org/packages/ae/83/d1ef43d1687d092ab9c235455c76e6e709483b346b056f086095c7c263a5/tomli-2.5.0-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c47300f9bf791808f77d82747691c4bb09cb14bdf3060cca99b42cdc4361d5a7", size = 284910, upload-time = "2026-10-07T12:23:18.166Z" }, + { url = "https://files.pythonhosted.org/packages/cc/05/f4d9cf7de61822ece0c3873f30d291e324911c71a378b8bfe5ced13fd9f5/tomli-2.5.0-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:19b0dd8749f4ea2f112c5fcfb3c5248390c899d7e2e173f1d91abee1fa0ff391", size = 277723, upload-time = "2026-10-07T12:23:19.355Z" }, + { url = "https://files.pythonhosted.org/packages/42/28/78262493141fa543151cf005760c3cb01d09fc28a11f993c05109902cb8c/tomli-2.5.0-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:57b1c3b01fab802e2899bc3d168dca320e14165e2fd9fd584760fb4ca5826859", size = 285115, upload-time = "2026-10-07T12:23:20.698Z" }, + { url = "https://files.pythonhosted.org/packages/1a/b9/e1dab9a30bcb677b5cc5cee810609cfd64f24306a3055767dd3fda00b1e0/tomli-2.5.0-cp315-cp315-win32.whl", hash = "sha256:667e521b37a6c5ccaa044202c235b530f90177ffe2cd4a64ecc213c7dd535feb", size = 103475, upload-time = "2026-10-07T12:23:21.941Z" }, + { url = "https://files.pythonhosted.org/packages/4c/bd/31a3790c11d6ea95fcf5e6022ac0f8d0543c9b61120b730fc481bd43d3b4/tomli-2.5.0-cp315-cp315-win_amd64.whl", hash = "sha256:d747252933c8a65ef6bd8da0fbb7ce28a90eb6119d8cd00772cd528aa07b68d5", size = 114589, upload-time = "2026-10-07T12:23:23.098Z" }, + { url = "https://files.pythonhosted.org/packages/47/a2/4f6310fa699364f0e3af7ee3af88dddd9af066d33e716a0265bbe2b3ea84/tomli-2.5.0-cp315-cp315-win_arm64.whl", hash = "sha256:75dbcde8751b0a960aa3de173aa5e894d590755c6d7758b7e774c06f1dc3cbdd", size = 111493, upload-time = "2026-10-07T12:23:24.233Z" }, + { url = "https://files.pythonhosted.org/packages/68/14/00853f0b396d8971107ae1921bb5b322fdee1650d2f16bf06c20adb532e5/tomli-2.5.0-cp315-cp315t-macosx_10_15_x86_64.whl", hash = "sha256:2419c2a189551987b59d80e63ec355671283336f41c6b9b89462df679c7d0c57", size = 171380, upload-time = "2026-10-07T12:23:25.512Z" }, + { url = "https://files.pythonhosted.org/packages/89/ad/fa6949321dadee46b27363974fb197b94c911c3b0f7a5fd26d7dc18fc2a0/tomli-2.5.0-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:0dc598040da8d42cf20f0be588ed7004f46db12a0ac6c32e03a59dccedaaadcd", size = 170553, upload-time = "2026-10-07T12:23:26.855Z" }, + { url = "https://files.pythonhosted.org/packages/53/aa/3056c919eb3e084df3752b2cf5f865dcc04af0b27dba2f66d7b28af4633a/tomli-2.5.0-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:49096930c8d886c9bbdab62d2d0d17ce823ddeea522309a190b36245d5b49e01", size = 294428, upload-time = "2026-10-07T12:23:28.132Z" }, + { url = "https://files.pythonhosted.org/packages/96/b2/faeeb5d8769ea3832021d73e892c8391eae7b4b4f8b55a789127bd8b18a9/tomli-2.5.0-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b8ade5023067f99fe72b88accd30d0ea05a158e9e32a11f124e731ea9695313f", size = 304909, upload-time = "2026-10-07T12:23:29.381Z" }, + { url = "https://files.pythonhosted.org/packages/f6/52/f094c09e73fb654b621716d019acb5d29bdfd1be01df80c281d552bda48d/tomli-2.5.0-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:b69564772b5c8f22ea5f498dff08cfa825045b4d4c4400529000bdf818aa3b2a", size = 293220, upload-time = "2026-10-07T12:23:30.608Z" }, + { url = "https://files.pythonhosted.org/packages/86/f5/0c30541078ca4b505ce3bd76ed931facbfec524dd018535d691d1af0a6d2/tomli-2.5.0-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:8ff3a2ca028c7eee0c777f9a092038d0a594a9fa04e215f929a22c329e2cb142", size = 305705, upload-time = "2026-10-07T12:23:32.181Z" }, + { url = "https://files.pythonhosted.org/packages/05/74/590e7d19d6a118fc5cc5704ff358e21d95b8573f6b9443b1519f29ca8825/tomli-2.5.0-cp315-cp315t-win32.whl", hash = "sha256:62fc1bc8eb03e3a9cadfca713d65614ed8e09d974a283295ffe3a831976b4dc5", size = 108432, upload-time = "2026-10-07T12:23:33.496Z" }, + { url = "https://files.pythonhosted.org/packages/1c/b8/63a75cfb27a17c38550e44025d3a6e7be64516fd8608a3b75703bf37d81b/tomli-2.5.0-cp315-cp315t-win_amd64.whl", hash = "sha256:f3fcbc57b1791fa6cbe5d8434179d51de12be1a4811469529f47f6e7487a2571", size = 117281, upload-time = "2026-10-07T12:23:34.648Z" }, + { url = "https://files.pythonhosted.org/packages/72/01/e8c1debb2173973372934c68fc8e46170ab60ef23ed4592dff4dec6e8993/tomli-2.5.0-cp315-cp315t-win_arm64.whl", hash = "sha256:d2ba24db8a9376921b5e87b4762b9adb0f3f1deaea68f2b8b0bb2c11efb9c3e7", size = 115069, upload-time = "2026-10-07T12:23:35.77Z" }, + { url = "https://files.pythonhosted.org/packages/60/3f/3e3f8fd0919249b0200c80fbc4f9a1e70be19f9883da71dfb7f8b9ab8aca/tomli-2.5.0-py3-none-any.whl", hash = "sha256:32a7b79ac57a2e83670ce329ccf675798bc5a2094783a63676866b70503f2e2b", size = 14765, upload-time = "2026-10-07T12:23:36.875Z" }, +] + [[package]] name = "typing-extensions" version = "4.16.0" @@ -931,6 +1135,23 @@ dependencies = [ ] sdist = { url = "https://files.pythonhosted.org/packages/75/16/e8be8e2fb175bbf41a0680381a319f1199fae256588241a2ac8677eafb49/yarl-1.25.1.tar.gz", hash = "sha256:03dd38de09bc213e9a8b29761eec33ee1d5318dac0e49d8af36e4d27830e23a7", size = 246245, upload-time = "2026-09-15T19:35:02.264Z" } wheels = [ + { url = "https://files.pythonhosted.org/packages/83/b3/2cea721d495ca57f8f414aa4867ee263f486b274e07463158cf52f02ba7f/yarl-1.25.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:9d693bf4bf534e9ba3ae2780cfd577f5135629f7b5ac653490859d0b77864865", size = 143794, upload-time = "2026-09-15T19:30:26.946Z" }, + { url = "https://files.pythonhosted.org/packages/55/e6/cd145cff8e5cf60b8b3c41fbecfa2a45028a8dec3fbc52bec03595ff3d3b/yarl-1.25.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:ab2054c5531af2a9ba7b69b8ec91e4f884420e83a8c5e579b013084cb57e5e5d", size = 103993, upload-time = "2026-09-15T19:30:28.661Z" }, + { url = "https://files.pythonhosted.org/packages/ce/7c/fbb40fe2d53747c40aa36a9e2bd2178a202f942bda0b670f3306d4aefbce/yarl-1.25.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:564fdc7085d2245ab84f88882fdb1d6ac0723124bff6ded35bfb1c00f812630d", size = 104010, upload-time = "2026-09-15T19:30:31.069Z" }, + { url = "https://files.pythonhosted.org/packages/f0/0b/5a516f70641092283f57cf3670bdb75e7327bcc0dcb5038697e4dfbfd569/yarl-1.25.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:acae6b45d1ace09b6ba3876da43b88366ef368f73b988c7f57e14231753d4420", size = 116444, upload-time = "2026-09-15T19:30:32.894Z" }, + { url = "https://files.pythonhosted.org/packages/b6/8a/d1a627f827b0a404ae0f5647cab0534959081cde13b0756a783469fb3b5e/yarl-1.25.1-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:1fb2a01ba8cd9c5d2c5dc1ec35e0fc951d04b4f037541d4ac090c993ce58b3d7", size = 107565, upload-time = "2026-09-15T19:30:35.188Z" }, + { url = "https://files.pythonhosted.org/packages/aa/cf/c8e0aaec886840a6c4480fe44eaec7cd4319f79a563b79321473be79c56f/yarl-1.25.1-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:e92b6bcc741b86d67606c40d3cb9c7cc8e6c737f81e31f4a94efc204456c92e3", size = 125006, upload-time = "2026-09-15T19:30:37.1Z" }, + { url = "https://files.pythonhosted.org/packages/50/26/0cce366d54a93cdc8342965dc7663385e4db161625cc1e8b18e786753d24/yarl-1.25.1-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:72c34ac7ad4314c19362d5ce27626dcc8429bd30bbf8c179f4234078851f9492", size = 128717, upload-time = "2026-09-15T19:30:38.904Z" }, + { url = "https://files.pythonhosted.org/packages/95/0c/a71501bbc1a674ff72c4d6c2b75f4d9a5af819f5244c3a7558080a8802c5/yarl-1.25.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d5add7b4ca7afeea91d52e4d4e4db3b1fe9885b71f07054560d8c4296b7441a2", size = 117728, upload-time = "2026-09-15T19:30:40.809Z" }, + { url = "https://files.pythonhosted.org/packages/e7/6f/c3267ca01defeed9ed9c4ff9b17bd54915432c405945233265b707475d1c/yarl-1.25.1-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:def538065f9e4d4cf1ae164bd59aba00dfa84f03923e0de4c3788f252d6bcd17", size = 116224, upload-time = "2026-09-15T19:30:42.818Z" }, + { url = "https://files.pythonhosted.org/packages/8f/69/fad57ee52d648431718ee0f1f68966a99c1352c3924688ffbdcc9d3fe51a/yarl-1.25.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:0a191bfdb30a79b98e5d175d75285f9fcb78bf0e46ba5efda042e1c72071a0de", size = 116299, upload-time = "2026-09-15T19:30:44.966Z" }, + { url = "https://files.pythonhosted.org/packages/2a/d4/6a8c1e29f33338687ca278cba0a8fbf6525a322c2c02a9a500ccbe041152/yarl-1.25.1-cp311-cp311-musllinux_1_2_armv7l.whl", hash = "sha256:71f42c5b9a948c113bbdebfa544598321431d064ff959d32e99b1feb61d68345", size = 108625, upload-time = "2026-09-15T19:30:46.874Z" }, + { url = "https://files.pythonhosted.org/packages/e8/d2/3a35ae791c9cb6522c106923ff25c3230d999091e5e65511bca23bbd9914/yarl-1.25.1-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:72849d892954be4d09e569b8b831ac39ce58417fedc767d4308a0fe542018a40", size = 124515, upload-time = "2026-09-15T19:30:49.082Z" }, + { url = "https://files.pythonhosted.org/packages/be/fd/2b022109a6b4af0f7dc371cf7500af380b0d4f034010243e1b0ce218dc93/yarl-1.25.1-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:efb01a106f971cb3752856bca2318bbdf7f01bd8823779c461586cbe5ffd5258", size = 115711, upload-time = "2026-09-15T19:30:51.208Z" }, + { url = "https://files.pythonhosted.org/packages/18/59/f7586271136c3ddb0126bbfe661844699369b76b555fe38c4efe86870b2e/yarl-1.25.1-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:a1daf47cd95a7c3a63456336bc5aaa8c86dd3a47d07ed3d0e76132ae4666a5a1", size = 122751, upload-time = "2026-09-15T19:30:53.535Z" }, + { url = "https://files.pythonhosted.org/packages/a0/0b/07f7a2d881f7e16c385b47fc1753382600847cad305dcc7fa0c25828acf8/yarl-1.25.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:9489e6abf47ba37f332075a91444c7cfedb03e6ce99fbb2f116bfe1ce810da3b", size = 117983, upload-time = "2026-09-15T19:30:55.277Z" }, + { url = "https://files.pythonhosted.org/packages/aa/9d/8cdceec66a9b940700cb45931741403f045b162afd79bcb93c41cadd0972/yarl-1.25.1-cp311-cp311-win_amd64.whl", hash = "sha256:d7306dee25b8a0e737363f347362b875094b4dc4e367311470656ae420fdbf8e", size = 102894, upload-time = "2026-09-15T19:30:57.606Z" }, + { url = "https://files.pythonhosted.org/packages/17/f1/7ec357db1d3ad2863542d71e8fe64a126bbec17b134cd7d30951196809a5/yarl-1.25.1-cp311-cp311-win_arm64.whl", hash = "sha256:abb1384477f5901d436b5d2e5465954de46ea6098f59163d243660b5c4461d35", size = 98609, upload-time = "2026-09-15T19:30:59.705Z" }, { url = "https://files.pythonhosted.org/packages/75/b3/cd32ac66ae622b854c2df0ac52106dda220d361b65a64fde7d5b3684aa3f/yarl-1.25.1-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:94d7aa6debf92a1dd14cb5280b083a764169a13cfb23a452111160274ed989f4", size = 144798, upload-time = "2026-09-15T19:31:01.821Z" }, { url = "https://files.pythonhosted.org/packages/61/fb/a2c52a8007c2051ba74662afb112ecf3d00346af4c25e33df9d80fd14fb8/yarl-1.25.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:83d4a37e4b95da4d8bda930d6d35b75b4cdadbacbb4980cae290ea3100b5d51d", size = 104583, upload-time = "2026-09-15T19:31:04.05Z" }, { url = "https://files.pythonhosted.org/packages/be/dd/ee38aec8e09fdf957e50d4085453fbe202f56c6c3b4cf07b81cdb4f09ee9/yarl-1.25.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:e029648f9c951db30e98a7d7ec90835db88ec4b32820efe2a9bdc2287e032eb6", size = 104325, upload-time = "2026-09-15T19:31:06.338Z" },