redis-toolkit


Nameredis-toolkit JSON
Version 0.4.0 PyPI version JSON
download
home_pagehttps://github.com/JonesHong/redis-toolkit
SummaryEnhanced Redis wrapper with multi-type data support and pub/sub automation
upload_time2025-08-24 17:26:03
maintainerNone
docs_urlNone
authorJonesHong
requires_python>=3.7
licenseMIT
keywords redis toolkit pubsub serialization buffer audio video image converter
VCS
bugtrack_url
requirements redis pretty-loguru
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
<h1 align="center">Redis Toolkit</h1>

<p align="center">
  <img src="https://raw.githubusercontent.com/JonesHong/redis-toolkit/main/assets/images/logo.png" alt="Redis Toolkit Logo" width="200"/>
</p>

<p align="center">
  <a href="https://pypi.org/project/redis-toolkit/">
    <img alt="PyPI version" src="https://img.shields.io/pypi/v/redis-toolkit.svg">
  </a>
  <a href="https://pypi.org/project/redis-toolkit/">
    <img alt="Python versions" src="https://img.shields.io/pypi/pyversions/redis-toolkit.svg">
  </a>
  <a href="https://github.com/JonesHong/redis-toolkit/blob/main/LICENSE">
    <img alt="License" src="https://img.shields.io/github/license/JonesHong/redis-toolkit.svg">
  </a>
  <a href="https://joneshong.github.io/redis-toolkit/en/">
    <img alt="Documentation" src="https://img.shields.io/badge/docs-stable-blue.svg">
  </a>
  <a href="https://deepwiki.com/JonesHong/redis-toolkit"><img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki"></a>
</p>


<p align="center">
  <strong>๐Ÿš€ Enhanced Redis wrapper with intelligent serialization and media processing</strong>
</p>

<p align="center">
  A powerful Redis toolkit that simplifies multi-type data operations, pub/sub messaging, and media file processing with automatic encoding/decoding capabilities.
</p>

---

## โœจ Features

- ๐ŸŽฏ **Smart & Secure Serialization**: Automatic handling of `dict`, `list`, `bool`, `bytes`, `int`, `float`, and `numpy` arrays using JSON-based serialization (no pickle!)
- ๐Ÿ” **Security First**: No pickle serialization means no remote code execution vulnerabilities
- ๐ŸŽต **Media Processing**: Built-in converters for images, audio, and video files
- ๐Ÿ“ก **Pub/Sub Made Easy**: Simplified publish/subscribe with automatic JSON serialization
- ๐Ÿ”ง **Flexible Configuration**: Support for custom Redis clients and connection settings
- ๐Ÿ›ก๏ธ **Resilient Operations**: Built-in retry mechanisms with `@with_retry` decorator
- ๐Ÿ“ฆ **Batch Operations**: Efficient `batch_set` and `batch_get` for bulk operations
- ๐ŸŽจ **Pretty Logging**: Enhanced logging with pretty-loguru integration
- ๐Ÿ”ง **Flexible Configuration**: Simple configuration with Python dataclasses

## ๐Ÿ“ฆ Installation

### Basic Installation
```bash
pip install redis-toolkit
```

### With Media Processing
```bash
# For image processing
pip install redis-toolkit[cv2]

# For audio processing (basic)
pip install redis-toolkit[audio]

# For audio processing (with MP3 support)
pip install redis-toolkit[audio-full]

# For complete media support
pip install redis-toolkit[all]
```

## ๐Ÿš€ Quick Start

### Basic Usage

