Skip to content

Commit

Permalink
Removed 3.6 infrastructure
Browse files Browse the repository at this point in the history
  • Loading branch information
cartertinney committed Feb 8, 2024
1 parent 62690bd commit 071eeff
Show file tree
Hide file tree
Showing 33 changed files with 7 additions and 364 deletions.
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, 3.7, 3.6
# [Choice] Python version: 3, 3.9, 3.8, 3.7
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.6, 3.7, 3.8, 3.9
// Update 'VARIANT' to pick a Python version: 3, 3.7, 3.8, 3.9
"VARIANT": "3",
// Options
"NODE_VERSION": "lts/*"
Expand Down
6 changes: 3 additions & 3 deletions azure-iot-device/azure/iot/device/common/async_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
# --------------------------------------------------------------------------
"""This module contains tools for adapting sync code for use in async coroutines."""

import asyncio
import functools
import logging
import traceback
import azure.iot.device.common.asyncio_compat as asyncio_compat

logger = logging.getLogger(__name__)

Expand All @@ -25,7 +25,7 @@ def emulate_async(fn):

@functools.wraps(fn)
async def async_fn_wrapper(*args, **kwargs):
loop = asyncio_compat.get_running_loop()
loop = asyncio.get_running_loop()

# Run fn in default ThreadPoolExecutor (CPU * 5 threads)
return await loop.run_in_executor(None, functools.partial(fn, *args, **kwargs))
Expand All @@ -44,7 +44,7 @@ def __init__(self, return_arg_name=None):
if return_arg_name and not isinstance(return_arg_name, str):
raise TypeError("internal error: return_arg_name must be a string")

loop = asyncio_compat.get_running_loop()
loop = asyncio.get_running_loop()
self.future = loop.create_future()

def wrapping_callback(*args, **kwargs):
Expand Down
61 changes: 0 additions & 61 deletions azure-iot-device/azure/iot/device/common/asyncio_compat.py

This file was deleted.

1 change: 0 additions & 1 deletion requirements_test.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
pytest
pytest-mock
pytest-asyncio <= 0.16 # Can remove this once Python 3.6 support is dropped
pytest-testdox>=1.1.1
pytest-cov
pytest-timeout
Expand Down
11 changes: 0 additions & 11 deletions samples/async-edge-scenarios/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,6 @@ This directory contains samples showing how to use the various features of Azure

