Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

import os
import msrest
from azure.iot.hub import IoTHubRegistryManager
from uamqp import TransportType
from azure.iot.hub import IoTHubRegistryManager, TransportType

connection_str = os.getenv("IOTHUB_CONNECTION_STRING")
device_id = os.getenv("IOTHUB_DEVICE_ID")
Expand Down
7 changes: 0 additions & 7 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,3 @@
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#--------------------------------------------------------------------------

[bdist_wheel]
# This flag says to generate wheels that support both Python 2 and Python
# 3. If your code will not run unchanged on both Python 2 and 3, you will
# need to generate separate wheels for each Python version that you
# support.
universal=1
18 changes: 9 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# --------------------------------------------------------------------------

from setuptools import setup, find_packages
from io import open # io.open needed for Python 2 compat
import re

# azure v0.x is not compatible with this package
Expand Down Expand Up @@ -64,23 +63,24 @@
"Topic :: Software Development :: Libraries :: Python Modules",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
Comment thread
cartertinney marked this conversation as resolved.
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
],
install_requires=[
"msrest>=0.6.21,<1.0.0",
# NOTE: Python 2.7, 3.5 support dropped >= 1.4.0
"uamqp>=1.2.14,<2.0.0",
"azure-core>=1.10.0,<2.0.0",
# Runtime dependencies of the vendored pyamqp (see src/azure/iot/hub/_pyamqp/VENDOR.md).
"certifi>=2017.4.17",
"typing_extensions>=4.0.1",
"websocket-client>=1.0.0",
],
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4",
python_requires=">=3.8",
packages=find_packages(
where="src",
exclude=[
Expand Down
2 changes: 2 additions & 0 deletions src/azure/iot/hub/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
from .iothub_job_manager import IoTHubJobManager
from .iothub_http_runtime_manager import IoTHubHttpRuntimeManager
from .digital_twin_client import DigitalTwinClient
from ._pyamqp.constants import TransportType

__all__ = [
"IoTHubRegistryManager",
"IoTHubConfigurationManager",
"IoTHubJobManager",
"IoTHubHttpRuntimeManager",
"DigitalTwinClient",
"TransportType",
]
54 changes: 54 additions & 0 deletions src/azure/iot/hub/_pyamqp/VENDOR.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Vendored `pyamqp`

This directory contains a vendored copy of the pure-Python AMQP implementation
that ships privately as `azure.servicebus._pyamqp` in the
[`Azure/azure-sdk-for-python`](https://github.com/Azure/azure-sdk-for-python)
repository.

`pyamqp` is not published as a standalone PyPI package; vendoring is the
supported way to consume it from outside the SDKs that ship it.

## Provenance

- **Upstream repo:** https://github.com/Azure/azure-sdk-for-python
- **Upstream path:** `sdk/servicebus/azure-servicebus/azure/servicebus/_pyamqp/`
- **Pinned commit:** `42f59593caec801dabfe3d222ddb8561b46b5e72` (tip of `main` at time of fetch)
- **Date copied:** 2026-07-22

## Local modifications

The vendored tree is otherwise byte-identical to upstream at the pinned commit,
with the following exceptions:

1. **`aio/` subtree removed.** This package only performs synchronous C2D
message sends; the async subtree carried a large maintenance surface and
required `asyncio` machinery unused by this SDK.
2. **`_message_backcompat.py` removed.** It was unreferenced by any code path
we import, and it was the only file with a cross-package reference
(`from ..amqp._amqp_message import ...`, guarded by `TYPE_CHECKING`) — a
dangling import that would surface under static analysis.

No source edits were made to the remaining files. Internal imports were already
relative (`from .foo import bar`), so no import rewrites were required.

## Why we vendor rather than depend

`pyamqp` lives at a private module path inside `azure-servicebus`
(`azure.servicebus._pyamqp`). Depending on a private module of another SDK is
brittle: upstream is free to reshape or rename it without notice. Vendoring
gives this package a stable, reviewable snapshot that upgrades happen on our
schedule.

## Refresh procedure

To refresh against a newer upstream commit:

1. Choose a target commit SHA on `Azure/azure-sdk-for-python` `main`.
2. Sparse-fetch `sdk/servicebus/azure-servicebus/azure/servicebus/_pyamqp/`
at that SHA.
3. Replace this directory's contents with the fetched tree.
4. Re-apply the two removals listed under **Local modifications** (`aio/` and
`_message_backcompat.py`).
5. Update the **Pinned commit** and **Date copied** fields above.
6. Run the test suite and the AMQP-over-WebSocket sample against a real
IoT Hub to confirm the refresh is safe.
21 changes: 21 additions & 0 deletions src/azure/iot/hub/_pyamqp/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# -------------------------------------------------------------------------

__version__ = "2.0.0a1"


from ._connection import Connection
from ._transport import SSLTransport

from .client import AMQPClient, ReceiveClient, SendClient

__all__ = [
"Connection",
"SSLTransport",
"AMQPClient",
"ReceiveClient",
"SendClient",
]
Loading