Skip to content

Commit 527297d

Browse files
Merge branch 'release-1.19.5'
* release-1.19.5: Bumping version to 1.19.5 Add changelog entries from botocore Add get_partition_for_region to Session (#3060) Add max_bandwidth to TransferConfig (#3059)
2 parents a426ea0 + 6967a2d commit 527297d

File tree

9 files changed

+118
-11
lines changed

9 files changed

+118
-11
lines changed

.changes/1.19.5.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
[
2+
{
3+
"category": "``autoscaling``",
4+
"description": "[``botocore``] This release adds support for attribute-based instance type selection, a new EC2 Auto Scaling feature that lets customers express their instance requirements as a set of attributes, such as vCPU, memory, and storage.",
5+
"type": "api-change"
6+
},
7+
{
8+
"category": "``ec2``",
9+
"description": "[``botocore``] This release adds: attribute-based instance type selection for EC2 Fleet, Spot Fleet, a feature that lets customers express instance requirements as attributes like vCPU, memory, and storage; and Spot placement score, a feature that helps customers identify an optimal location to run Spot workloads.",
10+
"type": "api-change"
11+
},
12+
{
13+
"category": "Session",
14+
"description": "Added `get_partition_for_region` to lookup partition for a given region_name",
15+
"type": "enhancement"
16+
},
17+
{
18+
"category": "``eks``",
19+
"description": "[``botocore``] EKS managed node groups now support BOTTLEROCKET_x86_64 and BOTTLEROCKET_ARM_64 AMI types.",
20+
"type": "api-change"
21+
},
22+
{
23+
"category": "``sagemaker``",
24+
"description": "[``botocore``] This release allows customers to describe one or more versioned model packages through BatchDescribeModelPackage, update project via UpdateProject, modify and read customer metadata properties using Create, Update and Describe ModelPackage and enables cross account registration of model packages.",
25+
"type": "api-change"
26+
},
27+
{
28+
"category": "Session",
29+
"description": "[``botocore``] Added `get_partition_for_region` allowing partition lookup by region name.",
30+
"type": "enhancement"
31+
},
32+
{
33+
"category": "``textract``",
34+
"description": "[``botocore``] This release adds support for asynchronously analyzing invoice and receipt documents through two new APIs: StartExpenseAnalysis and GetExpenseAnalysis",
35+
"type": "api-change"
36+
},
37+
{
38+
"category": "``s3``",
39+
"description": "TransferConfig now supports the `max_bandwidth` argument.",
40+
"type": "enchancement"
41+
}
42+
]

CHANGELOG.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22
CHANGELOG
33
=========
44

5+
1.19.5
6+
======
7+
8+
* api-change:``autoscaling``: [``botocore``] This release adds support for attribute-based instance type selection, a new EC2 Auto Scaling feature that lets customers express their instance requirements as a set of attributes, such as vCPU, memory, and storage.
9+
* api-change:``ec2``: [``botocore``] This release adds: attribute-based instance type selection for EC2 Fleet, Spot Fleet, a feature that lets customers express instance requirements as attributes like vCPU, memory, and storage; and Spot placement score, a feature that helps customers identify an optimal location to run Spot workloads.
10+
* enhancement:Session: Added `get_partition_for_region` to lookup partition for a given region_name
11+
* api-change:``eks``: [``botocore``] EKS managed node groups now support BOTTLEROCKET_x86_64 and BOTTLEROCKET_ARM_64 AMI types.
12+
* api-change:``sagemaker``: [``botocore``] This release allows customers to describe one or more versioned model packages through BatchDescribeModelPackage, update project via UpdateProject, modify and read customer metadata properties using Create, Update and Describe ModelPackage and enables cross account registration of model packages.
13+
* enhancement:Session: [``botocore``] Added `get_partition_for_region` allowing partition lookup by region name.
14+
* api-change:``textract``: [``botocore``] This release adds support for asynchronously analyzing invoice and receipt documents through two new APIs: StartExpenseAnalysis and GetExpenseAnalysis
15+
* enchancement:``s3``: TransferConfig now supports the `max_bandwidth` argument.
16+
17+
518
1.19.4
619
======
720

boto3/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919

2020
__author__ = 'Amazon Web Services'
21-
__version__ = '1.19.4'
21+
__version__ = '1.19.5'
2222

2323

2424
# The default Boto3 session; autoloaded when needed.

boto3/s3/transfer.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,17 @@ class TransferConfig(S3TransferConfig):
166166
'max_io_queue': 'max_io_queue_size'
167167
}
168168

