Skip to content

Development

The Python package is built with maturin, so a Rust toolchain is needed to install it from source. uv sync builds the extension, and uv run rebuilds it whenever the Rust under rust/ changes.

uv run pytest runs the Python tests. The lambda_integration ones are deselected by default; run them with uv run pytest -m lambda_integration once the local server below is running.

In the rust/ directory:

cargo lambda build --package echo --package map-lambda-dispatcher --package dispatcher-sum

cargo test runs the Rust unit tests for every crate in the workspace. cargo test -p dispatcher-sum -- --ignored runs the integration tests for combining, through the example combiner in dispatcher-sum, once the local server below is running.

cargo lambda watch runs a local server at http://localhost:9000 serving every lambda crate at once, routed by function name in the URL, rebuilding on file changes. It serves each function under its binary's name, so a session using it never prefixes names with a project.

To invoke a worker manually, use cargo lambda or curl directly:

cargo lambda invoke echo \
  --data-ascii '{"i":1,"default_sleep":0.0}'

curl -X POST \
  http://localhost:9000/2015-03-31/functions/echo/invocations \
  -d '{"i":1,"default_sleep":0.0}'

Releasing

Set the version in pyproject.toml and, for the Rust crates, in rust/Cargo.toml, run uv lock, and push a tag of the same version prefixed with v, such as v0.1.0. The release workflow builds the dispatcher and echo zips with python -m map_lambda.deploy build, and wheels for Linux x86-64 and arm64 and macOS arm64, with the zips' checksums in each wheel (in map_lambda/deploy/echo.sha256), then attaches them all to a GitHub release, marked as a pre-release for a dev, alpha, beta or release candidate version. Finally it publishes the wheels to PyPI, by trusted publishing from the pypi environment. A version can't be uploaded to PyPI twice, even once deleted.