python-redis-factory


Namepython-redis-factory JSON
Version 0.2.0 PyPI version JSON
download
home_pageNone
SummaryA universal Redis client factory for Python—just pass a single connection string (supporting standalone, Sentinel, or Cluster modes) and get back a ready-to-use redis.Redis instance.
upload_time2025-07-28 15:23:03
maintainerNone
docs_urlNone
authorNone
requires_python>=3.12
licenseMIT
keywords async client cluster connection factory redis sentinel
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python Redis Factory

[![CI](https://github.com/smirnoffmg/python-redis-factory/workflows/CI/badge.svg)](https://github.com/smirnoffmg/python-redis-factory/actions)
[![Test Coverage](https://codecov.io/gh/smirnoffmg/python-redis-factory/branch/main/graph/badge.svg)](https://codecov.io/gh/smirnoffmg/python-redis-factory)
[![Python Version](https://img.shields.io/badge/python-3.12%2B-blue.svg)](https://www.python.org/downloads/)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
[![PyPI Version](https://img.shields.io/pypi/v/python-redis-factory.svg)](https://pypi.org/project/python-redis-factory/)
[![Downloads](https://img.shields.io/pypi/dm/python-redis-factory.svg)](https://pypi.org/project/python-redis-factory/)

A universal Redis client factory for Python — just pass a single connection string and get back a ready-to-use `redis.Redis` instance (both sync and async).

## Features

- **Universal Interface**: Single API for standalone, Sentinel, and Cluster modes
- **Automatic Detection**: Detects deployment mode from URI
- **Async Support**: Full async/await support
- **Connection Pooling**: Automatic pool management
- **SSL Support**: Built-in SSL/TLS support

## Quick Start

```python
from python_redis_factory import get_redis_client
from redis import Redis
from redis.asyncio import Redis as AsyncRedis

# Standalone Redis (sync)
client: Redis = get_redis_client("redis://localhost:6379")

# Standalone Redis (async)
async_client: AsyncRedis = get_redis_client("redis://localhost:6379", async_client=True)

# Sentinel (sync)
sentinel_client: Redis = get_redis_client("redis+sentinel://sentinel1:26379/mymaster")

# Sentinel (async)
async_sentinel_client: AsyncRedis = get_redis_client("redis+sentinel://sentinel1:26379/mymaster", async_client=True)

# Cluster (sync)
cluster_client: Redis = get_redis_client("redis+cluster://node1:7000,node2:7001")

# Cluster (async)
async_cluster_client: AsyncRedis = get_redis_client("redis+cluster://node1:7000,node2:7001", async_client=True)

# SSL (sync)
ssl_client: Redis = get_redis_client("rediss://localhost:6379")

# SSL (async)
async_ssl_client: AsyncRedis = get_redis_client("rediss://localhost:6379", async_client=True)
```

## Installation

```bash
pip install python-redis-factory
```

## Development

```bash
# Install dependencies
make install

# Run tests
make test-parallel

# Run quality checks
make ci

# Show all commands
make help
```

## Documentation

- [Examples](examples/) - Comprehensive examples with Docker Compose
- [Release Guide](docs/RELEASE.md) - How to make releases
- [Release Checklist](docs/RELEASE_CHECKLIST.md) - Pre-release checklist

## Supported URI Formats

```
# Standalone
redis://[user:password@]host[:port][/db]
rediss://[user:password@]host[:port][/db]  # SSL

# Sentinel
redis+sentinel://[password@]sentinel1:port,sentinel2:port/service_name

# Cluster
redis+cluster://[password@]node1:port,node2:port
```


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "python-redis-factory",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": "Maksim Smirnov <smirnoffmg@gmail.com>",
    "keywords": "async, client, cluster, connection, factory, redis, sentinel",
    "author": null,
    "author_email": "Maksim Smirnov <smirnoffmg@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/47/5c/713cdc4511c0777882cc4ee801485e296cfca0e5614a76189e137a8b9eec/python_redis_factory-0.2.0.tar.gz",
    "platform": null,
    "description": "# Python Redis Factory\n\n[![CI](https://github.com/smirnoffmg/python-redis-factory/workflows/CI/badge.svg)](https://github.com/smirnoffmg/python-redis-factory/actions)\n[![Test Coverage](https://codecov.io/gh/smirnoffmg/python-redis-factory/branch/main/graph/badge.svg)](https://codecov.io/gh/smirnoffmg/python-redis-factory)\n[![Python Version](https://img.shields.io/badge/python-3.12%2B-blue.svg)](https://www.python.org/downloads/)\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)\n[![PyPI Version](https://img.shields.io/pypi/v/python-redis-factory.svg)](https://pypi.org/project/python-redis-factory/)\n[![Downloads](https://img.shields.io/pypi/dm/python-redis-factory.svg)](https://pypi.org/project/python-redis-factory/)\n\nA universal Redis client factory for Python \u2014 just pass a single connection string and get back a ready-to-use `redis.Redis` instance (both sync and async).\n\n## Features\n\n- **Universal Interface**: Single API for standalone, Sentinel, and Cluster modes\n- **Automatic Detection**: Detects deployment mode from URI\n- **Async Support**: Full async/await support\n- **Connection Pooling**: Automatic pool management\n- **SSL Support**: Built-in SSL/TLS support\n\n## Quick Start\n\n```python\nfrom python_redis_factory import get_redis_client\nfrom redis import Redis\nfrom redis.asyncio import Redis as AsyncRedis\n\n# Standalone Redis (sync)\nclient: Redis = get_redis_client(\"redis://localhost:6379\")\n\n# Standalone Redis (async)\nasync_client: AsyncRedis = get_redis_client(\"redis://localhost:6379\", async_client=True)\n\n# Sentinel (sync)\nsentinel_client: Redis = get_redis_client(\"redis+sentinel://sentinel1:26379/mymaster\")\n\n# Sentinel (async)\nasync_sentinel_client: AsyncRedis = get_redis_client(\"redis+sentinel://sentinel1:26379/mymaster\", async_client=True)\n\n# Cluster (sync)\ncluster_client: Redis = get_redis_client(\"redis+cluster://node1:7000,node2:7001\")\n\n# Cluster (async)\nasync_cluster_client: AsyncRedis = get_redis_client(\"redis+cluster://node1:7000,node2:7001\", async_client=True)\n\n# SSL (sync)\nssl_client: Redis = get_redis_client(\"rediss://localhost:6379\")\n\n# SSL (async)\nasync_ssl_client: AsyncRedis = get_redis_client(\"rediss://localhost:6379\", async_client=True)\n```\n\n## Installation\n\n```bash\npip install python-redis-factory\n```\n\n## Development\n\n```bash\n# Install dependencies\nmake install\n\n# Run tests\nmake test-parallel\n\n# Run quality checks\nmake ci\n\n# Show all commands\nmake help\n```\n\n## Documentation\n\n- [Examples](examples/) - Comprehensive examples with Docker Compose\n- [Release Guide](docs/RELEASE.md) - How to make releases\n- [Release Checklist](docs/RELEASE_CHECKLIST.md) - Pre-release checklist\n\n## Supported URI Formats\n\n```\n# Standalone\nredis://[user:password@]host[:port][/db]\nrediss://[user:password@]host[:port][/db]  # SSL\n\n# Sentinel\nredis+sentinel://[password@]sentinel1:port,sentinel2:port/service_name\n\n# Cluster\nredis+cluster://[password@]node1:port,node2:port\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A universal Redis client factory for Python\u2014just pass a single connection string (supporting standalone, Sentinel, or Cluster modes) and get back a ready-to-use redis.Redis instance.",
    "version": "0.2.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/smirnoffmg/python-redis-factory/issues",
        "Changelog": "https://github.com/smirnoffmg/python-redis-factory/blob/main/CHANGELOG.md",
        "Documentation": "https://github.com/smirnoffmg/python-redis-factory#readme",
        "Homepage": "https://github.com/smirnoffmg/python-redis-factory",
        "Repository": "https://github.com/smirnoffmg/python-redis-factory"
    },
    "split_keywords": [
        "async",
        " client",
        " cluster",
        " connection",
        " factory",
        " redis",
        " sentinel"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "856218d2e409fe2f79060759d6b0cea3703461850cd36a9ae55d7bb526576bc4",
                "md5": "64c9e7af450e680d791b6e6102f6b450",
                "sha256": "510b451ab8104a2677d619ec76ba4de38275f002144f5b3a303f77da7a8823e1"
            },
            "downloads": -1,
            "filename": "python_redis_factory-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "64c9e7af450e680d791b6e6102f6b450",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 12510,
            "upload_time": "2025-07-28T15:23:02",
            "upload_time_iso_8601": "2025-07-28T15:23:02.832318Z",
            "url": "https://files.pythonhosted.org/packages/85/62/18d2e409fe2f79060759d6b0cea3703461850cd36a9ae55d7bb526576bc4/python_redis_factory-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "475c713cdc4511c0777882cc4ee801485e296cfca0e5614a76189e137a8b9eec",
                "md5": "1161427a5a9900ca6242b442fc183f40",
                "sha256": "b057f3bf2c73d29bdf28b6e6c00cd8cc09bd547db547d710ba7a46222ba3d7f1"
            },
            "downloads": -1,
            "filename": "python_redis_factory-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "1161427a5a9900ca6242b442fc183f40",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 55341,
            "upload_time": "2025-07-28T15:23:03",
            "upload_time_iso_8601": "2025-07-28T15:23:03.764736Z",
            "url": "https://files.pythonhosted.org/packages/47/5c/713cdc4511c0777882cc4ee801485e296cfca0e5614a76189e137a8b9eec/python_redis_factory-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-28 15:23:03",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "smirnoffmg",
    "github_project": "python-redis-factory",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "python-redis-factory"
}
        
Elapsed time: 1.96375s