Metadata-Version: 2.4
Name: wotpy
Version: 0.21.0
Summary: Python implementation of a W3C WoT Runtime and the WoT Scripting API
Author-email: Eclipse Thingweb <thingweb-dev@eclipse.org>
Maintainer-email: Nikos Filinis <nfilinis@netmode.ntua.gr>
License-Expression: MIT
Project-URL: Repository, https://github.com/eclipse-thingweb/wotpy.git
Project-URL: Documentation, https://eclipse-thingweb.github.io/wotpy/
Keywords: wot,iot,gateway,fog,w3c
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: tornado<7.0,>=6.5.2
Requires-Dist: jsonschema>=4.25.1
Requires-Dist: reactivex<7.0,>=6.1.1
Requires-Dist: python-slugify>=8.0.4
Requires-Dist: requests-oauthlib>=2.0.0
Requires-Dist: aiocoap[linkheader,oscore]>=0.4.7; platform_system != "Darwin"
Requires-Dist: amqtt>=0.10.1
Requires-Dist: eclipse-zenoh>=1.5.0
Requires-Dist: pymodbus>=3.11.0
Provides-Extra: dev
Requires-Dist: bump-my-version>=1.1.0; extra == "dev"
Provides-Extra: tests
Requires-Dist: cryptography>=49.0.0; extra == "tests"
Requires-Dist: pytest>=8.4.1; extra == "tests"
Requires-Dist: pytest-cov>=6.2.1; extra == "tests"
Requires-Dist: pytest-asyncio>=1.1.0; extra == "tests"
Requires-Dist: faker>=37.6.0; extra == "tests"
Provides-Extra: docs
Requires-Dist: Sphinx>=7.4.7; extra == "docs"
Requires-Dist: furo>=2025.12.19; extra == "docs"
Requires-Dist: sphinx-multiversion-scylla>=0.3.9; extra == "docs"
Dynamic: license-file

<!-- Copyright (c) 2026 Contributors to the Eclipse Foundation -->

<h1>
  <picture>
  <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/eclipse-thingweb/thingweb/master/brand/logos/wotpy_for_dark_bg.svg">
  <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/eclipse-thingweb/thingweb/master/brand/logos/wotpy.svg">
  <img title="ThingWeb wotpy" alt="Thingweb wotpy logo" src="https://raw.githubusercontent.com/eclipse-thingweb/thingweb/master/brand/logos/wotpy.svg" width="300">
</picture>
</h1>

[![PyPI version](https://img.shields.io/pypi/v/wotpy.svg?style=flat-square)](https://pypi.org/project/wotpy/)
[![Python Versions](https://img.shields.io/pypi/pyversions/wotpy.svg?style=flat-square)](https://pypi.org/project/wotpy/)
[![codecov](https://codecov.io/gh/eclipse-thingweb/wotpy/branch/develop/graph/badge.svg)](https://codecov.io/gh/eclipse-thingweb/wotpy)
[![License](https://img.shields.io/github/license/eclipse-thingweb/wotpy.svg?style=flat-square)](https://github.com/eclipse-thingweb/wotpy/blob/master/LICENSE)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/eclipse-thingweb/wotpy/test-wotpy.yaml?branch=master&style=flat-square&label=tests)](https://github.com/eclipse-thingweb/wotpy/actions)
[![Documentation Status](https://img.shields.io/badge/docs-latest-blue.svg?style=flat-square)](https://eclipse-thingweb.github.io/wotpy/)

> A WoT runtime in Python for Thing and Consumer applications

## Introduction

wotpy is an implementation of a [W3C WoT Runtime](https://github.com/w3c/wot-architecture/blob/master/proposals/terminology.md#wot-runtime) and the [W3C WoT Scripting API](https://github.com/w3c/wot-architecture/blob/master/proposals/terminology.md#scripting-api) in Python.

## Documentation

See the [wotpy documentation](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:

* K. Kajimoto, M. Kovatsch, and U. Davuluru, ‘Web of Things (WoT) Architecture’, W3C, W3C First Public Working Draft, Sep. 2017. [Online]. Available: https://www.w3.org/TR/2017/WD-wot-architecture-20170914/
* Z. Kis, K. Nimura, D. Peintner, and J. Hund, ‘Web of Things (WoT) Scripting API’, W3C, W3C Working Draft, Nov. 2018. [Online]. Available: https://www.w3.org/TR/2018/WD-wot-scripting-api-20181129/
* S. Käbisch and T. Kamiya, ‘Web of Things (WoT) Thing Description’, W3C, W3C Working Draft, Oct. 2018. [Online]. Available: https://www.w3.org/TR/2018/WD-wot-thing-description-20181021/

> ℹ️ 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](https://w3c.github.io/wot-scripting-api/#the-wot-namespace) in the W3C WoT Scripting API specification. The canonical reference implementation is [node-wot](https://github.com/eclipse-thingweb/node-wot).

In summary, wotpy is mature enough to be used in projects; in fact, it is being used in production at [CTIC](https://github.com/fundacionctic). 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](https://www.w3.org/WoT/developers) 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](https://github.com/tornadoweb/tornado)                  | ✔️     | ✔️     |
| WebSockets binding  | [tornadoweb/tornado](https://github.com/tornadoweb/tornado)                  | ✔️     | ✔️     |
| CoAP binding        | [chrysn/aiocoap](https://github.com/chrysn/aiocoap)                          | ✔️     | ✔️     |
| MQTT binding        | [Yakifo/amqtt](https://github.com/Yakifo/amqtt)                              | ✔️     | ✔️     |
| Zenoh binding       | [eclipse-zenoh/zenoh-python](https://github.com/eclipse-zenoh/zenoh-python)  | ✔️     | ✔️     |
| Modbus binding      | [pymodbus-dev/pymodbus](https://github.com/pymodbus-dev/pymodbus)            | ✔️     | -      |

## Installation
Install wotpy using pip:
```sh
pip install wotpy
```

### Development

The development workflow of wotpy is based on [Taskfile](https://taskfile.dev/installation/) v3.28 or later, so that's the first thing you need to install. If you are on Windows, see [Running tests on Windows](#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`:

```bash
task venv
```

Using `uv`:

```bash
task uv-venv
```

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

Using `pip`:

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

Using `uv`:

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

### Building the documentation

The docs are built with [Sphinx](https://www.sphinx-doc.org/) and the [Furo](https://pradyunsg.me/furo/) theme, installed with the development dependencies above.

#### Current documentation
From the `docs/` directory:

```sh
cd docs
make html
```
To preview, open `_build/html/index.html` in a browser.

#### Multiple version documentation
From the `docs/` directory:

```sh
cd docs
make multiversion   
```

`make multiversion` builds every release tag above `v0.17.0` plus the `develop` branch (as `develop/`) with [sphinx-multiversion](https://github.com/scylladb/sphinx-multiversion-scylla), 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:

```sh
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](https://github.com/eclipse-thingweb/wotpy/issues/39).

