Modernize Python version support and replace deprecated uamqp with vendored pyamqp - #19
Modernize Python version support and replace deprecated uamqp with vendored pyamqp#19ethanann-ms wants to merge 3 commits into
Conversation
Prep work for replacing the deprecated uamqp library with a vendored pyamqp. These changes are safe standalone — the actual uamqp → pyamqp swap follows in a subsequent commit. - setup.py: bump python_requires to >=3.8, drop Py2/3.5/3.6/3.7 classifiers, add 3.11/3.12, drop the io.open shim - setup.cfg: remove universal wheel flag (no longer Py2 compatible) - sastoken.py, iothub_amqp_client.py: replace six.moves.urllib with stdlib urllib.parse
Vendors azure-servicebus._pyamqp (sync subset) into src/azure/iot/hub/_pyamqp/ and rewrites the C2D AMQP client against it. Public API (IoTHubRegistryManager, send_c2d_message, TransportType) is unchanged; TransportType is now re-exported from azure.iot.hub. Vendored from Azure/azure-sdk-for-python@42f5959 (see src/azure/iot/hub/_pyamqp/VENDOR.md).
|
I came here to say thanks for taking care of this. I'm currently stuck, being unable to use azure-iot-hub-python client libraries due to this dependency to outdated uamqp implementation. Hoping it will find its way into a release soon. |
| :param transport_type: The underlying transport protocol type: Amqp: AMQP over the default TCP transport protocol, it uses port 5671. AmqpOverWebsocket: Amqp over the Web Sockets transport protocol, it uses port 443. | ||
| Default value: Amqp | ||
| :type transport_type: :class:`uamqp.TransportType` | ||
| :type transport_type: :class:`azure.iot.hub.TransportType` |
There was a problem hiding this comment.
Interesting question as to if this makes it a breaking change - really, TransportType should have been exported before, but wasn't, so now you're doing the right thing, but it does cause breakage for existing users who were directly referencing uamqp (which never should have been happening).
I mean, yeah, I guess that does make it breaking, but nothing to be done about it I suppose. I guess this means any other breaking changes can be made now though, if you've got any you want to make.
| condition=ErrorCondition.UnknownError, description="fake failure" | ||
| ) | ||
| with pytest.raises(Exception): | ||
| with pytest.raises(Exception, match="C2D message send failure"): |
There was a problem hiding this comment.
Existing problem, but you probably want to specify the type of Exception raised here, catching Exception generally is a recipe for a false positive that can hide bugs, and is a bad practice, especially in tests.
| fake_hostname, fake_shared_access_key_name, fake_shared_access_key | ||
| ) | ||
| get_token = amqp_token_init_mock.call_args[0][2] | ||
| get_token() |
There was a problem hiding this comment.
I'm confused about what's being tested here if you're now calling this here.
- Add Python 3.13 and 3.14 classifiers. - Use explicit keyword arguments when constructing JWTTokenAuth and SendClient for resilience against upstream signature changes. - Introduce C2DMessageSendError and tighten the send-failure test to assert on the specific type instead of bare Exception. - Rename and reword the HMAC test to clarify that pyamqp resolves tokens lazily, so the captured get_token callback must be invoked to drive the SAS-signing path.
No description provided.