Development Environment

Overview

k-Wave-python provides both a pure Python/NumPy solver and an interface to pre-compiled C++ binaries. The Python backend works out of the box — no extra dependencies needed.

Environment Setup

  1. Install uv

  2. Clone and install:

git clone https://github.com/waltsims/k-wave-python
cd k-wave-python
uv sync --extra dev --extra test
uv run pre-commit install

Testing

uv run pytest

Most tests run without MATLAB. Tests that need MATLAB reference data will skip gracefully if the references are not available.

Note

Without MATLAB: Download pre-generated references from GitHub CI and unpack into tests/matlab_test_data_collectors/python_testers/collectedValues/.

Test coverage:

uv run coverage run

Running Examples

uv run examples/ivp_homogeneous_medium.py

Force CPU (skip GPU even if available):

KWAVE_FORCE_CPU=1 uv run examples/ivp_homogeneous_medium.py

Publishing

uv is used to build and publish to PyPI.

Note

Only for maintainers with PyPI write access.

uv build
uv publish --token $PYPI_TOKEN