Skip to main content

Thingweb wotpy logo

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.

You can find the documentation at https://eclipse-thingweb.github.io/wotpy/.

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.

Features

The wotpy project provides fully functional implementations of four different protocol bindings: MQTT, HTTP, WebSockets, and CoAP. Moreover, it offers a discovery implementation based on Multicast DNS.

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

Feature Implementation based on
HTTP binding tornadoweb/tornado
WebSockets binding tornadoweb/tornado
CoAP binding chrysn/aiocoap
MQTT binding sbtinstruments/aiomqtt
Zenoh binding eclipse-zenoh/zenoh-python

Installation

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.

Then, to create a virtual environment under .venv, and install the project in development mode with all the test dependencies, run:

  • 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 ".[tests]"
  • Using uv:
uv venv .venv
uv sync --extra tests

Documentation

The docs are built with Sphinx. Install the docs dependencies first:

pip install -e ".[docs]"

Or with uv:

uv sync --extra docs

Then build from the docs/ directory:

cd docs
make html

The output is written to docs/_build/html/. Open docs/_build/html/index.html in a browser to preview. Use make clean html 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="3.10" task docker-tests
task: [test-broker] docker run -d -p 1883:1883 --name wotpy_test_broker eclipse-mosquitto:1.6

68bfef102faf3529427e5c7122f41d43490885c04f8a2d673a2c57b3afd68f72
task: [docker-tests] echo "⚙️ Running tests for Python 3.10..."
⚙️ Running tests for Python 3.10...
task: [docker-tests] /Users/agmangas/Documents/Projects/wotpy/pytest-docker.sh
Running python tests for version 3.10 with arguments "-v"
Creating temporary container volume
wotpy_tests_28b82c629b354b83a7fa22a9ed3d6dba
Running test container. Environment setup will take a while.
+ docker run --rm -it -v wotpy_tests_28b82c629b354b83a7fa22a9ed3d6dba:/app -e WOTPY_TESTS_MQTT_BROKER_URL=mqtt://172.16.102.196:1883 python:3.10 /bin/bash -c 'cd /app && pip install --quiet -U .[tests] && pytest -v'
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

[notice] A new release of pip is available: 23.0.1 -> 23.3.1
[notice] To update, run: pip install --upgrade pip
================================================================================================================================================== test session starts ===================================================================================================================================================
platform linux -- Python 3.10, pytest-7.4.2, pluggy-1.3.0 -- /usr/local/bin/python
cachedir: .pytest_cache
rootdir: /app
configfile: pytest.ini
plugins: asyncio-0.21.1, rerunfailures-10.3, Faker-13.16.0, cov-2.5.1
asyncio: mode=strict
collected 154 items

tests/codecs/test_json.py::test_json_codec PASSED [  0%]
tests/protocols/test_protocols.py::test_all_protocols_combined PASSED [  1%]

[...]

================================================================================================================================== 148 passed, 6 skipped, 1 warning in 60.70s (0:01:00) ==================================================================================================================================
+ set +x
wotpy_tests_28b82c629b354b83a7fa22a9ed3d6dba
task: [docker-tests] echo "✅ Tests for Python 3.10 completed successfully"
✅ Tests for Python 3.10 completed successfully

An MQTT broker is needed as a dependency for the MQTT binding tests. The task will automatically create a new container based on the eclipse-mosquitto image and expose the broker port to the host. The WOTPY_TESTS_MQTT_BROKER_URL environment variable will be set to the broker URL.

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.

Metadata

Release files for wotpy 0.18.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wotpy 0.18.0
File Size Uploaded
wotpy-0.18.0.tar.gz 95.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wotpy 0.18.0
File Interpreter ABI Platform
wotpy-0.18.0-py3-none-any.whl Python 3 none any Details

Total release size: 294.6 kB

Release files / wotpy-0.18.0.tar.gz

Download URL wotpy-0.18.0.tar.gz
Size 95.1 kB
Tags Source
SHA-256 checksum
How to use checksums
73182e45ed35556b4840f6937c94d113918f4335d4dcb2608c91d9aa2becc2de
BLAKE2b-256 checksum
How to use checksums
2f5df0d01ad47be2644061f794ea7a998eafcd32074058e27007215e51fe5604
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Release files / wotpy-0.18.0-py3-none-any.whl

Download URL wotpy-0.18.0-py3-none-any.whl
Size 199.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e94b1627b5eac665545498fe6caca3bdedb1442dfc1371f065e71e8aa202aa03
BLAKE2b-256 checksum
How to use checksums
dc46cb4237ea0f5ab2fbefb5953629322ccba79fa0e85a364733e842b7067a02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.18.0 This release

2 release files

0.17.2

2 release files

0.17.1

2 release files

0.17.0

2 release files

0.15.1

2 release files

0.15.0

2 release files

0.14.6

2 release files

0.14.5

3 release files

0.14.4

3 release files

0.14.3

3 release files

0.14.2

3 release files

0.14.1

3 release files

0.13.0

3 release files

0.11.0

3 release files

0.9.0

3 release files

0.8.9

3 release files

0.8.8

3 release files

0.8.7

3 release files

0.8.6

3 release files

0.8.5

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page