169-
def __init__(self,
170-
multipart_threshold=8 * MB,
171-
max_concurrency=10,
172-
multipart_chunksize=8 * MB,
173-
num_download_attempts=5,
174-
max_io_queue=100,
175-
io_chunksize=256 * KB,
176-
use_threads=True):
169+
def __init__(
170+
self,
171+
multipart_threshold=8 * MB,
172+
max_concurrency=10,
173+
multipart_chunksize=8 * MB,
174+
num_download_attempts=5,
175+
max_io_queue=100,
176+
io_chunksize=256 * KB,
177+
use_threads=True,
178+
max_bandwidth=None,
179+
):
177180
"""Configuration object for managed S3 transfers
178181
179182
:param multipart_threshold: The transfer size threshold for which
@@ -209,6 +212,10 @@ def __init__(self,
209212
:param use_threads: If True, threads will be used when performing
210213
S3 transfers. If False, no threads will be used in
211214
performing transfers: all logic will be ran in the main thread.
215+
216+
:param max_bandwidth: The maximum bandwidth that will be consumed
217+
in uploading and downloading file content. The value is an integer
218+
in terms of bytes per second.
212219
"""
213220
super(TransferConfig, self).__init__(
214221
multipart_threshold=multipart_threshold,
@@ -217,6 +224,7 @@ def __init__(self,
217224
num_download_attempts=num_download_attempts,
218225
max_io_queue_size=max_io_queue,
219226
io_chunksize=io_chunksize,
227+
max_bandwidth=max_bandwidth,
220228
)
221229
# Some of the argument names are not the same as the inherited
222230
# S3TransferConfig so we add aliases so you can still access the

boto3/session.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,18 @@ def get_credentials(self):
182182
"""
183183
return self._session.get_credentials()
184184

185+
def get_partition_for_region(self, region_name):
186+
"""Lists the partition name of a particular region.
187+
188+
:type region_name: string
189+
:param region_name: Name of the region to list partition for (e.g.,
190+
us-east-1).
191+
192+
:rtype: string
193+
:return: Returns the respective partition name (e.g., aws).
194+
"""
195+
return self._session.get_partition_for_region(region_name)
196+
185197
def client(self, service_name, region_name=None, api_version=None,
186198
use_ssl=True, verify=None, endpoint_url=None,
187199
aws_access_key_id=None, aws_secret_access_key=None,

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ universal = 0
33

44
[metadata]
55
requires_dist =
6-
botocore>=1.22.4,<1.23.0
6+
botocore>=1.22.5,<1.23.0
77
jmespath>=0.7.1,<1.0.0
88
s3transfer>=0.5.0,<0.6.0
99

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414

1515
requires = [
16-
'botocore>=1.22.4,<1.23.0',
16+
'botocore>=1.22.5,<1.23.0',
1717
'jmespath>=0.7.1,<1.0.0',
1818
's3transfer>=0.5.0,<0.6.0'
1919
]

tests/unit/s3/test_transfer.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from boto3.s3.transfer import S3Transfer
2424
from boto3.s3.transfer import OSUtils, TransferConfig, ProgressCallbackInvoker
2525
from boto3.s3.transfer import ClientError, S3TransferRetriesExceededError
26+
from boto3.s3.transfer import KB, MB
2627

2728

2829
class TestCreateTransferManager(unittest.TestCase):
@@ -83,6 +84,26 @@ def test_alias_max_io_queue(self):
8384
self.assert_value_of_actual_and_alias(
8485
config, 'max_io_queue_size', 'max_io_queue', new_value)
8586

87+
def test_transferconfig_parameters(self):
88+
config = TransferConfig(
89+
multipart_threshold=8 * MB,
90+
max_concurrency=10,
91+
multipart_chunksize=8 * MB,
92+
num_download_attempts=5,
93+
max_io_queue=100,
94+
io_chunksize=256 * KB,
95+
use_threads=True,
96+
max_bandwidth=1024 * KB,
97+
)
98+
assert config.multipart_threshold == 8 * MB
99+
assert config.multipart_chunksize == 8 * MB
100+
assert config.max_request_concurrency == 10
101+
assert config.num_download_attempts == 5
102+
assert config.max_io_queue_size == 100
103+
assert config.io_chunksize == 256 * KB
104+
assert config.use_threads is True
105+
assert config.max_bandwidth == 1024 * KB
106+
86107

87108
class TestProgressCallbackInvoker(unittest.TestCase):
88109
def test_on_progress(self):

tests/unit/test_session.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,17 @@ def test_get_available_regions(self):
207207
)
208208
assert partitions == ['foo']
209209

210+
def test_get_partition_for_region(self):
211+
bc_session = mock.Mock()
212+
bc_session.get_partition_for_region.return_value = 'baz'
213+
session = Session(botocore_session=bc_session)
214+
215+
partition = session.get_partition_for_region('foo-bar-1')
216+
bc_session.get_partition_for_region.assert_called_with(
217+
'foo-bar-1'
218+
)
219+
assert partition == 'baz'
220+
210221
def test_create_client(self):
211222
session = Session(region_name='us-east-1')
212223
client = session.client('sqs', region_name='us-west-2')

0 commit comments

Comments
 (0)