From 20b6532eef8926b3789fab3803602009e2974544 Mon Sep 17 00:00:00 2001 From: Rohan Gavankar Date: Mon, 30 Nov 2026 14:53:16 -0500 Subject: [PATCH] feat(aws-credentials-imds): export IMDSClient and IMDSTokenCache from the package root aws_credentials_imds.aio exports AsyncIMDSClient and AsyncIMDSTokenCache, and the 0.5.0 changelog names their sync counterparts, but the package root never exported IMDSClient or IMDSTokenCache. Add both to the root imports and __all__ so sync and async users import them the same way. --- ...-imds-enhancement-d97496c27b854da3b6e93758ef434586.json | 4 ++++ .../src/aws_credentials_imds/__init__.py | 4 +++- packages/aws-credentials-imds/tests/unit/test_client.py | 7 +++++++ scripts/api-snapshot/api-rex.json | 2 ++ 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 packages/aws-credentials-imds/.changes/next-release/aws-credentials-imds-enhancement-d97496c27b854da3b6e93758ef434586.json diff --git a/packages/aws-credentials-imds/.changes/next-release/aws-credentials-imds-enhancement-d97496c27b854da3b6e93758ef434586.json b/packages/aws-credentials-imds/.changes/next-release/aws-credentials-imds-enhancement-d97496c27b854da3b6e93758ef434586.json new file mode 100644 index 000000000..4374f8c1e --- /dev/null +++ b/packages/aws-credentials-imds/.changes/next-release/aws-credentials-imds-enhancement-d97496c27b854da3b6e93758ef434586.json @@ -0,0 +1,4 @@ +{ + "type": "enhancement", + "description": "Export `IMDSClient` and `IMDSTokenCache` from the package root, matching `AsyncIMDSClient` and `AsyncIMDSTokenCache` in `aws_credentials_imds.aio`. Previously they were only importable from `aws_credentials_imds.client`." +} \ No newline at end of file diff --git a/packages/aws-credentials-imds/src/aws_credentials_imds/__init__.py b/packages/aws-credentials-imds/src/aws_credentials_imds/__init__.py index f937d13b3..dd222d11b 100644 --- a/packages/aws-credentials-imds/src/aws_credentials_imds/__init__.py +++ b/packages/aws-credentials-imds/src/aws_credentials_imds/__init__.py @@ -2,13 +2,15 @@ # SPDX-License-Identifier: Apache-2.0 __version__ = "0.5.0" -from .client import IMDSConfig, IMDSConfigurationError +from .client import IMDSClient, IMDSConfig, IMDSConfigurationError, IMDSTokenCache from .providers import Ec2InstanceMetadataProvider from .resolvers import IMDSCredentialsResolver __all__ = ( "Ec2InstanceMetadataProvider", + "IMDSClient", "IMDSConfig", "IMDSConfigurationError", "IMDSCredentialsResolver", + "IMDSTokenCache", ) diff --git a/packages/aws-credentials-imds/tests/unit/test_client.py b/packages/aws-credentials-imds/tests/unit/test_client.py index a65f53b29..bc695c35e 100644 --- a/packages/aws-credentials-imds/tests/unit/test_client.py +++ b/packages/aws-credentials-imds/tests/unit/test_client.py @@ -182,3 +182,10 @@ def test_imds_client_get_non_200() -> None: with pytest.raises(SmithyIdentityError): client.get(path="/test-path") + + +def test_imds_client_and_token_cache_are_exported() -> None: + import aws_credentials_imds + + assert aws_credentials_imds.IMDSClient is IMDSClient + assert aws_credentials_imds.IMDSTokenCache is IMDSTokenCache diff --git a/scripts/api-snapshot/api-rex.json b/scripts/api-snapshot/api-rex.json index 238411c05..226b62755 100644 --- a/scripts/api-snapshot/api-rex.json +++ b/scripts/api-snapshot/api-rex.json @@ -41,9 +41,11 @@ }, "aws_credentials_imds": { "Ec2InstanceMetadataProvider": "rex-class", + "IMDSClient": "rex-class", "IMDSConfig": "rex-class", "IMDSConfigurationError": "rex-exception", "IMDSCredentialsResolver": "rex-class", + "IMDSTokenCache": "rex-class", "client": "rex-module", "providers": "rex-module", "resolvers": "rex-module"