```python
from redis_toolkit import RedisToolkit
from redis import Redis

# Method 1: Pass existing Redis instance
redis_client = Redis(host='localhost', port=6379, decode_responses=False)
toolkit = RedisToolkit(redis=redis_client)

# Method 2: Use configuration (with connection pooling)
from redis_toolkit import RedisConnectionConfig
config = RedisConnectionConfig(host='localhost', port=6379)
toolkit = RedisToolkit(config=config)

# Method 3: Use defaults
toolkit = RedisToolkit()

# Store different data types
toolkit.setter("user", {"name": "Alice", "age": 25, "active": True})
toolkit.setter("scores", [95, 87, 92, 88])
toolkit.setter("flag", True)
toolkit.setter("binary_data", b"Hello, World!")

# Automatic deserialization
user = toolkit.getter("user")      # {'name': 'Alice', 'age': 25, 'active': True}
scores = toolkit.getter("scores")  # [95, 87, 92, 88]
flag = toolkit.getter("flag")      # True (bool, not string)

# Access the underlying Redis client for advanced operations
raw_value = toolkit.client.get("user")  # Get raw bytes
toolkit.client.expire("user", 3600)     # Set TTL
```

### Media Processing with Converters

```python
from redis_toolkit import RedisToolkit
from redis_toolkit.converters import encode_image, decode_image
from redis_toolkit.converters import encode_audio, decode_audio
import cv2
import numpy as np

toolkit = RedisToolkit()

# Image processing
img = cv2.imread('photo.jpg')
img_bytes = encode_image(img, format='jpg', quality=90)
toolkit.setter('my_image', img_bytes)

# Retrieve and decode
retrieved_bytes = toolkit.getter('my_image')
decoded_img = decode_image(retrieved_bytes)

# Audio processing
sample_rate = 44100
audio_data = np.sin(2 * np.pi * 440 * np.linspace(0, 1, sample_rate))
audio_bytes = encode_audio(audio_data, sample_rate=sample_rate)
toolkit.setter('my_audio', audio_bytes)

# Retrieve and decode
retrieved_audio = toolkit.getter('my_audio')
decoded_rate, decoded_audio = decode_audio(retrieved_audio)
```

### Pub/Sub with Media Sharing

```python
from redis_toolkit import RedisToolkit
from redis_toolkit.converters import encode_image
import base64

# Setup subscriber
def message_handler(channel, data):
    if data.get('type') == 'image':
        # Decode base64 image data
        img_bytes = base64.b64decode(data['image_data'])
        img = decode_image(img_bytes)
        print(f"Received image: {img.shape}")

subscriber = RedisToolkit(
    channels=["media_channel"],
    message_handler=message_handler
)

# Setup publisher
publisher = RedisToolkit()

# Send image through pub/sub
img_bytes = encode_image(your_image_array, format='jpg', quality=80)
img_base64 = base64.b64encode(img_bytes).decode('utf-8')

message = {
    'type': 'image',
    'user': 'Alice',
    'image_data': img_base64,
    'timestamp': time.time()
}

publisher.publisher("media_channel", message)
```

### Advanced Configuration

```python
from redis_toolkit import RedisToolkit, RedisOptions, RedisConnectionConfig

# Custom Redis connection
config = RedisConnectionConfig(
    host="localhost",
    port=6379,
    db=1,
    password="your_password"
)

# Custom options
options = RedisOptions(
    is_logger_info=True,
    max_log_size=512,
    subscriber_retry_delay=10,
    log_level="INFO",  # Support for pretty-loguru
    log_path="./logs"  # Optional file logging
)

# Method 1: With configuration
toolkit = RedisToolkit(config=config, options=options)

# Method 2: With existing Redis client
import redis
pool = redis.ConnectionPool(host='localhost', port=6379, db=0)
redis_client = redis.Redis(connection_pool=pool)
toolkit = RedisToolkit(redis=redis_client, options=options)

# Access the underlying Redis client
print(f"Redis server info: {toolkit.client.info()['redis_version']}")
```


### Batch Operations

```python
# Batch set
data = {
    "user:1": {"name": "Alice", "score": 95},
    "user:2": {"name": "Bob", "score": 87},
    "user:3": {"name": "Charlie", "score": 92}
}
toolkit.batch_set(data)

# Batch get
keys = ["user:1", "user:2", "user:3"]
results = toolkit.batch_get(keys)
```

### Context Manager

