Skip to main content

redis-enterprise Python bindings

Python bindings for the Redis Enterprise REST API, built with PyO3 on top of the redis-enterprise Rust crate.

Scope and philosophy

Goals

  • Convenience, not parity. The Python layer exposes the most common read and inspection operations — cluster info, database listing, node status, user listing — plus raw HTTP access for anything else.
  • Sync and async. Every named method ships as both a blocking _sync variant and an async/await coroutine so it fits naturally in scripts, notebooks, or async applications.
  • Plain Python dicts. All responses are deserialized to Python dict/list (via serde_json). No custom model classes to learn; use SimpleNamespace, pydantic, or dataclasses as you prefer.
  • Zero required event loop. The _sync variants drive a dedicated Tokio runtime internally, so they work from plain Python scripts or Jupyter notebooks without any asyncio setup.

Non-goals

  • Full API parity with the Rust crate. Write operations (database create/update/ delete), CRDB management, module uploads, and so on are outside the initial scope.
  • Typed response models. Raw dicts keep the binding thin and avoid a maintenance burden on the Python side.
  • Re-exporting every Rust builder knob. For advanced configuration use the Rust crate directly.

Installation

pip install redis-enterprise

Requires Python ≥ 3.9. Wheels are published for Linux (x86_64, aarch64), macOS (x86_64, arm64), and Windows (x86_64) via the publish-python CI workflow.


Quick start

from redis_enterprise import EnterpriseClient

# Explicit configuration
client = EnterpriseClient(
    base_url="https://cluster.example.com:9443",
    username="admin@redis.local",
    password="secret",
    insecure=True,       # skip TLS verification — dev/lab only
    timeout_secs=30,     # optional; omit to use the default
)

# Or let the client read credentials from environment variables
client = EnterpriseClient.from_env()

# ── Synchronous ──────────────────────────────────────────────
cluster = client.cluster_info_sync()
print(cluster["name"])

dbs = client.databases_sync()
for db in dbs:
    print(db["name"], db["uid"])

# ── Async ────────────────────────────────────────────────────
import asyncio

async def main():
    cluster = await client.cluster_info()
    print(cluster["name"])

asyncio.run(main())

API reference

All methods return plain Python dict or list[dict].

Constructor

Signature Description
EnterpriseClient(base_url, username, password, insecure=False, timeout_secs=None) Build a client explicitly
EnterpriseClient.from_env() Read credentials from environment variables (see Environment variables)

Cluster

Async Sync Returns Description
cluster_info() cluster_info_sync() dict Cluster name, version, and topology summary
cluster_stats() cluster_stats_sync() dict Cluster-level performance counters
license() license_sync() dict License details (expiry, limits, active features)

Databases

Async Sync Returns Description
databases() databases_sync() list[dict] All databases (BDBs) on the cluster
database(uid) database_sync(uid) dict Single database by numeric UID

Nodes

Async Sync Returns Description
nodes() nodes_sync() list[dict] All nodes in the cluster
node(uid) node_sync(uid) dict Single node by numeric UID

Users

Async Sync Returns Description
users() users_sync() list[dict] All users configured on the cluster

Raw HTTP access

Use the raw pass-through methods for any endpoint not yet covered by a named method. Paths are relative to the cluster base URL (e.g. "/v1/bdbs").

# GET
roles = client.get_sync("/v1/roles")

# POST — body is a plain Python dict
new_role = client.post_sync(
    "/v1/roles",
    {"name": "ops-reader", "management": "db_viewer"},
)

# DELETE
client.delete_sync(f"/v1/roles/{role_id}")

# Async equivalents
roles = await client.get("/v1/roles")
new_role = await client.post(
    "/v1/roles",
    {"name": "ops-reader", "management": "db_viewer"},
)
await client.delete(f"/v1/roles/{role_id}")
Async Sync Signature Description
get(path) get_sync(path) path: str Raw GET — returns parsed JSON as dict or list
post(path, body) post_sync(path, body) path: str, body: dict Raw POST — body is serialized to JSON
delete(path) delete_sync(path) path: str Raw DELETE — returns parsed JSON response

Error handling

from redis_enterprise import EnterpriseClient, RedisEnterpriseError

try:
    db = client.database_sync(9999)
except ValueError:
    print("Database not found")
except RedisEnterpriseError as e:
    print(f"API error: {e}")
except ConnectionError as e:
    print(f"Could not reach cluster: {e}")
Rust error variant Python exception Typical cause
ConnectionError ConnectionError Network unreachable, DNS failure, TLS handshake error
AuthenticationFailed RedisEnterpriseError Wrong credentials
Unauthorized RedisEnterpriseError Valid credentials but insufficient privilege
NotFound ValueError UID or path does not exist on the cluster
ValidationError ValueError Malformed request body or invalid parameter
Other RuntimeError Unexpected server-side or deserialization error