**Please note** that IoT Edge solutions are scoped to Linux containers and devices, documented [here](https://docs.microsoft.com/en-us/azure/iot-edge/tutorial-python-module#solution-scope). Please see [this blog post](https://techcommunity.microsoft.com/t5/internet-of-things/linux-modules-with-azure-iot-edge-on-windows-10-iot-enterprise/ba-p/1407066) to learn more about using Linux containers for IoT Edge on Windows devices.

**These samples are written to run in Python 3.7+**, but can be made to work with Python 3.6 with a slight modification as noted in each sample:

```python
if __name__ == "__main__":
asyncio.run(main())

# If using Python 3.6 use the following code instead of asyncio.run(main()):
# loop = asyncio.get_event_loop()
# loop.run_until_complete(main())
# loop.close()
```

In order to use these samples, they **must** be run from inside an Edge container.

Expand Down
5 changes: 0 additions & 5 deletions samples/async-edge-scenarios/invoke_method_on_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,3 @@ async def main():

if __name__ == "__main__":
asyncio.run(main())

# If using Python 3.6 use the following code instead of asyncio.run(main()):
# loop = asyncio.get_event_loop()
# loop.run_until_complete(main())
# loop.close()
5 changes: 0 additions & 5 deletions samples/async-edge-scenarios/send_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,3 @@ async def send_test_message(i):

if __name__ == "__main__":
asyncio.run(main())

# If using Python 3.6 use the following code instead of asyncio.run(main()):
# loop = asyncio.get_event_loop()
# loop.run_until_complete(main())
# loop.close()
5 changes: 0 additions & 5 deletions samples/async-edge-scenarios/send_message_downstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,3 @@ async def send_test_message(i):

if __name__ == "__main__":
asyncio.run(main())

# If using Python 3.6 use the following code instead of asyncio.run(main()):
# loop = asyncio.get_event_loop()
# loop.run_until_complete(main())
# loop.close()
5 changes: 0 additions & 5 deletions samples/async-edge-scenarios/send_message_to_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,3 @@ async def send_test_message(i):

if __name__ == "__main__":
asyncio.run(main())

# If using Python 3.6 use the following code instead of asyncio.run(main()):
# loop = asyncio.get_event_loop()
# loop.run_until_complete(main())
# loop.close()
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,3 @@ async def main():

if __name__ == "__main__":
asyncio.run(main())

# If using Python 3.6 use the following code instead of asyncio.run(main()):
# loop = asyncio.get_event_loop()
# loop.run_until_complete(main())
# loop.close()
11 changes: 0 additions & 11 deletions samples/async-hub-scenarios/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,6 @@

This directory contains samples showing how to use the various features of Azure IoT Hub Device SDK with the Azure IoT Hub.

**These samples are written to run in Python 3.7+**, but can be made to work with Python 3.6 with a slight modification as noted in each sample:

```python
if __name__ == "__main__":
asyncio.run(main())

# If using Python 3.6 use the following code instead of asyncio.run(main()):
# loop = asyncio.get_event_loop()
# loop.run_until_complete(main())
# loop.close()
```

## Included Samples

Expand Down
5 changes: 0 additions & 5 deletions samples/async-hub-scenarios/get_twin.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,3 @@ async def main():

if __name__ == "__main__":
asyncio.run(main())

# If using Python 3.6 use the following code instead of asyncio.run(main()):
# loop = asyncio.get_event_loop()
# loop.run_until_complete(main())
# loop.close()
5 changes: 0 additions & 5 deletions samples/async-hub-scenarios/provision_symmetric_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,3 @@ async def send_test_message(i):

if __name__ == "__main__":
asyncio.run(main())

# If using Python 3.6 use the following code instead of asyncio.run(main()):
# loop = asyncio.get_event_loop()
# loop.run_until_complete(main())
# loop.close()
5 changes: 0 additions & 5 deletions samples/async-hub-scenarios/provision_symmetric_key_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,3 @@ async def register_device(registration_id):

if __name__ == "__main__":
asyncio.run(main())

# If using Python 3.6 use the following code instead of asyncio.run(main()):
# loop = asyncio.get_event_loop()
# loop.run_until_complete(main())
# loop.close()
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,3 @@ async def send_test_message(i):

if __name__ == "__main__":
asyncio.run(main())

# If using Python 3.6 use the following code instead of asyncio.run(main()):
# loop = asyncio.get_event_loop()
# loop.run_until_complete(main())
# loop.close()
5 changes: 0 additions & 5 deletions samples/async-hub-scenarios/provision_x509.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,3 @@ async def send_test_message(i):

if __name__ == "__main__":
asyncio.run(main())

# If using Python 3.6 use the following code instead of asyncio.run(main()):
# loop = asyncio.get_event_loop()
# loop.run_until_complete(main())
# loop.close()
5 changes: 0 additions & 5 deletions samples/async-hub-scenarios/receive_direct_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,3 @@ def stdin_listener():

if __name__ == "__main__":
asyncio.run(main())

# If using Python 3.6 use the following code instead of asyncio.run(main()):
# loop = asyncio.get_event_loop()
# loop.run_until_complete(main())
# loop.close()
5 changes: 0 additions & 5 deletions samples/async-hub-scenarios/receive_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,3 @@ def stdin_listener():

if __name__ == "__main__":
asyncio.run(main())

# If using Python 3.6 use the following code instead of asyncio.run(main()):
# loop = asyncio.get_event_loop()
# loop.run_until_complete(main())
# loop.close()
5 changes: 0 additions & 5 deletions samples/async-hub-scenarios/receive_message_x509.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,3 @@ def stdin_listener():

if __name__ == "__main__":
asyncio.run(main())

# If using Python 3.6 use the following code instead of asyncio.run(main()):
# loop = asyncio.get_event_loop()
# loop.run_until_complete(main())
# loop.close()
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,3 @@ def stdin_listener():

if __name__ == "__main__":
asyncio.run(main())

# If using Python 3.6 use the following code instead of asyncio.run(main()):
# loop = asyncio.get_event_loop()
# loop.run_until_complete(main())
# loop.close()
5 changes: 0 additions & 5 deletions samples/async-hub-scenarios/send_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,3 @@ async def send_test_message(i):

if __name__ == "__main__":
asyncio.run(main())

# If using Python 3.6 use the following code instead of asyncio.run(main()):
# loop = asyncio.get_event_loop()
# loop.run_until_complete(main())
# loop.close()
5 changes: 0 additions & 5 deletions samples/async-hub-scenarios/send_message_over_websockets.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,3 @@ async def main():

if __name__ == "__main__":
asyncio.run(main())

# If using Python 3.6 use the following code instead of asyncio.run(main()):
# loop = asyncio.get_event_loop()
# loop.run_until_complete(main())
# loop.close()
5 changes: 0 additions & 5 deletions samples/async-hub-scenarios/send_message_via_module_x509.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,3 @@ async def send_test_message(i):

if __name__ == "__main__":
asyncio.run(main())

# If using Python 3.6 use the following code instead of asyncio.run(main()):
# loop = asyncio.get_event_loop()
# loop.run_until_complete(main())
# loop.close()
5 changes: 0 additions & 5 deletions samples/async-hub-scenarios/send_message_via_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,3 @@ async def send_test_message(i):

if __name__ == "__main__":
asyncio.run(main())

# If using Python 3.6 use the following code instead of asyncio.run(main()):
# loop = asyncio.get_event_loop()
# loop.run_until_complete(main())
# loop.close()
5 changes: 0 additions & 5 deletions samples/async-hub-scenarios/send_message_x509.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,3 @@ async def send_test_message(i):

if __name__ == "__main__":
asyncio.run(main())

# If using Python 3.6 use the following code instead of asyncio.run(main()):
# loop = asyncio.get_event_loop()
# loop.run_until_complete(main())
# loop.close()
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,3 @@ async def main():

if __name__ == "__main__":
asyncio.run(main())

# If using Python 3.6 use the following code instead of asyncio.run(main()):
# loop = asyncio.get_event_loop()
# loop.run_until_complete(main())
# loop.close()
5 changes: 0 additions & 5 deletions samples/async-hub-scenarios/use_custom_sastoken.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,3 @@ def stdin_listener():

if __name__ == "__main__":
asyncio.run(main())

# If using Python 3.6 use the following code instead of asyncio.run(main()):
# loop = asyncio.get_event_loop()
# loop.run_until_complete(main())
# loop.close()
5 changes: 0 additions & 5 deletions samples/pnp/simple_thermostat.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,3 @@ async def send_telemetry():

if __name__ == "__main__":
asyncio.run(main())

# If using Python 3.6 use the following code instead of asyncio.run(main()):
# loop = asyncio.get_event_loop()
# loop.run_until_complete(main())
# loop.close()
5 changes: 0 additions & 5 deletions samples/pnp/temp_controller_with_thermostats.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,3 @@ async def send_telemetry():

if __name__ == "__main__":
asyncio.run(main())

# If using Python 3.6 use the following code instead of asyncio.run(main()):
# loop = asyncio.get_event_loop()
# loop.run_until_complete(main())
# loop.close()
5 changes: 0 additions & 5 deletions samples/simple_send_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,3 @@ async def main():

if __name__ == "__main__":
asyncio.run(main())

# If using Python 3.6 use the following code instead of asyncio.run(main()):
# loop = asyncio.get_event_loop()
# loop.run_until_complete(main())
# loop.close()
Loading

0 comments on commit 071eeff

Please sign in to comment.