Skip to content

Commit 375b99b

Browse files
authored
add value/data/seq properties to message (#326)
* add value/data/seq properties to message * fix bug with transport type enum equality comparison * more updates to align with pyamqp * update history file and version * add tests * backcompat allow transport_type to be None in auth/common.set_io * update async client do_work to take kwargs * update value/seq props to return None if BatchMessage * drop 3.6 * run mac/linux/windows in parallel * add max parallel back in * list apps for xcode debugging purposes * fix macos ci * remove dependsOn in test pipeline * update xcode in test pipeline * tests yml - set maxParallel: 1 * make test pipeline jobs sequential again b/c of shared resources * update release date
1 parent 336ac45 commit 375b99b

File tree

12 files changed

+109
-58
lines changed

12 files changed

+109
-58
lines changed

.azure-pipelines/client.test.live.yml

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ trigger:
22
- master
33

44
variables:
5-
PythonVersion36: '3.6'
65
PythonVersion37: '3.7'
76
PythonVersion38: '3.8'
87
PythonVersion39: '3.9'
@@ -20,9 +19,6 @@ jobs:
2019
strategy:
2120
maxParallel: 1
2221
matrix:
23-
x64 Python 3.6:
24-
PythonArchitecture: 'x64'
25-
PythonVersion: '$(PythonVersion36)'
2622
x64 Python 3.7:
2723
PythonArchitecture: 'x64'
2824
PythonVersion: '$(PythonVersion37)'
@@ -35,9 +31,6 @@ jobs:
3531
x64 Python 3.10:
3632
PythonArchitecture: 'x64'
3733
PythonVersion: '$(PythonVersion310)'
38-
x86 Python 3.6:
39-
PythonArchitecture: 'x86'
40-
PythonVersion: '$(PythonVersion36)'
4134
x86 Python 3.7:
4235
PythonArchitecture: 'x86'
4336
PythonVersion: '$(PythonVersion37)'
@@ -108,19 +101,16 @@ jobs:
108101

109102
- job: 'MacOS'
110103

111-
dependsOn: 'Windows'
112-
113104
timeoutInMinutes: 120
114105

106+
dependsOn: 'Windows'
107+
115108
pool:
116-
vmImage: 'macOS-10.15'
109+
vmImage: 'macOS-11'
117110

118111
strategy:
119112
maxParallel: 1
120113
matrix:
121-
Python 3.6:
122-
PythonBin: 'python3'
123-
PythonVersion: '$(PythonVersion36)'
124114
Python 3.7:
125115
PythonBin: 'python3'
126116
PythonVersion: '$(PythonVersion37)'
@@ -137,7 +127,6 @@ jobs:
137127
variables:
138128
MacOSXDeploymentTarget: '10.9'
139129
OpenSSLDir: $(Agent.BuildDirectory)/openssl-macosx$(MacOSXDeploymentTarget)
140-
PythonVersion36: '3.6.8'
141130
PythonVersion37: '3.7.6'
142131
PythonVersion38: '3.8.2'
143132
PythonVersion39: '3.9.0'
@@ -154,8 +143,8 @@ jobs:
154143
pipeline: 119 # azure-uamqp-python - openssl
155144
project: '29ec6040-b234-4e31-b139-33dc4287b756' # public
156145

157-
- script: sudo xcode-select --switch /Applications/Xcode_11.3.1.app
158-
displayName: 'Select Xcode 11.3.1'
146+
- script: sudo xcode-select --switch /Applications/Xcode_13.1.app
147+
displayName: 'Select Xcode 13.1'
159148

160149
- script: source ./install_python_osx.sh
161150
displayName: 'Install Official Python'
@@ -234,8 +223,6 @@ jobs:
234223
strategy:
235224
maxParallel: 1
236225
matrix:
237-
Python 3.6:
238-
PythonVersion: '$(PythonVersion36)'
239226
Python 3.7:
240227
PythonVersion: '$(PythonVersion37)'
241228
Python 3.8:
@@ -332,25 +319,25 @@ jobs:
332319
versionSpec: '$(PythonVersion)'
333320
- template: /.azure-pipelines/test-eh-sb-sdk.yml
334321

335-
- job: 'SDK_LiveTest_macOS1015_36'
322+
- job: 'SDK_LiveTest_macOS1015_38'
336323
timeoutInMinutes: 300
337324
dependsOn: 'MacOS'
338325
pool:
339326
name: 'Azure Pipelines'
340-
vmImage: 'macOS-10.15'
327+
vmImage: 'macOS-11'
341328
strategy:
342329
matrix:
343-
EventHub Python 3.6:
330+
EventHub Python 3.8:
344331
SDK: 'EventHub'
345-
ServiceBus Python 3.6:
332+
ServiceBus Python 3.8:
346333
SDK: 'ServiceBus'
347334
variables:
348335
PythonBin: 'python3'
349-
PythonVersion: '$(PythonVersion36)'
336+
PythonVersion: '$(PythonVersion38)'
350337
MacOSXDeploymentTarget: '10.9'
351-
PythonVersion368: '3.6.8'
338+
PythonVersion382: '3.8.2'
352339
OSArch: 'MacOS'
353-
DownloadArtifactFolder: 'uamqp-macosx$(MacOSXDeploymentTarget)-$(PythonVersion368)-whl'
340+
DownloadArtifactFolder: 'uamqp-macosx$(MacOSXDeploymentTarget)-$(PythonVersion382)-whl'
354341
steps:
355342
- template: /.azure-pipelines/use-python-version.yml
356343
parameters:

.azure-pipelines/client.yml

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ trigger:
22
- master
33

44
variables:
5-
PythonVersion36: '3.6'
65
PythonVersion37: '3.7'
76
PythonVersion38: '3.8'
87
PythonVersion39: '3.9'
@@ -47,13 +46,10 @@ jobs:
4746
- job: 'MacOS'
4847

4948
pool:
50-
vmImage: 'macOS-10.15'
49+
vmImage: 'macOS-11'
5150

5251
strategy:
5352
matrix:
54-
Python 3.6:
55-
PythonBin: 'python3'
56-
PythonVersion: '$(PythonVersion36)'
5753
Python 3.7:
5854
PythonBin: 'python3'
5955
PythonVersion: '$(PythonVersion37)'
@@ -70,7 +66,6 @@ jobs:
7066
variables:
7167
MacOSXDeploymentTarget: '10.9'
7268
OpenSSLDir: $(Agent.BuildDirectory)/openssl-macosx$(MacOSXDeploymentTarget)
73-
PythonVersion36: '3.6.8'
7469
PythonVersion37: '3.7.6'
7570
PythonVersion38: '3.8.2'
7671
PythonVersion39: '3.9.0'
@@ -87,8 +82,11 @@ jobs:
8782
pipeline: 119 # azure-uamqp-python - openssl
8883
project: '29ec6040-b234-4e31-b139-33dc4287b756' # public
8984

90-
- script: sudo xcode-select --switch /Applications/Xcode_11.3.1.app
91-
displayName: 'Select Xcode 11.3.1'
85+
- script: sudo ls /Applications/
86+
displayName: 'List All apps'
87+
88+
- script: sudo xcode-select --switch /Applications/Xcode_13.1.app
89+
displayName: 'Select Xcode 13.1'
9290

9391
- script: source ./install_python_osx.sh
9492
displayName: 'Install Official Python'
@@ -151,9 +149,6 @@ jobs:
151149

152150
strategy:
153151
matrix:
154-
x64 Python 3.6:
155-
PythonArchitecture: 'x64'
156-
PythonVersion: '$(PythonVersion36)'
157152
x64 Python 3.7:
158153
PythonArchitecture: 'x64'
159154
PythonVersion: '$(PythonVersion37)'
@@ -166,9 +161,6 @@ jobs:
166161
x64 Python 3.10:
167162
PythonArchitecture: 'x64'
168163
PythonVersion: '$(PythonVersion310)'
169-
x86 Python 3.6:
170-
PythonArchitecture: 'x86'
171-
PythonVersion: '$(PythonVersion36)'
172164
x86 Python 3.7:
173165
PythonArchitecture: 'x86'
174166
PythonVersion: '$(PythonVersion37)'
@@ -233,8 +225,6 @@ jobs:
233225

234226
strategy:
235227
matrix:
236-
Python 3.6:
237-
PythonVersion: '$(PythonVersion36)'
238228
Python 3.7:
239229
PythonVersion: '$(PythonVersion37)'
240230
Python 3.8:
@@ -298,10 +288,6 @@ jobs:
298288

299289
strategy:
300290
matrix:
301-
Python36m-manylinux1:
302-
ContainerImage: 'manylinux_crypto_x64'
303-
PythonVersion: 'cp36-cp36m'
304-
Platform: 'manylinux1_x86_64'
305291
Python37m-manylinux1:
306292
ContainerImage: 'manylinux_crypto_x64'
307293
PythonVersion: 'cp37-cp37m'
@@ -314,10 +300,6 @@ jobs:
314300
ContainerImage: 'manylinux_crypto_x64'
315301
PythonVersion: 'cp39-cp39'
316302
Platform: 'manylinux1_x86_64'
317-
Python36m-manylinux2010:
318-
ContainerImage: 'manylinux2010_crypto_x64'
319-
PythonVersion: 'cp36-cp36m'
320-
Platform: 'manylinux2010_x86_64'
321303
Python37m-manylinux2010:
322304
ContainerImage: 'manylinux2010_crypto_x64'
323305
PythonVersion: 'cp37-cp37m'

HISTORY.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@
33
Release History
44
===============
55

6+
1.6.0 (2022-08-18)
7+
+++++++++++++++++++
8+
9+
This version and all future versions will require Python 3.7+, Python 3.6 is no longer supported.
10+
11+
- Added `data`, `value`, `sequence` properties to `uamqp.Message`, which return the body if the body type corresponds.
12+
- Added `message_annotations` property to `uamqp.Message`, which is an alias for the `annotations` instance variable.
13+
- Added `data` property to `uamqp.BatchMessage`, which returns the iterable body of the batch.
14+
- Added `ttl` property to `uamqp.MessageHeader`, which is an alias for the `time_to_live` instance variable.
15+
616
1.5.3 (2022-03-23)
717
+++++++++++++++++++
818

dev_requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ cython==0.29.21
22
setuptools>=27.1.2
33
wheel>=0.32.0
44
pytest==6.2.4; python_version >= '3.10'
5-
pytest==5.4.1; python_version >= '3.6' and python_version < '3.10'
6-
pytest-asyncio==0.12.0; python_version >= '3.6'
5+
pytest==5.4.1; python_version >= '3.7' and python_version < '3.10'
6+
pytest-asyncio==0.12.0; python_version >= '3.7'
77
docutils>=0.14
88
pygments>=2.2.0
9-
pylint==2.3.1; python_version >= '3.6'
9+
pylint==2.3.1; python_version >= '3.7'

setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,6 @@ def build_cmake(self, ext):
272272
'Programming Language :: Python',
273273
'Programming Language :: Python :: 3 :: Only',
274274
'Programming Language :: Python :: 3',
275-
'Programming Language :: Python :: 3.6',
276275
'Programming Language :: Python :: 3.7',
277276
'Programming Language :: Python :: 3.8',
278277
'Programming Language :: Python :: 3.9',
@@ -290,5 +289,5 @@ def build_cmake(self, ext):
290289
cmdclass={
291290
'build_ext': build_ext,
292291
},
293-
python_requires=">=3.6",
292+
python_requires=">=3.7",
294293
)

