Skip to content

Python SDK: Add TCP/TLS support, integration tests and examples #2809

@mmodzelewski

Description

@mmodzelewski

Summary

The Python SDK (PyO3-based wrapper around the Rust SDK) currently only exposes a plain TCP connection via `IggyClientBuilder::new().with_tcp()`. There is no way to enable TLS from the Python API, and there are no TLS integration tests or examples.

Current State

  • TLS implementation: Not exposed to Python users. The `IggyClient.init` method in `foreign/python/src/client.rs` hardcodes `IggyClientBuilder::new().with_tcp().with_server_address(...).build()` with no TLS options. The `from_connection_string` classmethod could potentially support TLS via connection string, but this is not documented or tested.
  • Integration tests: No TLS tests exist
  • Examples: No TLS-specific examples in `examples/python/`

Requirements

TLS Support

  • Expose TLS configuration options in the Python `IggyClient`:
    • Option to enable TLS on TCP connections
    • Option to specify CA certificate file path
    • Option to specify TLS domain
    • Either via constructor parameters or via a builder pattern
  • Ensure `from_connection_string` works with TLS connection strings and document this

Integration Tests

  • Add integration test(s) that connect to a TLS-enabled Iggy server from Python
  • Use custom certificates from `core/certs/` (`iggy_ca_cert.pem`, `iggy_cert.pem`, `iggy_key.pem`)
  • Test scenarios:
    • Successful TLS connection with custom CA certificate
    • Basic message send/receive over TLS connection

Examples

  • Add a TLS example in `examples/python/` demonstrating:
    • How to configure the client with TLS enabled
    • How to specify a custom CA certificate file
    • A simple producer/consumer flow over TLS

Reference

  • Python client implementation: `foreign/python/src/client.rs`
  • Server TLS config env vars: `IGGY_TCP_TLS_ENABLED=true`, `IGGY_TCP_TLS_CERT_FILE`, `IGGY_TCP_TLS_KEY_FILE`
  • Custom certs location: `core/certs/`
  • Rust SDK TLS support (underlying): `core/sdk/src/tcp/tcp_tls_connection_stream.rs`

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomerspythonPull requests that update Python codesdkChange related to sdk (client) APItestNew testcase, or improvement of existing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions