Skip to main content

Thingweb wotpy logo

PyPI version Python Versions 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.

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.

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 sbtinstruments/aiomqtt ✔️ ✔️
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 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 ".[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] PWD/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 and a Zenoh router is needed fo the Zenoh binding tests. The task will automatically create new docker images and set the appropriate env variables WOTPY_TESTS_MQTT_BROKER_URL and WOTPY_TESTS_ZENOH_ROUTER_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.20.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.20.0
File Size Uploaded Provenance Actions
wotpy-0.20.0.tar.gz 102.2 kB With provenance Details for wotpy-0.20.0.tar.gz

Built distribution (wheel)

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

Total release size: 313.5 kB

Release files / wotpy-0.20.0.tar.gz

Download URL wotpy-0.20.0.tar.gz
Size 102.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b4d5a8d57c4952f05029ecfe9df8189d9d8c4ecafb09dfe3649b6fe1e136705f
BLAKE2b-256 checksum
How to use checksums
a11513cb6afd4cb1a8c9b16b816e71b4ed7cabc7b2e888584f1fd410042cb6c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 20, 2026.

Transparency log

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

Download URL wotpy-0.20.0-py3-none-any.whl
Size 211.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
580806e0280b661db3f44a547402b04e6902c7f93f0da8467e6869bcbf3f57cf
BLAKE2b-256 checksum
How to use checksums
7e21a1d8730e11dfde6f20c3fd8328774af4c3e74b76c6ef73039eead9518c5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 20, 2026.

Transparency log

Security for wotpy 0.20.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for wotpy-0.20.0.tar.gz

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 Nov 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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