tests/test_client.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,6 @@ def hack_open(ins):
3030
assert type(exc) == RuntimeError
3131
client.close()
3232
assert not client._keep_alive_thread
33+
34+
# check that kwargs can be passed to client.do_work
35+
client.do_work(fake_kwarg="ignore")

tests/test_message.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,13 +200,18 @@ def test_deepcopy_batch_message():
200200
batch_message = list(message_batch._body_gen)[0]
201201
batch_copy_message = list(message_batch_copy._body_gen)[0]
202202
assert len(list(message_batch._body_gen)) == len(list(message_batch_copy._body_gen))
203+
assert len(list(message_batch.data)) == len(list(message_batch_copy._body_gen))
204+
assert list(list(message_batch.data)[0].data) == list(list(message_batch_copy._body_gen)[0].data)
205+
assert message_batch.value is None
206+
assert message_batch.sequence is None
203207

204208
# check message attributes are equal to deepcopied message attributes
205209
assert list(batch_message.get_data()) == list(batch_copy_message.get_data())
206210
assert batch_message.footer == batch_copy_message.footer
207211
assert batch_message.state == batch_copy_message.state
208212
assert batch_message.application_properties == batch_copy_message.application_properties
209213
assert batch_message.annotations == batch_copy_message.annotations
214+
assert batch_message.annotations == batch_copy_message.message_annotations
210215
assert batch_message.delivery_annotations == batch_copy_message.delivery_annotations
211216
assert batch_message.settled == batch_copy_message.settled
212217
assert batch_message.properties.message_id == batch_copy_message.properties.message_id
@@ -224,6 +229,7 @@ def test_deepcopy_batch_message():
224229
assert batch_message.properties.reply_to_group_id == batch_copy_message.properties.reply_to_group_id
225230
assert batch_message.header.delivery_count == batch_copy_message.header.delivery_count
226231
assert batch_message.header.time_to_live == batch_copy_message.header.time_to_live
232+
assert batch_message.header.ttl == batch_copy_message.header.time_to_live
227233
assert batch_message.header.first_acquirer == batch_copy_message.header.first_acquirer
228234
assert batch_message.header.durable == batch_copy_message.header.durable
229235
assert batch_message.header.priority == batch_copy_message.header.priority
@@ -285,6 +291,9 @@ def test_message_body_data_type():
285291
assert check_list[0] == multiple_data[0]
286292
assert check_list[1] == multiple_data[1].encode("UTF-8")
287293
assert str(multiple_data_message)
294+
assert list(multiple_data_message.data) == list(multiple_data_message.get_data())
295+
assert multiple_data_message.value is None
296+
assert multiple_data_message.sequence is None
288297

