From 5adb0f623e139fcb495f52361b740b851b974368 Mon Sep 17 00:00:00 2001 From: David Michaels Date: Fri, 4 Oct 2024 09:26:30 -0400 Subject: [PATCH 1/4] Added optional bucket argument to s3_utils.read_s3 function. --- CHANGELOG.rst | 6 ++++++ dcicutils/s3_utils.py | 6 ++++-- pyproject.toml | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 6926218df..9cea69bc5 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,12 @@ dcicutils Change Log ---------- +8.15.0 +====== +* 2024-10-04 (dmichaels) +* Added optional bucket argument to s3_utils.read_s3 (initially for Andy). + + 8.14.3 ====== diff --git a/dcicutils/s3_utils.py b/dcicutils/s3_utils.py index c09cbec07..b204f74a6 100644 --- a/dcicutils/s3_utils.py +++ b/dcicutils/s3_utils.py @@ -328,8 +328,10 @@ def get_key(self, keyfile_name: str = 'access_key_admin' # maybe its not json after all return auth_text - def read_s3(self, filename: str): - response = self.s3.get_object(Bucket=self.outfile_bucket, Key=filename) + def read_s3(self, filename: str, bucket: Optional[str] = None): + if (not isinstance(bucket, str)) or (not bucket): + bucket = self.outfile_bucket + response = self.s3.get_object(Bucket=bucket, Key=filename) logger.info(str(response)) return response['Body'].read() diff --git a/pyproject.toml b/pyproject.toml index 3d1dd5044..5e3abe665 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "dcicutils" -version = "8.14.3" +version = "8.14.3.1b1" # TODO: To become 8.15.0 description = "Utility package for interacting with the 4DN Data Portal and other 4DN resources" authors = ["4DN-DCIC Team "] license = "MIT" From 4d868f1e2907374fea048bfa72c0ee7c2fc3da6e Mon Sep 17 00:00:00 2001 From: David Michaels Date: Fri, 4 Oct 2024 09:31:07 -0400 Subject: [PATCH 2/4] comment update --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 9cea69bc5..0314eb0f6 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -9,7 +9,7 @@ Change Log 8.15.0 ====== * 2024-10-04 (dmichaels) -* Added optional bucket argument to s3_utils.read_s3 (initially for Andy). +* Added optional bucket argument to s3_utils.s3Utils.read_s3 (initially for Andy). 8.14.3 From 0194569037ee3e9db2f7a4ccc54a7f124ad55a30 Mon Sep 17 00:00:00 2001 From: David Michaels Date: Fri, 4 Oct 2024 09:32:23 -0400 Subject: [PATCH 3/4] update beta version to 8.14.3.2b1 (1b1 taken) --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 5e3abe665..f83d41ecb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "dcicutils" -version = "8.14.3.1b1" # TODO: To become 8.15.0 +version = "8.14.3.2b1" # TODO: To become 8.15.0 description = "Utility package for interacting with the 4DN Data Portal and other 4DN resources" authors = ["4DN-DCIC Team "] license = "MIT" From 01e01a5edee926ce925ad2e51e7686dd6f7f143f Mon Sep 17 00:00:00 2001 From: David Michaels Date: Sat, 5 Oct 2024 19:45:38 -0400 Subject: [PATCH 4/4] version update --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f83d41ecb..24dc1c42f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "dcicutils" -version = "8.14.3.2b1" # TODO: To become 8.15.0 +version = "8.15.0" description = "Utility package for interacting with the 4DN Data Portal and other 4DN resources" authors = ["4DN-DCIC Team "] license = "MIT"