Why use an SDK?

ldk dev (local server)

  • Runs as an external process
  • Services start on network ports (3000–3030)
  • Works with any language or framework
  • Supports hot reloading for Lambda handlers
  • Web dashboard at /_ldk/gui
  • Reads CDK or HCL projects

Language SDK (in-process)

  • Runs as threads in your test process
  • No ports, no networking overhead
  • Native test framework integration (pytest, Jest…)
  • Per-test state isolation with session.reset()
  • Fluent APIs for faking and chaos injection
  • Auto-discovers resources from CDK or HCL

Python SDK Highlights

The Python SDK (local-web-services-python-sdk) provides everything you need to test AWS-backed Python applications without leaving your pytest suite.

🔄

LwsSession

A single context manager that starts all your services. Declare tables, queues, buckets, topics, state machines, parameters, and secrets — or auto-discover them from a CDK or HCL project.

👥

pytest Fixtures

Zero-boilerplate pytest integration. The lws_session fixture starts services once per session; lws_reset wipes state between tests automatically.

📋

Resource Helpers

Simplified DynamoDB, SQS, and S3 helpers with built-in assertion methods: table.assert_item_exists(), queue.assert_message_count(), bucket.assert_object_count().

🎭

Operation Faking

Override any AWS operation response with a fluent builder. Inject throttling errors, custom status codes, or delayed responses at the operation level without changing application code.

💥

Chaos Engineering

Inject error rates, latency ranges, connection resets, and timeouts into any service. Apply and clear chaos scenarios programmatically within individual test functions.

🔒

IAM Authorization

Switch IAM modes to disabled, audit, or enforce. Define named identities with inline allow/deny policies and verify authorization behavior in tests.

Python SDK Docs    GitHub

Quick Start: Python

Install the SDK and write your first test in minutes.

1

Install

pip install local-web-services-python-sdk # or with uv uv add local-web-services-python-sdk
2

Declare your resources

from lws_testing import LwsSession with LwsSession( tables=[{"name": "Orders", "partition_key": "id"}], queues=["OrderQueue"], buckets=["ReceiptsBucket"], ) as session: # services are running pass
3

Write a test

def test_create_order(lws_session): # Use a boto3 client pointing to local services client = lws_session.client("dynamodb") client.put_item( TableName="Orders", Item={"id": {"S": "42"}, "status": {"S": "pending"}} ) # Or use the DynamoDB helper with assertions table = lws_session.dynamodb("Orders") table.assert_item_exists({"id": {"S": "42"}})
4

Configure pytest fixtures

# conftest.py import pytest from lws_testing import LwsSession @pytest.fixture(scope="session") def lws_session_spec(): return { "tables": [{"name": "Orders", "partition_key": "id"}], "queues": ["OrderQueue"], "buckets": ["ReceiptsBucket"], } # lws_session and lws_reset fixtures are provided # automatically by the lws_testing pytest plugin
Full Python SDK Reference