289298
with pytest.raises(TypeError):
290299
Message(body={"key": "value"}, body_type=MessageBodyType.Data)
@@ -324,6 +333,10 @@ def test_message_body_value_type():
324333
assert isinstance(string_value_message._body, ValueBody)
325334
assert str(compound_list_value_message)
326335

336+
assert compound_list_value_message.value == compound_list_value_message.get_data()
337+
assert compound_list_value_message.data is None
338+
assert compound_list_value_message.sequence is None
339+
327340

328341
def test_message_body_sequence_type():
329342

@@ -343,6 +356,9 @@ def test_message_body_sequence_type():
343356
assert check_list[0] == multiple_lists[0]
344357
assert check_list[1] == multiple_lists[1]
345358
assert str(multiple_lists_message)
359+
assert list(multiple_lists_message.sequence) == list(multiple_lists_message.get_data())
360+
assert multiple_lists_message.value is None
361+
assert multiple_lists_message.data is None
346362

347363
with pytest.raises(TypeError):
348364
Message(body={"key": "value"}, body_type=MessageBodyType.Sequence)

uamqp/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
pass # Async not supported.
3636

3737

38-
__version__ = "1.5.3"
38+
__version__ = "1.6.0"
3939

4040

4141
_logger = logging.getLogger(__name__)

uamqp/async_ops/client_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ async def client_ready_async(self):
360360
return False
361361
return True
362362

363-
async def do_work_async(self):
363+
async def do_work_async(self, **kwargs): # pylint: disable=unused-argument
364364
"""Run a single connection iteration asynchronously.
365365
This will return `True` if the connection is still open
366366
and ready to be used for further work, or `False` if it needs

uamqp/authentication/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def _encode(self, value):
6666
return value.encode(self._encoding) if isinstance(value, six.text_type) else value
6767

6868
def set_io(self, hostname, port, http_proxy, transport_type):
69-
if transport_type == TransportType.AmqpOverWebsocket or http_proxy is not None:
69+
if transport_type and transport_type.value == TransportType.AmqpOverWebsocket.value or http_proxy is not None:
7070
self.set_wsio(hostname, port or constants.DEFAULT_AMQP_WSS_PORT, http_proxy)
7171
else:
7272
self.set_tlsio(hostname, port or constants.DEFAULT_AMQPS_PORT)

0 commit comments

Comments
 (0)