WoTPy is an experimental implementation of a W3C WoT Runtime and the W3C WoT Scripting API in Python.
Inspired by the exploratory implementations located in the thingweb GitHub page.
- Supports Python 2.7, 3.6 and 3.7.
- Fully-implemented
WoT
interface. - Multicast discovery based on mDNS.
- Asynchronous I/O programming model based on coroutines.
- Multiple client and server Protocol Binding implementations.
Feature | Python 2.7 | Python 3 | Implementation based on |
---|---|---|---|
HTTP binding | ✔️ | ✔️ | tornadoweb/tornado |
WebSockets binding | ✔️ | ✔️ | tornadoweb/tornado |
CoAP binding | ✖️ | ✔️ | chrysn/aiocoap |
MQTT binding | ✖️ | ✔️ | beerfactory/hbmqtt |
mDNS discovery | ✖️ | ✔️ | jstasiak/python-zeroconf |
WoTPy is based on the Tornado Framework. Users therefore have two different API options to write code based on coroutines:
- Users on Python 3 may use the native asyncio module. This is, in fact, the recommended approach. It should be noted that Tornado on Python 3 acts basically as a wrapper around
asyncio
. - Users on Python 2.7 are restricted to writing Tornado coroutines (
asyncio
is not available on Python 2.7).
- Add missing sections to docs and deploy on a public site.
- Subscription to Thing Description changes.
- Validation of data schemas.
- Enable Action handlers to return Observables.
- Update protocol bindings to accept event subscription and cancellation data.
pip install wotpy
To install in development mode with all the test dependencies:
pip install -U -e .[tests]
To run the tests in all supported environments:
WOTPY_TESTS_MQTT_BROKER_URL=mqtt://broker-url tox
Move to the docs
folder and run:
make html
If you attempt to build the docs on a non-Linux platform or with Python 2.7 _autosummary
will complain about being unable to import the unsupported modules (e.g. MQTT on Python 2.7). In this case the docs will be missing the sections regarding unsupported features.