Skip to content
Draft
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
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.192.0/containers/python-3/.devcontainer/base.Dockerfile

# [Choice] Python version: 3, 3.9, 3.8
# [Choice] Python version: 3, 3.9,
ARG VARIANT="3.9"
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}

Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dockerfile": "Dockerfile",
"context": "..",
"args": {
// Update 'VARIANT' to pick a Python version: 3, 3.8, 3.9
// Update 'VARIANT' to pick a Python version: 3, 3.9
"VARIANT": "3",
// Options
"NODE_VERSION": "lts/*"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The Azure IoT Device library is available on PyPI:
pip install azure-iot-device
```

Python 3.8 or higher is required in order to use the library
Python 3.9 or higher is required in order to use the library

## Using the library
API documentation for this package is available via [**Microsoft Docs**](https://docs.microsoft.com/python/api/azure-iot-device/azure.iot.device?view=azure-python).
Expand Down
6 changes: 5 additions & 1 deletion azure-iot-device/azure/iot/device/common/mqtt_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ def _create_mqtt_client(self):
if self._websockets:
logger.info("Creating client for connecting using MQTT over websockets")
mqtt_client = mqtt.Client(
callback_api_version=mqtt.CallbackAPIVersion.VERSION1,
client_id=self._client_id,
clean_session=False,
protocol=mqtt.MQTTv311,
Expand All @@ -149,7 +150,10 @@ def _create_mqtt_client(self):
else:
logger.info("Creating client for connecting using MQTT over TCP")
mqtt_client = mqtt.Client(
client_id=self._client_id, clean_session=False, protocol=mqtt.MQTTv311
callback_api_version=mqtt.CallbackAPIVersion.VERSION1,
client_id=self._client_id,
clean_session=False,
protocol=mqtt.MQTTv311,
)

if self._proxy_options:
Expand Down
2 changes: 0 additions & 2 deletions samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ This directory contains samples showing how to use the various features of the M

## Quick Start - Simple Telemetry Sample (send message)

**Note that this sample is configured for Python 3.8+.** To ensure that your Python version is up to date, run `python --version`. If you have both Python 2 and Python 3 installed (and are using a Python 3 environment for this SDK), then install all libraries using `pip3` as opposed to `pip`. This ensures that the libraries are installed to your Python 3 runtime.

1. Install the [Azure CLI](https://docs.microsoft.com/cli/azure/install-azure-cli?view=azure-cli-latest) (or use the [Azure Cloud Shell](https://shell.azure.com/)) and use it to [create an Azure IoT Hub](https://docs.microsoft.com/cli/azure/iot/hub?view=azure-cli-latest#az_iot_hub_create).

```bash
Expand Down
2 changes: 1 addition & 1 deletion scripts/configure-virtual-environments.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

script_dir=$(cd "$(dirname "$0")" && pwd)

export RUNTIMES_TO_INSTALL="3.8.10 3.9.9 3.10.2"
export RUNTIMES_TO_INSTALL="3.9.9 3.10.2"

echo "This script will do the following:"
echo "1. Use apt to install pre-requisites for pyenv"
Expand Down
11 changes: 3 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,26 +65,21 @@
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"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",
],
install_requires=[
# Define sub-dependencies due to pip dependency resolution bug
# https://github.com/pypa/pip/issues/988
"urllib3>=2.2.2,<3.0.0",
# Actual project dependencies
"deprecation>=2.1.0,<3.0.0",
"paho-mqtt>=1.6.1,<2.0.0",
"paho-mqtt>=2.0.0,<3.0.0",
"requests>=2.32.3,<3.0.0",
"requests-unixsocket2>=0.4.1",
"requests-unixsocket>=0.4.1,<1.0.0",
"janus",
"PySocks",
"typing_extensions",
],
python_requires=">=3.8, <4",
python_requires=">=3.9, <4",
packages=find_namespace_packages(where="azure-iot-device"),
package_data={"azure.iot.device": ["py.typed"]},
package_dir={"": "azure-iot-device"},
Expand Down
6 changes: 5 additions & 1 deletion tests/unit/common/test_mqtt_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,10 @@ def test_instantiates_mqtt_client(self, mocker):

assert mock_mqtt_client_constructor.call_count == 1
assert mock_mqtt_client_constructor.call_args == mocker.call(
client_id=fake_device_id, clean_session=False, protocol=mqtt.MQTTv311
callback_api_version=mqtt.CallbackAPIVersion.VERSION1,
client_id=fake_device_id,
clean_session=False,
protocol=mqtt.MQTTv311,
)

@pytest.mark.it(
Expand All @@ -221,6 +224,7 @@ def test_configures_mqtt_websockets(self, mocker):

assert mock_mqtt_client_constructor.call_count == 1
assert mock_mqtt_client_constructor.call_args == mocker.call(
callback_api_version=mqtt.CallbackAPIVersion.VERSION1,
client_id=fake_device_id,
clean_session=False,
protocol=mqtt.MQTTv311,
Expand Down
2 changes: 1 addition & 1 deletion vsts/dps-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ stages:
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.8'
versionSpec: '3.9'
architecture: 'x64'

- script: 'python scripts/env_setup.py --no_dev'
Expand Down
8 changes: 4 additions & 4 deletions vsts/python-canary.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ jobs:
transport: 'mqttws'
imageName: 'windows-latest'
consumerGroup: 'cg2'
py38_linux_mqttws:
pv: '3.8'
py39_linux_mqttws:
pv: '3.9'
transport: 'mqttws'
imageName: 'Ubuntu 20.04'
consumerGroup: 'cg4'
py38_linux_mqtt:
pv: '3.8'
py39_linux_mqtt:
pv: '3.9'
transport: 'mqtt'
imageName: 'Ubuntu 20.04'
consumerGroup: 'cg5'
Expand Down
2 changes: 1 addition & 1 deletion vsts/python-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ stages:

strategy:
matrix:
py38_mqtt: { pv: '3.8', transport: 'mqtt', consumer_group: 'cg1' }
py39_mqtt: { pv: '3.9', transport: 'mqtt', consumer_group: 'cg1' }
py312_mqttws: { pv: '3.12', transport: 'mqttws', consumer_group: 'cg2' }

steps:
Expand Down
Loading