Code Monkey home page Code Monkey logo

azure-iot-sdk-python's Introduction

Microsoft Azure IoT SDKs for Python

Build Status

This repository contains the following:

  • Azure IoT Hub Device SDK for Python: to connect client devices to Azure IoT Hub
  • Azure IoT Hub Service SDK for Python: enables developing back-end applications for Azure IoT
  • Azure IoT Hub Provisioning Device SDK for Python: to connect client devices to Azure IoT Hub Provisioning Service
  • Azure IoT Hub Provisioning Service SDK for Python: enables developing back-end applications for Azure IoT Hub Provisioning Service

To create and manage an instance of IoT Hub in your Azure subscription using Python, you can use the Azure IoT Hub management library for Python. Read more here.

To manage all your Azure resources using Python, you can leverate the Azure CLI v2.

To find SDKs in other languages for Azure IoT, please refer to the azure-iot-sdks repository.

IMPORTANT INSTALLATION notes - Dealing with ImportError issues

The current version of the Azure IoT SDK for Python is a wrapper over our C SDK. It is generated using the Boost library. Because of that, it comes with several significant limitations:

  • Boost and other C dependencies should be installed on the system for the PIP package to work, or the SDK to be built.
  • Only a handful of "golden configurations" OS images are supported by the PIP package, because they have the right dependency tree:
    • Ubuntu 16:04 + Python 3.5 (or 2.7) + libboost-python-dev + libcurl4-openssl-dev + python3-dev (or python-dev for 2.7)
    • Windows 10: Python 3.6 corresponding to your CPU architecture (the default download on python.org is x86 and will not work if running on x64)
    • Raspbian Stretch: + Python 3.5 or 2.7 + libboost-python-dev + libcurl4-openssl-dev + python3-dev (or python-dev for 2.7)
    • Mac OS: Python 3.7.0 (or 2.7) + libboost-1.67 + curl 7.61.1 (all installed via homebrew) Any other distribution/OS probably embed different versions of boost & dependencies which won't work and will result in an ImportError at runtime.

The dockerfiles folder in this repository provides examples of configurations that successfully build the SDK or run the pip packages. We would absolutely welcome contributions to this folder to add more configurations.

my version is not in this list and I need support: you always have the option of rebuilding the sdk.

We are fully aware that this is a less than ideal situation and we are currently working on a full python implementation that will have the wide platform support that is expected of any respectable python library. While we intend to support this wrapper-based version of the SDK until the new one is full-featured, we will be deprecating it shortly thereafter. We will update this readme with the link to the new preview version when it is available.

Developing applications for Azure IoT

Visit Azure IoT Dev Center to learn more about developing applications for Azure IoT.

How to use the Azure IoT SDKs for Python

Devices and data sources in an IoT solution can range from a simple network-connected sensor to a powerful, standalone computing device. Devices may have limited processing capability, memory, communication bandwidth, and communication protocol support. The IoT device SDKs enable you to implement client applications for a wide variety of devices.

  • Using PyPI package on Windows, Linux (Ubuntu) or Raspberry Pi: the simplest way to use the Azure IoT SDK for Python to develop device apps on Windows is to leverage the PyPI package which you can install following these instructions.
  • Clone the repository: This repository uses GitHub Submodules for its dependencies. In order to automatically clone these submodules, you need to use the --recursive option as described here:
git clone --recursive https://github.com/Azure/azure-iot-sdk-python.git

If you have downloaded the zip instead of cloning the repository, you will need to run the following command to restore submodules:

git submodule update --init --recursive

Key features and roadmap

Device client SDK

✔️ feature available ✖️ feature planned but not supported ➖ no support planned

Features mqtt mqtt-ws amqp amqp-ws https Description
Authentication ✔️ ✔️* ✔️ ✔️* ✔️* Connect your device to IoT Hub securely with supported authentication, including private key, SASToken, X-509 Self Signed and Certificate Authority (CA) Signed. *IoT Hub only supports X-509 CA Signed over AMQP and MQTT at the moment.
Send device-to-cloud message ✔️* ✔️* ✔️* ✔️* ✔️* Send device-to-cloud messages (max 256KB) to IoT Hub with the option to add custom properties. IoT Hub only supports batch send over AMQP and HTTPS only at the moment. This SDK supports batch send over HTTP. * Batch send over AMQP and AMQP-WS, and add system properties on D2C messages are in progress.
Receive cloud-to-device messages ✔️* ✔️* ✔️ ✔️ ✔️ Receive cloud-to-device messages and read associated custom and system properties from IoT Hub, with the option to complete/reject/abandon C2D messages. *IoT Hub supports the option to complete/reject/abandon C2D messages over HTTPS and AMQP only at the moment.
Device Twins ✔️* ✔️* ✔️* ✔️* IoT Hub persists a device twin for each device that you connect to IoT Hub. The device can perform operations like get twin tags, subscribe to desired properties. *Send reported properties version and desired properties version are in progress.
Direct Methods ✔️ ✔️ ✔️ ✔️ IoT Hub gives you the ability to invoke direct methods on devices from the cloud. The SDK supports handler for method specific and generic operation.
Upload file to Blob ✔️ A device can initiate a file upload and notifies IoT Hub when the upload is complete. File upload requires HTTPS connection, but can be initiated from client using any protocol for other operations.
Connection Status and Error reporting ✔️* ✔️* ✔️* ✔️* ✖️ Error reporting for IoT Hub supported error code. *This SDK supports error reporting on authentication and Device Not Found.
Retry policies ✔️* ✔️* ✔️* ✔️* ✖️ Retry policy for unsuccessful device-to-cloud messages have two options: no try, exponential backoff with jitter (default). *Custom retry policy is in progress.
Devices multiplexing over single connection ✔️ ✔️ ✔️
Connection Pooling - Specifying number of connections ✖️ ✖️ ✖️

