Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ venv/
__pycache__/
*.py[cod]
*$py.class
superclient.egg-info
build/
dist/
dist/
superstream_clients.egg-info/
2 changes: 1 addition & 1 deletion DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ This installs the package in "editable" mode and enables automatic loading, whic
## Uninstallation

```bash
pip uninstall superclient && find venv/lib/python*/site-packages -name "superclient-init.pth" -delete && rm -rf build/ dist/ superclient.egg-info/ && find . -name "*.pyc" -delete && find . -name "__pycache__" -type d -exec rm -rf {} +
pip uninstall superstream-clients && find venv/lib/python*/site-packages -name "superclient-init.pth" -delete && rm -rf build/ dist/ superstream_clients.egg-info/ && find . -name "*.pyc" -delete && find . -name "__pycache__" -type d -exec rm -rf {} +
```

This single command:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ The Superstream library needs to modify your producer's configuration to apply o
## Installation

```bash
pip install superclient && python -m superclient install_pth
pip install superstream-clients && python -m superclient install_pth
```

That's it! Superclient will now automatically load and optimize all Kafka producers in your Python environment.
Expand Down Expand Up @@ -114,7 +114,7 @@ When using Superstream Clients with containerized applications, include the pack
FROM python:3.8-slim

# Install superclient
RUN pip install superclient
RUN pip install superstream-clients
RUN python -m superclient install_pth

# Your application code
Expand Down
2 changes: 1 addition & 1 deletion examples/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
kafka-python==2.0.2
kafka-python==2.2.14
confluent-kafka==2.3.0
aiokafka==0.10.0
aws-msk-iam-sasl-signer-python==1.0.2
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "superstream-clients"
version = "0.1.0"
version = "0.1.5"
description = "Superstream optimisation library for Kafka producers"
authors = [{name = "Superstream Labs", email = "support@superstream.ai"}]
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion superclient/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from importlib.metadata import PackageNotFoundError, version as _pkg_version

try:
__version__ = _pkg_version("superclient")
__version__ = _pkg_version("superstream-clients")
except PackageNotFoundError:
# Fallback for when the package isn't installed (e.g. running from source without editable install)
__version__ = "0.0.0"
Expand Down
16 changes: 12 additions & 4 deletions superclient/agent/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
set_debug_enabled(True)

logger = get_logger("agent")
logger.info("Superstream Agent initialized with environment variables: {}", _ENV_VARS)
if is_disabled():
logger.warn("Superstream functionality disabled via SUPERSTREAM_DISABLED")

# Preserve reference to built-in import function
_original_import = builtins.__import__
Expand All @@ -47,7 +44,12 @@ def _patch_module(module_name: str) -> None:
# Check if Producer exists before patching
confluent_module = sys.modules["confluent_kafka"]
if hasattr(confluent_module, "Producer"):
patch_confluent(confluent_module)
# Additional check to ensure we can safely patch
try:
patch_confluent(confluent_module)
except Exception as patch_exc:
logger.error("[ERR-003] Failed to patch confluent_kafka Producer: {}", patch_exc)
# Don't re-raise, just log the error
except Exception as exc:
logger.error("[ERR-001] Failed to patch {}: {}", module_name, exc)

Expand Down Expand Up @@ -93,6 +95,12 @@ def initialize():
2. Schedules patching of any pre-imported modules
3. Starts the heartbeat thread
"""

# Log initialization message
logger.info("Superstream Agent initialized with environment variables: {}", _ENV_VARS)
if is_disabled():
logger.warn("Superstream functionality disabled via SUPERSTREAM_DISABLED")

if is_disabled():
return

Expand Down
Loading