Skip to content
eclipse-thingwebPublic

About

A WoT runtime in Python for Thing and Consumer applications

Topics

Resources

Contributing

Security policy

Stars

48 stars

Watchers

8 watching

Forks

Repository files navigation

Thingweb wotpy logo

PyPI version Python Versions codecov License GitHub Workflow Status Documentation Status

A WoT runtime in Python for Thing and Consumer applications

Introduction

wotpy is an implementation of a W3C WoT Runtime and the W3C WoT Scripting API in Python.

Documentation

See the wotpy documentation.

About the current version

⚠️ Please note that there's still a significant pending issue. Although the project is currently in a reasonably stable state, it does not implement the current version of the W3C WoT specifications. Specifically, the version at the time of writing is based on the following outdated references:

ℹ️ It is in our plans to get wotpy up to speed with the latest version of the specifications. We don't have an ETA for this, but we will be working on it in the near future.

If you are looking for a Python-like reference for the current Scripting API, see the WoT namespace definition in the W3C WoT Scripting API specification. The canonical reference implementation is node-wot.

In summary, wotpy is mature enough to be used in projects; in fact, it is being used in production at CTIC. However, it is not an adequate representation of the current status of the W3C WoT. We greatly encourage you to check the Developer Resources section on the WoT website to find out about the current state of the art.

Protocol Support

The wotpy project provides implementations of these protocol bindings:

  • HTTP
  • WebSockets
  • CoAP
  • MQTT
  • Zenoh
  • Modbus

These bindings are built on top of the following dependencies, which are instrumental to the project:

Feature Implementation based on Client Server
HTTP binding tornadoweb/tornado ✔️ ✔️
WebSockets binding tornadoweb/tornado ✔️ ✔️
CoAP binding chrysn/aiocoap ✔️ ✔️
MQTT binding Yakifo/amqtt ✔️ ✔️
Zenoh binding eclipse-zenoh/zenoh-python ✔️ ✔️
Modbus binding pymodbus-dev/pymodbus ✔️ -

Installation

Install wotpy using pip:

pip install wotpy

Development

The development workflow of wotpy is based on Taskfile v3.28 or later, so that's the first thing you need to install. If you are on Windows, see Running tests on Windows.

Create a .venv virtual environment and install the project in development mode with its development, documentation, and test dependencies.

Using pip:

task venv

Using uv:

task uv-venv

If task is not available or you have an older version, you can run the underlying commands directly:

Using pip:

python3 -m venv .venv
.venv/bin/pip install -U -e ".[dev,docs,tests]"

Using uv:

uv venv .venv
uv sync --extra dev --extra docs --extra tests

Building the documentation

The docs are built with Sphinx and the Furo theme, installed with the development dependencies above.

Current documentation

From the docs/ directory:

cd docs
make html

To preview, open _build/html/index.html in a browser.

Multiple version documentation

From the docs/ directory:

cd docs
make multiversion   

make multiversion builds every release tag above v0.17.0 plus the develop branch (as develop/) with sphinx-multiversion, and writes a root index.html redirecting to develop/. Open docs/_build/index.html in a browser (serve over HTTP, e.g. python3 -m http.server). Use make clean && make multiversion to force a full rebuild.

Running tests on Windows

Some wotpy features (e.g., the CoAP binding) are not available outside of Linux. If you have Docker installed and want to run the full test suite in a Linux environment, you can use the Docker-based test task:

PYTHON_TAG=<version> task docker-tests

Replace <version> with the Python version you want to test. The task starts the MQTT broker and Zenoh router required by the tests and sets the corresponding environment variables.

Publishing New Versions

You should use the version.sh file and not change any versions anywhere manually. Running version.sh minor will bump the minor version, push the tags and update the master branch and also trigger the release. Make sure to clear the .venv environment and reinstall the packages before publishing. An unclean tree will fail the script, i.e. the develop branch must be in a clean state first.

Note: This can be only used by those who have force push rights to the develop branch. See here.

About

A WoT runtime in Python for Thing and Consumer applications

Topics

Resources

Contributing

Security policy

Stars

48 stars

Watchers

8 watching

Forks

Releases

Used by

Contributors

Languages