Coder Social home page Coder Social logo

nickgraviton / wot-py Goto Github PK

View Code? Open in Web Editor NEW

This project forked from agmangas/wot-py

0.0 0.0 0.0 6.56 MB

WoTPy is an experimental implementation of a W3C Web of Things runtime

Home Page: https://agmangas.github.io/wot-py

License: MIT License

Shell 0.44% Python 99.28% Dockerfile 0.28%

wot-py's Introduction

⚠️ Please note that this project is currently behind the current version of the W3C WoT specifications although efforts are currently being made in order to bring this project back to date.
This actualization is still in the very early stages of development, so you may encounter bugs. Documentation may also be incomplete. Keep this in mind if you are planning on using this implementation on ongoing projects.

WoTPy

Tests Coveralls PyPI

Introduction

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.

Features

  • Supports Python 3 with versions >= 3.7

❗ Python 2 support is being dropped as it's reached its EOL.

  • 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 support matrix

Feature 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

⚠️ Some of these features are not currently supported for all python versions since some of the dependecies are broken for versions higher than 3.7, such as hbmqtt.

Couroutine APIs

⚠️ Tornado courutines will be replaced with the more up-to-date. asyncio module.

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.

Installation

⚠️ For the moment, this is not the current version, and it won't be until we have reached some stability in the development.

pip install wotpy

Development

To install in development mode with all the test dependencies:

pip install -U -e .[tests]

Some WoTPy features (e.g. CoAP binding) are not available outside of Linux. If you have Docker available in your system, and want to easily run the tests in a Linux environment (whether you're on macOS or Windows) you can use the Docker-based test script:

$ WOTPY_TESTS_MQTT_BROKER_URL=mqtt://192.168.1.141 ./pytest-docker-all.sh
...
+ docker run --rm -it -v /var/folders/zd/02pk7r3954s_t03lktjmvbdc0000gn/T/wotpy-547bed6bacf34ddc95b41eceb46553dd:/app -e WOTPY_TESTS_MQTT_BROKER_URL=mqtt://192.168.1.141 python:3.9 /bin/bash -c 'cd /app && pip install -U .[tests] && pytest -v --disable-warnings'
...
Python 3.7 :: OK
Python 3.8 :: OK
Python 3.9 :: OK
Python 3.10 :: OK

WOTPY_TESTS_MQTT_BROKER_URL defines the url of the MQTT broker. It will listen to port 1883 by default. If your broker is set up in a different way, you can provide the port in the url as well.

You can also test only for a specific Python version with the PYTHON_TAG variable and the pytest-docker.sh script like this:

$ WOTPY_TESTS_MQTT_BROKER_URL=mqtt://192.168.1.141 PYTHON_TAG=3.8 ./pytest-docker.sh

Development in VSCode with devcontainers

We have also provided a convenient devcontainer configuration to better recreate your local development environment. VSCode should detect it if you have the Remote - Containers extension installed.

Docs

⚠️ Untested for current changes.

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.

wot-py's People

Contributors

agmangas avatar asercrespo avatar fatadel avatar danielibaseta avatar jkrhb avatar dependabot[bot] avatar msrasheed 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.