Skip to main content

Typed Python SDK for the Wokwi Simulation API with both async and synchronous interfaces

Project description

Wokwi Python Client 🚀

Typed Python SDK for the Wokwi Simulation API with both async and synchronous interfaces

PyPI version Python versions CI License: MIT

TL;DR: Run and control your Wokwi simulations from Python with first-class type hints, zero boilerplate, and both async and synchronous APIs.


Wokwi is a platform for creating and running simulations of electronic circuits and embedded systems. It supports a wide range of hardware platforms, including ESP32 family, Arduino, Raspberry Pi, STM32 and more.In addition, it supports a wide range of peripherals, including sensors, displays, motors, and debugging tools.

Wokwi Python Client is a Python SDK for the Wokwi Simulation API. It provides two client interfaces:

  • WokwiClient: Async client with full asyncio support for modern Python applications
  • WokwiClientSync: Synchronous client that mirrors the async API for traditional blocking code

Both clients allow you to run and control your Wokwi simulations from Python in a typed, easy-to-use way. You can use them to automate your embedded testing and development workflows.

Installation requirements

Install the library with:

pip install wokwi-client

Running the examples

Async Example

The basic async example is in the examples/hello_esp32/main.py file. It shows how to:

  • Connect to the Wokwi Simulator
  • Upload a diagram and firmware files
  • Start a simulation
  • Monitor serial output asynchronously

You can run the async example with:

pip install -e .[dev]
python -m examples.hello_esp32.main

Sync Example

The synchronous example is in the examples/hello_esp32_sync/main.py file. It demonstrates the same functionality using the blocking WokwiClientSync:

pip install -e .[dev]
python -m examples.hello_esp32_sync.main

ESP-IDF Example

The ESP-IDF example is in the examples/hello_esp32_idf/main.py file. It demonstrates uploading ESP-IDF firmware using flasher_args.json:

pip install -e .[dev]
python -m examples.hello_esp32_idf.main

For more examples, see the examples directory.

Documentation

The API documentation is available at https://wokwi.github.io/wokwi-python-client/.

Development

To run the tests, set the WOKWI_CLI_TOKEN environment variable (you can get a token from https://wokwi.com/dashboard/ci) and run the following command:

hatch run dev:pytest

To run the linter, run the following command:

hatch run ruff format --check .
hatch run ruff check .

To run the type checker, run the following command:

hatch run mypy .

Creating a new release

To create a new release, run the following commands:

git tag -m "v0.0.6" v0.0.6
git push --follow-tags

Replace 0.0.6 with the new version number.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wokwi_client-0.4.0.tar.gz (23.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wokwi_client-0.4.0-py3-none-any.whl (27.6 kB view details)

Uploaded Python 3

File details

Details for the file wokwi_client-0.4.0.tar.gz.

File metadata

  • Download URL: wokwi_client-0.4.0.tar.gz
  • Upload date:
  • Size: 23.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for wokwi_client-0.4.0.tar.gz
Algorithm Hash digest
SHA256 97f4530674c5be551147a2f6eb08912455d9fa11b16243ca1abf78bd5493fa68
MD5 6826a34b2da5ebbdfe54aa57cc40dfab
BLAKE2b-256 51dcd8d81ce94a34eb60dbf1cc52169921a595832ba343e52a56040e104f66fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for wokwi_client-0.4.0.tar.gz:

Publisher: release.yaml on wokwi/wokwi-python-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file wokwi_client-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: wokwi_client-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 27.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for wokwi_client-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5cad74b8e968c87550d96396b946db78c1ee3e5ad013e1c82563f830f19be2b6
MD5 884cd863296ed0840f42c422eb3b30bb
BLAKE2b-256 86274ffc1631bdb173602c33efaddd4eacb1efbe6323aa8e1309b98cf97f7f36

See more details on using hashes here.

Provenance

The following attestation bundles were made for wokwi_client-0.4.0-py3-none-any.whl:

Publisher: release.yaml on wokwi/wokwi-python-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page