Service client SDK

✔️ feature available ✖️ feature planned but not supported ➖ no support planned

Features Python Description
Identity registry (CRUD) Use your backend app to perform CRUD operation for individual device or in bulk.
Cloud-to-device messaging ✔️ Use your backend app to send cloud-to-device messages in AMQP and AMQP-WS, and set up cloud-to-device message receivers.
Direct Methods operations ✔️ Use your backend app to invoke direct method on device.
Device Twins operations ✔️ Use your backend app to perform device twin operations. *Twin reported property update callback and replace twin are in progress.
Query ✔️ Use your backend app to perform query for information.
Jobs Use your backend app to perform job operation.
File Upload Set up your backend app to send file upload notification receiver.

Provisioning client SDK

This repository contains provisioning device client SDK for the Device Provisioning Service. Provisioning service SDK for Python is work in progress. Please see provisoning service SDK in Node.js, Java and .NET in the meantime.

✔️ feature available ✖️ feature planned but not supported ➖ no support planned

Features mqtt mqtt-ws amqp amqp-ws https Description
TPM Individual Enrollment ✔️ ✔️ ✔️ This SDK supports connecting your device to the Device Provisioning Service via individual enrollment using Trusted Platform Module. Please review the samples folder and this quickstarton how to create a device client. TPM over MQTT is currently not supported by the Device Provisioning Service.
X.509 Individual Enrollment ✔️ ✔️ ✔️ ✔️ ✔️ This SDK supports connecting your device to the Device Provisioning Service via individual enrollment using X.509 root certificate. Please review the samples folder and this quickstart on how to create a device client.
X.509 Enrollment Group ✔️ ✔️ ✔️ ✔️ ✔️ This SDK supports connecting your device to the Device Provisioning Service via individual enrollment using X.509 leaf certificate). Please review the samples folder on how to create a device client.

Samples

This repository contains various Python sample applications that illustrate how to use the Microsoft Azure IoT SDKs for Python.

Contribution, feedback and issues

If you encounter any bugs, have suggestions for new features or if you would like to become an active contributor to this project please follow the instructions provided in the contribution guidelines.

Support

  • Have a feature request for SDKs? Please post it on User Voice to help us prioritize.
  • Have a technical question? Ask on Stack Overflow with tag "azure-iot-hub".
  • Need Support? Every customer with an active Azure subscription has access to support with guaranteed response time. Consider submitting a ticket and get assistance from Microsoft support team
  • Found a bug? Please help us fix it by thoroughly documenting it and filing an issue on GitHub (C, Java, .NET, Node.js, Python).

Read more

SDK folder structure

/build_all

This folder contains platform-specific build scripts for the client libraries and dependent components.

/device

Contains Azure IoT Hub client components that provide the raw messaging capabilities of the library. Refer to the API documentation and samples for information on how to use it.

/doc

This folder contains application development guides and device setup instructions.

/jenkins

This folder contains scripts to build and run Python SDK provided proper environmental variables are set

/service

Contains libraries that enable interactions with the IoT Hub service to perform operations such as sending messages to devices and managing the device identity registry.

Long Term Support

The project offers a Long Term Support (LTS) version to allow users that do not need the latest features to be shielded from unwanted changes.

A new LTS version will be created every 6 months. The lifetime of an LTS branch is currently planned for one year. LTS branches receive all bug fixes that fall in one of these categories:

  • security bugfixes
  • critical bugfixes (crashes, memory leaks, etc.)

No new features or improvements will be picked up in an LTS branch.

LTS branches are named lts_mm_yyyy, where mm and yyyy are the month and year when the branch was created. An example of such a branch is lts_07_2017.

Schedule1

Below is a table showing the mapping of the LTS branches to the packages released

PIP Package Github Branch LTS Status LTS Start Date Maintenance End Date Removed Date
azure-iothub-device-client: 1.2.3
azure-iothub-service-client: 1.2.3
azure-iothub-provisioningserviceclient: 1.0.0
lts_01_2018 Active 2018-01-01 2018-06-30 2018-12-31
1.x.x lts_07_2017 Deprecated 2017-07-01 2017-12-31 2018-06-30
  • 1 All scheduled dates are subject to change by the Azure IoT SDK team.

Planned Release Schedule


This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Microsoft collects performance and usage information which may be used to provide and improve Microsoft products and services and enhance your experience. To learn more, review the privacy statement.

azure-iot-sdk-python's People

Contributors

1hw7 avatar ahirner avatar andrew-buckley avatar anporumb avatar az-iot-builder-01 avatar bertkleewein avatar briglx avatar cartertinney avatar cipop avatar damienpontifex avatar dcristoloveanu avatar digimaun avatar drwill-ms avatar dustinsummers avatar ellieayla avatar ewertons avatar fluxreality avatar ilias-tsigkogiannis avatar jasmineymlo avatar jongio avatar jspaith avatar mahakjain07031985 avatar markrad avatar mregen avatar mrohera avatar pierreca avatar rspielmann avatar tameraw avatar vjrantal avatar yzhong94 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.