RedisEnterpriseError is a custom exception class exported by the module and is a subclass of Exception.


Planned expansion — first tranche

The following operations are targeted for the next minor release:

Method Description
node_stats(uid) / node_stats_sync(uid) Per-node performance counters
database_stats(uid) / database_stats_sync(uid) Per-database performance counters
roles() / roles_sync() RBAC role listing
put(path, body) / put_sync(path, body) Raw PUT for the HTTP pass-through layer

Mutation operations (database create/update/delete, user management) are under consideration for a subsequent tranche but are not committed.


Testing strategy

Unit tests live in python/tests/ and use pytest + pytest-asyncio. Integration tests require a live Redis Enterprise cluster; see the live-validation runbook for standing one up with Docker Compose.

# Install dev extras
pip install -e "python/[dev]"

# Unit tests (no cluster required)
pytest python/tests/unit/

# Integration tests (cluster required — see docs/live-validation.md)
pytest python/tests/integration/

Release and packaging

The publish-python GitHub Actions workflow fires on version tags (v*). It uses maturin to compile the PyO3 extension module for each supported platform and architecture, then publishes the wheels and an sdist to PyPI.

The Python package version is derived from python/Cargo.toml, which is kept in sync with the root crate version.


Environment variables

These variables are read by EnterpriseClient.from_env():

Variable Default Description
REDIS_ENTERPRISE_URL https://localhost:9443 Cluster base URL
REDIS_ENTERPRISE_USER (required) Username
REDIS_ENTERPRISE_PASSWORD (required) Password
REDIS_ENTERPRISE_INSECURE false Set true to skip TLS certificate verification (dev/lab only)
REDIS_ENTERPRISE_CA_CERT (optional) Path to a custom CA certificate PEM file

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

redis_enterprise-0.10.0.tar.gz (298.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

redis_enterprise-0.10.0-cp39-abi3-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9+Windows x86-64

redis_enterprise-0.10.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

redis_enterprise-0.10.0-cp39-abi3-macosx_11_0_arm64.whl (3.0 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file redis_enterprise-0.10.0.tar.gz.

File metadata

  • Download URL: redis_enterprise-0.10.0.tar.gz
  • Upload date:
  • Size: 298.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for redis_enterprise-0.10.0.tar.gz
Algorithm Hash digest
SHA256 74241d1c76734f9462e510678ad45e2581acfec9b3fa5c371f8d273b4372a5fc
MD5 54fc609582cf83a09b365a00f6707752
BLAKE2b-256 eac939c684184d7dc5e9a62d0c034d12fe01956c2b3f601bd3a4e618596003fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for redis_enterprise-0.10.0.tar.gz:

Publisher: python.yml on redis-developer/redis-enterprise-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file redis_enterprise-0.10.0-cp39-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for redis_enterprise-0.10.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 5f795256dbaef7901ba1959a6b212ed7dca8d289ed60f76bd59b7de35df07e62
MD5 1b9e39bcbd9f39279c62ab91dc521e7d
BLAKE2b-256 07d23227cc93af06a43e324735fca1b705e977ab4cd9ac26673710ccd47f5f16

See more details on using hashes here.

Provenance

The following attestation bundles were made for redis_enterprise-0.10.0-cp39-abi3-win_amd64.whl:

Publisher: python.yml on redis-developer/redis-enterprise-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file redis_enterprise-0.10.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for redis_enterprise-0.10.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f4bb6371c3cc2ad96a9c029dc832634886bfb9a22de2209795fff0f6fe861fe3
MD5 73355d37c0545554f36170dc91e27286
BLAKE2b-256 eec7a25ba17026f33c1bf2825219d332ab93bccba85f262ecffadacafe5e89bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for redis_enterprise-0.10.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: python.yml on redis-developer/redis-enterprise-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file redis_enterprise-0.10.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for redis_enterprise-0.10.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 48c3995ae9ea681f6edd913ba531441913f23fe430a48172d6f93ab31331ed87
MD5 3fcda699b36409bcdd598cfb4f3ee1fa
BLAKE2b-256 81c2ad6e31c5b866eb494bac7516f5a47696f5a9e178ed3ace0d65354409ec5e

See more details on using hashes here.

Provenance

The following attestation bundles were made for redis_enterprise-0.10.0-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: python.yml on redis-developer/redis-enterprise-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.10.0 This release

4 files

0.9.1

4 files

0.9.0

4 files

0.8.7

4 files

0.8.6

4 files

0.8.3

4 files

0.1.0

4 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page