w3c wot运行时和wot脚本api的python实现
wotp的Python项目详细描述
工作日
简介
wotpy是python中W3C WoT Runtime和W3C WoT Scripting API的实验性实现。
灵感来自于位于thingweb GitHub page中的探索性实现。
功能
- 支持Python2.7、3.6和3.7。
- 完全实现了
WoT
接口。 - 基于mdns的多播发现。
- 基于协程的异步i/o编程模型。
- 多个客户机和服务器Protocol Binding实现。
特征支持矩阵
Feature | Python 2.7 | Python 3 | Implementation based on |
---|---|---|---|
HTTP binding | :heavy_check_mark: | :heavy_check_mark: | tornadoweb/tornado |
WebSockets binding | :heavy_check_mark: | :heavy_check_mark: | tornadoweb/tornado |
CoAP binding | :heavy_multiplication_x: | :heavy_check_mark: | chrysn/aiocoap |
MQTT binding | :heavy_multiplication_x: | :heavy_check_mark: | beerfactory/hbmqtt |
mDNS discovery | :heavy_multiplication_x: | :heavy_check_mark: | jstasiak/python-zeroconf |
Couroutine API
wotpy基于Tornado Framework。因此,用户有两个不同的api选项可以基于协同路由编写代码:
- python 3上的用户可以使用本机asyncio模块。实际上,这是建议的方法。应该注意的是,python 3上的tornado基本上是围绕
asyncio
运行的。 - 位于python 2.7上的用户仅限于编写Tornado coroutines(
asyncio
在python 2.7上不可用)。
待办事项
- 将缺少的部分添加到文档并部署到公共站点上。
- 订阅对象描述更改。
- 数据架构的验证。
- 使操作处理程序返回可观察值。
- 更新协议绑定以接受事件订阅和取消数据。
安装
pip install wotpy
发展
要在开发模式下安装所有测试依赖项:
pip install -U -e .[tests]
要在所有支持的环境中运行测试:
WOTPY_TESTS_MQTT_BROKER_URL=mqtt://broker-url tox
文档
移到docs
文件夹并运行:
make html
如果您试图在非Linux平台或使用Python2.7构建文档,_autosummary
将抱怨无法导入不受支持的模块(例如Python2.7上的MQTT)。在这种情况下,文档将丢失有关不支持功能的部分。