Apache Iggy
SDKPython

Examples

Working Python examples from the core repository, covering connection strings, message headers and TLS.

Working examples are available in the examples/python directory. CI exercises them, so they always match the current SDK:

  • getting-started - producer and consumer with optional TLS via TcpConfig
  • basic - producer and consumer using connection strings
  • message-headers - user headers with str, bytes, bool, int, and float values, in two variants: plain-headers (plain dict, the SDK infers wire types) and typed-headers (explicit HeaderKey/HeaderValue)

Running the examples

Start an Iggy server first:

# Latest release
docker run --rm \
  --cap-add=SYS_NICE --security-opt seccomp=unconfined --ulimit memlock=-1:-1 \
  -p 8090:8090 \
  -e IGGY_TCP_ADDRESS=0.0.0.0:8090 \
  -e IGGY_NODE_ADVERTISED_ADDRESS=localhost \
  -e IGGY_ROOT_USERNAME=iggy -e IGGY_ROOT_PASSWORD=iggy \
  apache/iggy:latest

# Or from the repository source
cargo run --bin iggy-server -- --fresh --with-default-root-credentials

The environment variables make the server reachable through the published port (it binds to 127.0.0.1 inside the container by default) and set the iggy/iggy root credentials the examples default to.

Then, from examples/python, install the dependencies and run a producer/consumer pair:

# Using uv
uv sync
uv run getting-started/producer.py
uv run getting-started/consumer.py

# Without uv
python -m venv .venv
source .venv/bin/activate
pip install .
python getting-started/producer.py
python getting-started/consumer.py

For the quick-start code itself, see the Python SDK intro.

On this page