Skip to main content

Redis Mutator

GitHub

Inject another Redis connection to your Redis connection!

Installation

pip install redis-mutator

Uses

  1. Separate read-only functions to another Redis connection.
  2. Log functions as you use them.

How to Use

from redis_mutator import mutate, READ_METHOD_NAMES
from redis import Redis

redis = Redis(...)
read_only_redis = Redis(...)
mutate(redis, READ_METHOD_NAMES).use(read_only_redis)

redis.sadd("hello", "world!") # Uses `redis`.
redis.smembers("hello") # Uses `read_only_redis`.

Specify Method Names

from redis_mutator import mutate
from redis import Redis

redis = Redis(...)
my_other_redis = Redis(...)
mutate(redis, "sadd", "spop").use(my_other_redis)

redis.sadd("hello", "world!") # Uses `my_other_redis`.
redis.spop("hello", 1) # Uses `my_other_redis`.

redis.hset("hello", "world", "hi") # Uses `redis`.
redis.hget("hello", "world") # Uses `redis`.

Prefix & Postfix Hooks

from redis_mutator import mutate
from redis import Redis

redis = Redis(...)
my_other_redis = Redis(...)

def prefix(*args, **kwargs):
    print('Prefix called.')

def postfix(value):
    print('Postfix called.')

mutate(redis, "sadd", "spop").prefix(prefix)
mutate(redis, "sadd", "spop").postfix(postfix)

redis.sadd("hello", "world!")
# Prefix called.
# `redis.sadd(...)`
# Postfix called.

Override Methods

from redis_mutator import mutate
from redis import Redis

redis = Redis(...)
my_other_redis = Redis(...)

def prefix(*args, **kwargs):
    print('Hi-jacked!')

    return False # Return `False` to stop the process.

mutate(redis, "sadd", "spop").prefix(prefix)

redis.sadd("hello", "world!") # Hi-jacked!

Metadata

Release files for redis-mutator 0.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for redis-mutator 0.2.4
File Size Uploaded Provenance Actions
redis_mutator-0.2.4.tar.gz 3.1 kB Without provenance Details for redis_mutator-0.2.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for redis-mutator 0.2.4
File Interpreter ABI Platform Actions
redis_mutator-0.2.4-py3-none-any.whl Python 3 none any Details for redis_mutator-0.2.4-py3-none-any.whl

Total release size: 7.2 kB

Release files / redis_mutator-0.2.4.tar.gz

Download URL redis_mutator-0.2.4.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7bd9fa8037a94c90982462fa084c7a595af5b15682a414b9966c7b497cbfdc7b
BLAKE2b-256 checksum
How to use checksums
357e408bcbf66250a386b96fae76e38492f183f73cb0c36ac40183b07820ded4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.8.10 Linux/5.15.0-102-generic

Release files / redis_mutator-0.2.4-py3-none-any.whl

Download URL redis_mutator-0.2.4-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e4c00c6be7aab1f49e07a4063fa832166cfbee76fe95e4a9d015e622e0e7ae98
BLAKE2b-256 checksum
How to use checksums
e8f871dac80249161cc177d8ae881cf24234241dad58916db4a0eeafaf8b0bcf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.8.10 Linux/5.15.0-102-generic

Security for redis-mutator 0.2.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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