Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Environment:1kbgz Tributary Streaming IO Dependencies

From Leeroopedia
Knowledge Sources
Domains Infrastructure, Streaming, Networking
Last Updated 2026-10-14 09:15 GMT

Overview

External I/O service dependencies for tributary streaming sources and sinks: Kafka, Postgres, HTTP, WebSocket, SSE, SocketIO, email, and SMS.

Description

This environment covers the external service connectivity layer of tributary's streaming module. Streaming input sources connect to Kafka brokers (`aiokafka`), Postgres databases (`asyncpg`), HTTP endpoints (`aiohttp`), WebSocket servers (`aiohttp`), SSE feeds (`aiohttp-sse-client`), and SocketIO servers (`socketIO-client-nexus`). Streaming output sinks can produce to Kafka, Postgres, HTTP, WebSocket, SSE, send emails (`emails` + `beautifulsoup4`), and send SMS via Twilio (`twilio`). Each requires its own service-specific credentials and network connectivity.

Usage

Use this environment when building streaming data pipelines that connect to external services. It is required by Streaming_Input_Sources (Kafka, Postgres, HTTP, WebSocket, SSE, SocketIO, file, process, console inputs) and Streaming_Output_Sinks (Kafka, Postgres, HTTP, WebSocket, SSE, email, SMS outputs). The Streaming_Transforms implementation also requires this for the Subprocess transform.

System Requirements

Category Requirement Notes
OS Linux, macOS, or Windows Docker used for CI integration tests
Hardware Any CPU with network access Service endpoints must be reachable
Disk 50MB For I/O client libraries

Dependencies

System Packages

  • `graphviz-dev` (for visualization output)

Python Packages

  • `aiohttp` >= 3.5.4 (HTTP client/server, WebSocket)
  • `aiohttp-sse` >= 2.0 (SSE server output)
  • `aiohttp-sse-client` >= 0.2.0 (SSE client input)
  • `aiokafka` >= 0.6.0 (Kafka consumer/producer)
  • `asyncpg` >= 0.20.1 (Postgres client)
  • `aiofiles` >= 0.4.0 (async file I/O)
  • `aioconsole` >= 0.2.1 (async console I/O)
  • `socketIO-client-nexus` >= 0.7.6 (SocketIO client)
  • `tornado` >= 5.1.1 (SocketIO server dependency)
  • `emails` >= 0.5.15 (email sending)
  • `beautifulsoup4` >= 4.9.1 (email HTML parsing)
  • `twilio` >= 6.50.1 (SMS sending)

Credentials

The following credentials are required depending on which I/O sources/sinks are used:

  • Kafka: `servers` (bootstrap server list), `group` (consumer group ID) — passed as constructor args, not env vars
  • Postgres: `user`, `password`, `database`, `host` — passed as constructor args to `Postgres()`
  • Twilio SMS: `twilio` dict with `account_sid`, `auth_token`, `twilio_phone_number` — passed as constructor args to `TextMessage()`
  • Email SMTP: `smtp` dict with SMTP server settings — passed as constructor args to `Email()`
  • Test skipping: `TRIBUTARY_SKIP_DOCKER_TESTS` — set to `1` (default) to skip Docker-dependent integration tests; set to `0` to run them

Quick Install

# Install I/O service dependencies
pip install aiohttp>=3.5.4 aiohttp-sse>=2.0 aiohttp-sse-client>=0.2.0 \
  aiokafka>=0.6.0 asyncpg>=0.20.1 aiofiles>=0.4.0 aioconsole>=0.2.1 \
  socketIO-client-nexus>=0.7.6 tornado>=5.1.1 emails>=0.5.15 \
  beautifulsoup4>=4.9.1 twilio>=6.50.1

# Optional: functional extras
pip install confluent-kafka>=0.11.6 websocket_client>=0.57.0

Code Evidence

Kafka consumer from `tributary/streaming/input/kafka.py:27-51`:

from aiokafka import AIOKafkaConsumer

self._consumer = AIOKafkaConsumer(
    *topics,
    bootstrap_servers=servers,
    group_id=group,
    **consumer_kwargs
)
await self._consumer.start()

Postgres connection from `tributary/streaming/input/postgres.py:29-35`:

conn = await asyncpg.connect(
    user=user,
    password=password,
    database=database,
    host=host.split(":")[0],
    port=host.split(":")[1],
)

Twilio SMS from `tributary/streaming/output/text.py:24`:

self._twilio_client = Client(**twilio)

Docker test skip from `tributary/tests/streaming/output/test_kafka_streaming.py:10`:

@pytest.mark.skipif("int(os.environ.get('TRIBUTARY_SKIP_DOCKER_TESTS', '1'))")

Common Errors

Error Message Cause Solution
`ImportError: No module named aiokafka` Kafka dependency not installed `pip install aiokafka>=0.6.0`
`asyncpg.exceptions.PostgresConnectionError` Postgres server unreachable or wrong credentials Verify host, port, user, password
`aiohttp.ClientError` HTTP/WebSocket endpoint unavailable Check URL and network connectivity
`twilio.base.exceptions.TwilioRestException` Invalid Twilio credentials or phone number Verify `account_sid`, `auth_token`, and phone numbers

Compatibility Notes

  • Kafka: The `aiokafka` library requires a running Kafka broker. CI tests use Docker Compose but Kafka service is commented out in `ci/docker-compose.yml`.
  • Postgres: The `asyncpg` library connects via async TCP. Host string is split on `:` to separate host and port.
  • SocketIO: Uses `socketIO-client-nexus` which is synchronous; CI uses a Node.js echo server for testing.
  • Docker tests: All Docker-dependent tests are skipped by default (`TRIBUTARY_SKIP_DOCKER_TESTS=1`). Set to `0` to enable.
  • Functional extras: The `functional` extras (`confluent-kafka`, `websocket_client`) are optional and used only by the functional pipeline API.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment