Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Bumps the S3MP package version and adjusts global configuration behavior so changing the default bucket key invalidates cached S3 objects.
Changes:
- Bump project/package version from
0.8.1to0.8.2. - Invalidate cached boto3 client/resource/bucket when
set_default_bucket_key()is called by introducingclear_boto3_cache().
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
uv.lock |
Updates locked package version to 0.8.2. |
pyproject.toml |
Updates project version to 0.8.2. |
S3MP/global_config.py |
Adds boto3/bucket cache invalidation tied to default bucket key changes. |
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 3 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
S3MP/global_config.py:94
clear_boto3_cache()sets_s3_client/_s3_resourcetoNone, but the lazy initializers (s3_client/s3_resource) rebuild them withboto3.client/resource("s3")even if_iam_role_arnis set. That means calling this method afterassume_role()(or after loadingiam_role_arnfrom config) can silently drop the assumed-role credentials and switch back to default AWS credentials. Consider either (a) updating thes3_client/s3_resourceproperties to re-runassume_role(self._iam_role_arn)when_iam_role_arnis set and the cache is empty, or (b) havingclear_boto3_cache()also clear_iam_role_arn(and documenting that it reverts to default credentials).
def clear_boto3_cache(self) -> None:
"""Clear cached boto3 client and resource."""
self._s3_client = None
self._s3_resource = None
self._bucket = None
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
PR Checklist
pyproject.toml.Breaking Changes