```python
with RedisToolkit() as toolkit:
    toolkit.setter("temp_data", {"session": "12345"})
    data = toolkit.getter("temp_data")
    # Automatic cleanup on exit
```

## ๐ŸŽจ Media Converters

### Image Converter

```python
from redis_toolkit.converters import get_converter

# Create image converter with custom settings
img_converter = get_converter('image', format='png', quality=95)

# Encode image
encoded = img_converter.encode(image_array)

# Decode image
decoded = img_converter.decode(encoded)

# Resize image
resized = img_converter.resize(image_array, width=800, height=600)

# Get image info
info = img_converter.get_info(encoded_bytes)
```

### Audio Converter

```python
from redis_toolkit.converters import get_converter

# Create audio converter
audio_converter = get_converter('audio', sample_rate=44100, format='wav')

# Encode from file
encoded = audio_converter.encode_from_file('song.mp3')

# Encode from array
encoded = audio_converter.encode((sample_rate, audio_array))

# Decode audio
sample_rate, audio_array = audio_converter.decode(encoded)

# Normalize audio
normalized = audio_converter.normalize(audio_array, target_level=0.8)

# Get file info
info = audio_converter.get_file_info('song.mp3')
```

### Video Converter

```python
from redis_toolkit.converters import get_converter

# Create video converter
video_converter = get_converter('video')

# Encode video file
encoded = video_converter.encode('movie.mp4')

# Save video bytes to file
video_converter.save_video_bytes(encoded, 'output.mp4')

# Get video info
info = video_converter.get_video_info('movie.mp4')

# Extract frames
frames = video_converter.extract_frames('movie.mp4', max_frames=10)
```

## ๐ŸŽฏ Use Cases

### Real-time Image Sharing
Perfect for applications that need to share images instantly across different services or users.

### Audio/Video Streaming
Handle audio and video buffers efficiently with automatic encoding/decoding.

### Multi-media Chat Applications
Build chat applications that support text, images, audio, and video messages.

### Data Analytics Dashboards
Share real-time charts and visualizations between different components.

### IoT Data Processing
Handle sensor data, images from cameras, and audio from microphones.

## โš™๏ธ Configuration Options

### Redis Connection Config
```python
RedisConnectionConfig(
    host='localhost',
    port=6379,
    db=0,
    password=None,
    username=None,
    encoding='utf-8',
    decode_responses=False,     # Always False for proper serialization
    socket_keepalive=True,
    socket_keepalive_options=None,
    connection_timeout=None,    # Connection timeout in seconds
    socket_timeout=None,        # Socket operation timeout in seconds
    retry_on_timeout=False,     # Retry on timeout
    retry_on_error=True,        # Retry on error
    health_check_interval=30,   # Health check interval in seconds
    ssl=False,                  # Use SSL/TLS
    ssl_keyfile=None,          # SSL key file path
    ssl_certfile=None,         # SSL certificate file path
    ssl_ca_certs=None,         # SSL CA certificates file path
    ssl_cert_reqs='required'   # SSL certificate requirement level
)
```

### Redis Options
```python
RedisOptions(
    is_logger_info=True,           # Enable logging
    max_log_size=256,              # Max log entry size
    subscriber_retry_delay=5,      # Subscriber reconnection delay
    subscriber_stop_timeout=5,     # Subscriber stop timeout
    log_level="INFO",              # Log level (DEBUG, INFO, WARNING, ERROR)
    log_path=None,                 # Log file path (None for console only)
    max_value_size=10*1024*1024,   # Max value size in bytes (10MB)
    max_key_length=512,            # Max key length
    enable_validation=True,        # Enable validation
    use_connection_pool=True,      # Use shared connection pool
    max_connections=None           # Max connections (None for unlimited)
)
```

### Configuration Validation

Both `RedisOptions` and `RedisConnectionConfig` support validation:

```python
# Validate configuration before use
options = RedisOptions(log_level="DEBUG")
options.validate()  # Raises ValueError if invalid

config = RedisConnectionConfig(port=6379, ssl=True)
config.validate()  # Raises ValueError if invalid

# RedisToolkit automatically validates options on initialization
toolkit = RedisToolkit(config=config, options=options)
```

## ๐Ÿ“‹ Requirements

- Python >= 3.7
- Redis >= 4.0
- redis-py >= 4.0

### Optional Dependencies
- **OpenCV**: For image and video processing (`pip install opencv-python`)
- **NumPy**: For array operations (`pip install numpy`)
- **SciPy**: For audio processing (`pip install scipy`)
- **SoundFile**: For advanced audio formats (`pip install soundfile`)
- **Pillow**: For additional image formats (`pip install Pillow`)

## ๐Ÿงช Testing

```bash
# Install development dependencies
pip install redis-toolkit[dev]

# Run tests
pytest

# Run with coverage
pytest --cov=redis_toolkit

# Run specific test categories
pytest -m "not slow"  # Skip slow tests
pytest -m integration  # Run integration tests only
```

## ๐Ÿค Contributing

We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.

1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

## ๐Ÿ“„ License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## ๐Ÿ“ž Contact & Support

- **Documentation**: [https://joneshong.github.io/redis-toolkit/](https://joneshong.github.io/redis-toolkit/)
- **Issues**: [GitHub Issues](https://github.com/JonesHong/redis-toolkit/issues)
- **Discussions**: [GitHub Discussions](https://github.com/JonesHong/redis-toolkit/discussions)
- **PyPI**: [https://pypi.org/project/redis-toolkit/](https://pypi.org/project/redis-toolkit/)

## ๐ŸŒŸ Showcase

**Used by these awesome projects:**
- Add your project here by opening a PR!

---

<p align="center">
  Made with โค๏ธ by the Redis Toolkit Team
</p>

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/JonesHong/redis-toolkit",
    "name": "redis-toolkit",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "redis, toolkit, pubsub, serialization, buffer, audio, video, image, converter",
    "author": "JonesHong",
    "author_email": "JonesHong <latte831104@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/dc/92/880b956a1e4890bf23649cabe02d4157a56b7cf3a7245d3d369b687802a4/redis_toolkit-0.4.0.tar.gz",
    "platform": null,
    "description": "\n<h1 align=\"center\">Redis Toolkit</h1>\n\n<p align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/JonesHong/redis-toolkit/main/assets/images/logo.png\" alt=\"Redis Toolkit Logo\" width=\"200\"/>\n</p>\n\n<p align=\"center\">\n  <a href=\"https://pypi.org/project/redis-toolkit/\">\n    <img alt=\"PyPI version\" src=\"https://img.shields.io/pypi/v/redis-toolkit.svg\">\n  </a>\n  <a href=\"https://pypi.org/project/redis-toolkit/\">\n    <img alt=\"Python versions\" src=\"https://img.shields.io/pypi/pyversions/redis-toolkit.svg\">\n  </a>\n  <a href=\"https://github.com/JonesHong/redis-toolkit/blob/main/LICENSE\">\n    <img alt=\"License\" src=\"https://img.shields.io/github/license/JonesHong/redis-toolkit.svg\">\n  </a>\n  <a href=\"https://joneshong.github.io/redis-toolkit/en/\">\n    <img alt=\"Documentation\" src=\"https://img.shields.io/badge/docs-stable-blue.svg\">\n  </a>\n  <a href=\"https://deepwiki.com/JonesHong/redis-toolkit\"><img src=\"https://deepwiki.com/badge.svg\" alt=\"Ask DeepWiki\"></a>\n</p>\n\n\n<p align=\"center\">\n  <strong>\ud83d\ude80 Enhanced Redis wrapper with intelligent serialization and media processing</strong>\n</p>\n\n<p align=\"center\">\n  A powerful Redis toolkit that simplifies multi-type data operations, pub/sub messaging, and media file processing with automatic encoding/decoding capabilities.\n</p>\n\n---\n\n## \u2728 Features\n\n- \ud83c\udfaf **Smart & Secure Serialization**: Automatic handling of `dict`, `list`, `bool`, `bytes`, `int`, `float`, and `numpy` arrays using JSON-based serialization (no pickle!)\n- \ud83d\udd10 **Security First**: No pickle serialization means no remote code execution vulnerabilities\n- \ud83c\udfb5 **Media Processing**: Built-in converters for images, audio, and video files\n- \ud83d\udce1 **Pub/Sub Made Easy**: Simplified publish/subscribe with automatic JSON serialization\n- \ud83d\udd27 **Flexible Configuration**: Support for custom Redis clients and connection settings\n- \ud83d\udee1\ufe0f **Resilient Operations**: Built-in retry mechanisms with `@with_retry` decorator\n- \ud83d\udce6 **Batch Operations**: Efficient `batch_set` and `batch_get` for bulk operations\n- \ud83c\udfa8 **Pretty Logging**: Enhanced logging with pretty-loguru integration\n- \ud83d\udd27 **Flexible Configuration**: Simple configuration with Python dataclasses\n\n## \ud83d\udce6 Installation\n\n### Basic Installation\n```bash\npip install redis-toolkit\n```\n\n### With Media Processing\n```bash\n# For image processing\npip install redis-toolkit[cv2]\n\n# For audio processing (basic)\npip install redis-toolkit[audio]\n\n# For audio processing (with MP3 support)\npip install redis-toolkit[audio-full]\n\n# For complete media support\npip install redis-toolkit[all]\n```\n\n## \ud83d\ude80 Quick Start\n\n### Basic Usage\n\n```python\nfrom redis_toolkit import RedisToolkit\nfrom redis import Redis\n\n# Method 1: Pass existing Redis instance\nredis_client = Redis(host='localhost', port=6379, decode_responses=False)\ntoolkit = RedisToolkit(redis=redis_client)\n\n# Method 2: Use configuration (with connection pooling)\nfrom redis_toolkit import RedisConnectionConfig\nconfig = RedisConnectionConfig(host='localhost', port=6379)\ntoolkit = RedisToolkit(config=config)\n\n# Method 3: Use defaults\ntoolkit = RedisToolkit()\n\n# Store different data types\ntoolkit.setter(\"user\", {\"name\": \"Alice\", \"age\": 25, \"active\": True})\ntoolkit.setter(\"scores\", [95, 87, 92, 88])\ntoolkit.setter(\"flag\", True)\ntoolkit.setter(\"binary_data\", b\"Hello, World!\")\n\n# Automatic deserialization\nuser = toolkit.getter(\"user\")      # {'name': 'Alice', 'age': 25, 'active': True}\nscores = toolkit.getter(\"scores\")  # [95, 87, 92, 88]\nflag = toolkit.getter(\"flag\")      # True (bool, not string)\n\n# Access the underlying Redis client for advanced operations\nraw_value = toolkit.client.get(\"user\")  # Get raw bytes\ntoolkit.client.expire(\"user\", 3600)     # Set TTL\n```\n\n### Media Processing with Converters\n\n```python\nfrom redis_toolkit import RedisToolkit\nfrom redis_toolkit.converters import encode_image, decode_image\nfrom redis_toolkit.converters import encode_audio, decode_audio\nimport cv2\nimport numpy as np\n\ntoolkit = RedisToolkit()\n\n# Image processing\nimg = cv2.imread('photo.jpg')\nimg_bytes = encode_image(img, format='jpg', quality=90)\ntoolkit.setter('my_image', img_bytes)\n\n# Retrieve and decode\nretrieved_bytes = toolkit.getter('my_image')\ndecoded_img = decode_image(retrieved_bytes)\n\n# Audio processing\nsample_rate = 44100\naudio_data = np.sin(2 * np.pi * 440 * np.linspace(0, 1, sample_rate))\naudio_bytes = encode_audio(audio_data, sample_rate=sample_rate)\ntoolkit.setter('my_audio', audio_bytes)\n\n# Retrieve and decode\nretrieved_audio = toolkit.getter('my_audio')\ndecoded_rate, decoded_audio = decode_audio(retrieved_audio)\n```\n\n### Pub/Sub with Media Sharing\n\n```python\nfrom redis_toolkit import RedisToolkit\nfrom redis_toolkit.converters import encode_image\nimport base64\n\n# Setup subscriber\ndef message_handler(channel, data):\n    if data.get('type') == 'image':\n        # Decode base64 image data\n        img_bytes = base64.b64decode(data['image_data'])\n        img = decode_image(img_bytes)\n        print(f\"Received image: {img.shape}\")\n\nsubscriber = RedisToolkit(\n    channels=[\"media_channel\"],\n    message_handler=message_handler\n)\n\n# Setup publisher\npublisher = RedisToolkit()\n\n# Send image through pub/sub\nimg_bytes = encode_image(your_image_array, format='jpg', quality=80)\nimg_base64 = base64.b64encode(img_bytes).decode('utf-8')\n\nmessage = {\n    'type': 'image',\n    'user': 'Alice',\n    'image_data': img_base64,\n    'timestamp': time.time()\n}\n\npublisher.publisher(\"media_channel\", message)\n```\n\n### Advanced Configuration\n\n```python\nfrom redis_toolkit import RedisToolkit, RedisOptions, RedisConnectionConfig\n\n# Custom Redis connection\nconfig = RedisConnectionConfig(\n    host=\"localhost\",\n    port=6379,\n    db=1,\n    password=\"your_password\"\n)\n\n# Custom options\noptions = RedisOptions(\n    is_logger_info=True,\n    max_log_size=512,\n    subscriber_retry_delay=10,\n    log_level=\"INFO\",  # Support for pretty-loguru\n    log_path=\"./logs\"  # Optional file logging\n)\n\n# Method 1: With configuration\ntoolkit = RedisToolkit(config=config, options=options)\n\n# Method 2: With existing Redis client\nimport redis\npool = redis.ConnectionPool(host='localhost', port=6379, db=0)\nredis_client = redis.Redis(connection_pool=pool)\ntoolkit = RedisToolkit(redis=redis_client, options=options)\n\n# Access the underlying Redis client\nprint(f\"Redis server info: {toolkit.client.info()['redis_version']}\")\n```\n\n\n### Batch Operations\n\n```python\n# Batch set\ndata = {\n    \"user:1\": {\"name\": \"Alice\", \"score\": 95},\n    \"user:2\": {\"name\": \"Bob\", \"score\": 87},\n    \"user:3\": {\"name\": \"Charlie\", \"score\": 92}\n}\ntoolkit.batch_set(data)\n\n# Batch get\nkeys = [\"user:1\", \"user:2\", \"user:3\"]\nresults = toolkit.batch_get(keys)\n```\n\n### Context Manager\n\n```python\nwith RedisToolkit() as toolkit:\n    toolkit.setter(\"temp_data\", {\"session\": \"12345\"})\n    data = toolkit.getter(\"temp_data\")\n    # Automatic cleanup on exit\n```\n\n## \ud83c\udfa8 Media Converters\n\n### Image Converter\n\n```python\nfrom redis_toolkit.converters import get_converter\n\n# Create image converter with custom settings\nimg_converter = get_converter('image', format='png', quality=95)\n\n# Encode image\nencoded = img_converter.encode(image_array)\n\n# Decode image\ndecoded = img_converter.decode(encoded)\n\n# Resize image\nresized = img_converter.resize(image_array, width=800, height=600)\n\n# Get image info\ninfo = img_converter.get_info(encoded_bytes)\n```\n\n### Audio Converter\n\n```python\nfrom redis_toolkit.converters import get_converter\n\n# Create audio converter\naudio_converter = get_converter('audio', sample_rate=44100, format='wav')\n\n# Encode from file\nencoded = audio_converter.encode_from_file('song.mp3')\n\n# Encode from array\nencoded = audio_converter.encode((sample_rate, audio_array))\n\n# Decode audio\nsample_rate, audio_array = audio_converter.decode(encoded)\n\n# Normalize audio\nnormalized = audio_converter.normalize(audio_array, target_level=0.8)\n\n# Get file info\ninfo = audio_converter.get_file_info('song.mp3')\n```\n\n### Video Converter\n\n```python\nfrom redis_toolkit.converters import get_converter\n\n# Create video converter\nvideo_converter = get_converter('video')\n\n# Encode video file\nencoded = video_converter.encode('movie.mp4')\n\n# Save video bytes to file\nvideo_converter.save_video_bytes(encoded, 'output.mp4')\n\n# Get video info\ninfo = video_converter.get_video_info('movie.mp4')\n\n# Extract frames\nframes = video_converter.extract_frames('movie.mp4', max_frames=10)\n```\n\n## \ud83c\udfaf Use Cases\n\n### Real-time Image Sharing\nPerfect for applications that need to share images instantly across different services or users.\n\n### Audio/Video Streaming\nHandle audio and video buffers efficiently with automatic encoding/decoding.\n\n### Multi-media Chat Applications\nBuild chat applications that support text, images, audio, and video messages.\n\n### Data Analytics Dashboards\nShare real-time charts and visualizations between different components.\n\n### IoT Data Processing\nHandle sensor data, images from cameras, and audio from microphones.\n\n## \u2699\ufe0f Configuration Options\n\n### Redis Connection Config\n```python\nRedisConnectionConfig(\n    host='localhost',\n    port=6379,\n    db=0,\n    password=None,\n    username=None,\n    encoding='utf-8',\n    decode_responses=False,     # Always False for proper serialization\n    socket_keepalive=True,\n    socket_keepalive_options=None,\n    connection_timeout=None,    # Connection timeout in seconds\n    socket_timeout=None,        # Socket operation timeout in seconds\n    retry_on_timeout=False,     # Retry on timeout\n    retry_on_error=True,        # Retry on error\n    health_check_interval=30,   # Health check interval in seconds\n    ssl=False,                  # Use SSL/TLS\n    ssl_keyfile=None,          # SSL key file path\n    ssl_certfile=None,         # SSL certificate file path\n    ssl_ca_certs=None,         # SSL CA certificates file path\n    ssl_cert_reqs='required'   # SSL certificate requirement level\n)\n```\n\n### Redis Options\n```python\nRedisOptions(\n    is_logger_info=True,           # Enable logging\n    max_log_size=256,              # Max log entry size\n    subscriber_retry_delay=5,      # Subscriber reconnection delay\n    subscriber_stop_timeout=5,     # Subscriber stop timeout\n    log_level=\"INFO\",              # Log level (DEBUG, INFO, WARNING, ERROR)\n    log_path=None,                 # Log file path (None for console only)\n    max_value_size=10*1024*1024,   # Max value size in bytes (10MB)\n    max_key_length=512,            # Max key length\n    enable_validation=True,        # Enable validation\n    use_connection_pool=True,      # Use shared connection pool\n    max_connections=None           # Max connections (None for unlimited)\n)\n```\n\n### Configuration Validation\n\nBoth `RedisOptions` and `RedisConnectionConfig` support validation:\n\n```python\n# Validate configuration before use\noptions = RedisOptions(log_level=\"DEBUG\")\noptions.validate()  # Raises ValueError if invalid\n\nconfig = RedisConnectionConfig(port=6379, ssl=True)\nconfig.validate()  # Raises ValueError if invalid\n\n# RedisToolkit automatically validates options on initialization\ntoolkit = RedisToolkit(config=config, options=options)\n```\n\n## \ud83d\udccb Requirements\n\n- Python >= 3.7\n- Redis >= 4.0\n- redis-py >= 4.0\n\n### Optional Dependencies\n- **OpenCV**: For image and video processing (`pip install opencv-python`)\n- **NumPy**: For array operations (`pip install numpy`)\n- **SciPy**: For audio processing (`pip install scipy`)\n- **SoundFile**: For advanced audio formats (`pip install soundfile`)\n- **Pillow**: For additional image formats (`pip install Pillow`)\n\n## \ud83e\uddea Testing\n\n```bash\n# Install development dependencies\npip install redis-toolkit[dev]\n\n# Run tests\npytest\n\n# Run with coverage\npytest --cov=redis_toolkit\n\n# Run specific test categories\npytest -m \"not slow\"  # Skip slow tests\npytest -m integration  # Run integration tests only\n```\n\n## \ud83e\udd1d Contributing\n\nWe welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## \ud83d\udcc4 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## \ud83d\udcde Contact & Support\n\n- **Documentation**: [https://joneshong.github.io/redis-toolkit/](https://joneshong.github.io/redis-toolkit/)\n- **Issues**: [GitHub Issues](https://github.com/JonesHong/redis-toolkit/issues)\n- **Discussions**: [GitHub Discussions](https://github.com/JonesHong/redis-toolkit/discussions)\n- **PyPI**: [https://pypi.org/project/redis-toolkit/](https://pypi.org/project/redis-toolkit/)\n\n## \ud83c\udf1f Showcase\n\n**Used by these awesome projects:**\n- Add your project here by opening a PR!\n\n---\n\n<p align=\"center\">\n  Made with \u2764\ufe0f by the Redis Toolkit Team\n</p>\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Enhanced Redis wrapper with multi-type data support and pub/sub automation",
    "version": "0.4.0",
    "project_urls": {
        "Bug Reports": "https://github.com/JonesHong/redis-toolkit/issues",
        "Homepage": "https://github.com/JonesHong/redis-toolkit",
        "Repository": "https://github.com/JonesHong/redis-toolkit.git"
    },
    "split_keywords": [
        "redis",
        " toolkit",
        " pubsub",
        " serialization",
        " buffer",
        " audio",
        " video",
        " image",
        " converter"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "8f7083cfbb7c67935fc074ddff042513a34c18c9a21a6f5921f0cbf412f599eb",
                "md5": "a7ae1ca2e1f681f1caf2222882696d26",
                "sha256": "da22921a1d77c3146a776f70f15d4a175836beb043d559e59ad434bc08db8120"
            },
            "downloads": -1,
            "filename": "redis_toolkit-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a7ae1ca2e1f681f1caf2222882696d26",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 41645,
            "upload_time": "2025-08-24T17:25:54",
            "upload_time_iso_8601": "2025-08-24T17:25:54.945888Z",
            "url": "https://files.pythonhosted.org/packages/8f/70/83cfbb7c67935fc074ddff042513a34c18c9a21a6f5921f0cbf412f599eb/redis_toolkit-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "dc92880b956a1e4890bf23649cabe02d4157a56b7cf3a7245d3d369b687802a4",
                "md5": "7eba3e69106fdca1cb8f2332d296b23f",
                "sha256": "3c639ec1ce34713d9ce8cc3d86ddcad96d036ede473625af2684f606b818f7cd"
            },
            "downloads": -1,
            "filename": "redis_toolkit-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "7eba3e69106fdca1cb8f2332d296b23f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 71171367,
            "upload_time": "2025-08-24T17:26:03",
            "upload_time_iso_8601": "2025-08-24T17:26:03.049927Z",
            "url": "https://files.pythonhosted.org/packages/dc/92/880b956a1e4890bf23649cabe02d4157a56b7cf3a7245d3d369b687802a4/redis_toolkit-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-24 17:26:03",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "JonesHong",
    "github_project": "redis-toolkit",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "redis",
            "specs": [
                [
                    ">=",
                    "4.0.0"
                ]
            ]
        },
        {
            "name": "pretty-loguru",
            "specs": [
                [
                    ">=",
                    "1.1.3"
                ]
            ]
        }
    ],
    "lcname": "redis-toolkit"
}
        
Elapsed time: 1.13592s