Saravanan666/pypi-org huggingface dataset:
Package: redislightning
RedisLightning 🔥by Gautam Sharmahttp://gsharma.devRedisLightning 🔥 is a client library that emulates Redis-like features by leveraging gRPC communication. It provides a lightweight and efficient way to interact with a Redis-like server implemented using gRPC, offering developers a fast and seamless experience.FeaturesEmulates Redis-like functionalityUtilizes gRPC for communicationWritten in Python for ease of use and integrationLightweight and efficientInstallationTo install the redislightning Python client library, you can use pip:pipinstallredislightning==0.1UsageHere's an example demonstrating how to use the redislightning client library:from__future__importprint_functionimportloggingfromredislightningimportredislightningasrldefrun():# Initialize the Client with the server portc=rl.Client(50051)# Initialize the connectionc.init_connection()# Perform some Redis-like operationsforidxinrange(1,10):k=input("Set Key: ")v=input("Set Value: ")c.set(k,v)# Get the cached value backcached_val=c.get(k)print("Cached value of key{}is{}".format(k,cached_val))if__name__=="__main__":# Configure logginglogging.basicConfig()# Run the examplerun()AboutThe redislightning-server is a library written purely in C++, utilizing gRPC as its communication layer. Despite its small size, this library is powerful and suitable for use in production environments. The aim is to provide developers with the best possible experience while maintaining extreme speed and efficiency.ContributingContributions to redislightning are welcome! Whether it's reporting bugs, suggesting new features, or contributing code, your input is valuable.LicenseThis project is licensed under the MIT License - see theLICENSEfile for details..
Package: redis-limpyd
LimpydLimpydprovides aneasyway to store objects inRedis,without losing the power and the control of the Redis API, in alimpidway, with just as abstraction as needed.Featuring:Don’t care about keys,limpyddo it for youRetrieve objects from some of their attributesRetrieve objects collectionCRUD abstractionPowerful indexing and filteringKeep the power of all theRedis data typesin your own codeExample of configuration:fromlimpydimportmodelmain_database=model.RedisDatabase(host="localhost",port=6379,db=0)classBike(model.RedisModel):database=main_databasename=model.InstanceHashField(indexable=True,unique=True)color=model.InstanceHashField()wheels=model.StringField(default=2)So you can use it like this:>>>mountainbike=Bike(name="mountainbike")>>>mountainbike.wheels.get()'2'>>>mountainbike.wheels.incr()>>>mountainbike.wheels.get()'3'>>>mountainbike.name.set("tricycle")>>>tricycle=Bike.collection(name="tricycle")[0]>>>tricycle.wheels.get()'3'>>>tricycle.hmset(color="blue")True>>>tricycle.hmget('color')['blue']>>>tricycle.hmget('color','name')['blue','tricycle']>>>tricycle.color.hget()'blue'>>>tricycle.color.hset('yellow')True>>>tricycle.hmget('color')['yellow']InstallPython versions2.7and3.5to3.8are supported (CPython and PyPy).Redis-pyversions>= 3are supported, with redis-server versions>= 3.pipinstallredis-limpydForRedis-pyversions < 3, please use limpyd version1.3.1(or later in1.xversions)DocumentationSeehttps://redis-limpyd.readthedocs.io/for a full documentationChangelogSeeCHANGELOG.rstMaintainersStéphane «Twidi» AngelYohan BonifaceExtensionsA bundle of great extensions:Limpyd-extensionsA queue/task/job manager:Limpyd-jobs
Package: redislite-hotqueue
Info:HotQueue is a Python library that allows you to use Redis as a message queue within your Python programs.Author:Richard Henry (http://github.com/richardhenry), Dwight Hubbard (http://github.com/dwighthubbard)About HotQueueHotQueue is a Python library that allows you to useRedisas a message queue within
your Python programs.This fork of HotQueue uses redislite to allow running without installing and running a separate Redis server.To install it, run:pip install -U redislite-hotqueueThe best place to get started isthe documentation.
Package: redis-lock-py
Redis Lock with PubSubRedis distributed lock implementation for Python based on Pub/Sub messaging.1. FeaturesEnsure atomicity by using SETNX operationPub/Sub messaging system between the client waiting to get the lock and holding the lockForce timeout to avoid infinite loops when trying to acquire lockAsync is supported2. Installation$>pipinstallredis-lock-pyDependenciesPython >= 3.7redis-py >= 4.2.03. Usage3.1 Basic Exampleimportredisfromredis_lockimportRedisLockclient=redis.Redis(host="127.0.0.1",port=6379)name="foo"lock=RedisLock(client,name)ifnotlock.acquire():raiseException("Fail to acquire lock")print("Acquired lock successfully!")lock.release()redis-pylibrary is required for redis connection objects.
TheRedisLock.releasemethod must be invoked to release the lock after acquiring a lock successfully by callingRedisLock.acquiremethod with returnedTrue.3.2 Using Context Managersimportredisfromredis_lockimportRedisLockclient=redis.Redis(host="127.0.0.1",port=6379)withRedisLock(client,"foo",blocking_timeout=10):print("Acquired lock successfully!")If the part that releases the lock is missing after acquire a lock,
all the clients that access the samenamemay not be able to acquire the lock.
To prevent this unexpected malfunction from happening, programmed to unlock the lock by itself at the end of thewithcontext.
Both examples in3.1and3.2work the same way.3.3 Using Spin Lockimportredisfromredis_lockimportRedisSpinLockclient=redis.Redis(host="127.0.0.1",port=6379)lock=RedisSpinLock(client,"foo")ifnotlock.acquire(blocking=True,sleep_time=0.1):raiseException("Fail to acquire lock")print("Acquired lock successfully!")lock.release()Spin lock is also available,
but not recommended unless there is a compelling reason to use them because of inefficiency compare to the Pub/Sub messaging system.3.4 With Asynciofromredis.asyncioimportRedisfromredis_lock.asyncioimportRedisLockclient=Redis(host="127.0.0.1",port=6379)asyncwithRedisLock(client,"foo",blocking_timeout=10):print("Acquired lock successfully!")redis-locksupports asyncio platform.System Flow
Package: redis-lru
redis-lruInstallationpipinstallredis-lruIntroductionIt’s often useful to have an lru redis cache. Of course, it’s also desirable not to have the cache grow too large, and cache expiration is often desirable.
This module provides such a cache.redis-lru supports CPython 3.4+For the most part, you can just use it like this:importredisfromredis_lruimportRedisLRUclient=redis.StrictRedis()cache=RedisLRU(client)@cachedeff(x):print("Calling f({})".format(x))returnxf(3)# This will print "Calling f(3)", will return 3f(3)# This will not print anything, but will return 3 (unless 15 minutes have passed between the first and second function call).Additionally a datetime.time object can be provided to clear the cache at a specific time of the day:@cache(expire_on=datetime.time(hour=8))# clear at 08:00 o'clockdefb(x):print("Calling f({})".format(x))returnx0.1.2Fixed support of non-hashable values0.1.1Added newexpire_onparameter for @cache & RedisLRU support set ttl bydatetime.timeobjects0.1.0Refactor RedisLRU class for a clean and neat implement.Stop supporting Python 2.Fix bugs in test cases.Added clean cache option at process exit.0.0.4Generateunique_keyautomatically so your may never get touch this argument.Improved exception processing, now you won’t receive any exception by default.Added unittest forredis_lru_cachedecorator andRedisLRUCacheDictAdded more type of cache usage statistic type likePOP,DELetc.Added changes log.
Package: redis-mass-get
Redis Mass GetQueries your Redis using KEYS and MGET to write the key/value to thestdoutor a file. It supports the formats: text, json and csv.InstallationInstall from PIP:pipinstallredis-mass-getCLI usageThe project can be used as a CLI tool:usage: redis-mass-get [-h] [-q] [-f {text,csv,json}] [-d DESTINATION] [-jd] [-c CHUNCKS] [-och] url key

Queries Redis using KEYS and MGET. This will efficiently retreive all keys and values. They can be stored/visualized in different modes: - text (default): odd lines are keys, even lines values. - csv: comma-separated format. - json: JSON-array. Use -jd to decode the JSON value.

positional arguments:
  url                   Full Redis URL.
  key                   The key to query on.

optional arguments:
  -h, --help            show this help message and exit
  -q, --quiet           Don't show information about the progress.
  -f {text,csv,json}, --format {text,csv,json}
                        The format in which the keys of values should be.
  -d DESTINATION, --destination DESTINATION
                        Writes the output to a file.
  -jd, --json_decode    Enables JSON decode when writing to JSON.
  -c CHUNCKS, --chuncks CHUNCKS
                        How many keys should be queried at once? Default is 10,000.
  -och, --omit_csv_header
                        Don't render a CSV header.The aliasrmgorredis_mass_getwill work as well in the console.APIThe API can be used like this:fromredis_mass_getimportRedisQuery# pluralize will return the result or Noneq=RedisQuery("redis://my.amazing.redis.url")# query datadata=q.query("prefix*")# data is returned as:# [(key1, value1), (key2, value2)]# write data to file# TXT:q.query_and_write_csv(self,"prefix*","my.file.path.txt")# CSV:q.query_and_write_csv(self,"*postfix","my.file.path.csv")# JSONq.query_and_write_csv(self,"*contains*","my.file.path.csv",parse_value_as_json=True)You could also write your own implementation ofProcessorBaseand callquery_with_processor.DevelopmentIf you want to contribute to local development, please consultthe local development page. More information
on the reasoning behind this package can be found at this blog:Reading multiple key/values from Redis.
Package: redis-migrate
Redis MigrateSimple command line tool for redis data migration (minimal functionality)It is useful when you're not able to useslaveofcommand (e.g.slaveofcommand is not available in ElastiCache) or should migrate from multiple redis servers to a single server.Installationpipinstallredis-migrateUsage#Basicusageredis-migrate srchost[:port][/db] dsthost[:port][/db] [--all-keys=false] [--procs=1]#Migratethekeysfromdb0ofsourcehosttodb1ofdestinationhost.redis-migrate srchost dsthost/1#Ifyoudon'twanttoreplaceexistingkeys,use`--no-replace`option.redis-migrate srchost dsthost/1 --no-replace#Migratetheentirekeysfromsourcehostat6380porttodestinationhost.#Itwillignore`/db`number.redis-migrate srchost:6380 dsthost --all-keys#Youcanalsosetprocessnumbertousemultiprocessingforspeedup.#Itworksonlywith`--all-keys`.redis-migrate srchost dsthost --all-keys --procs 4LicenseMITStashed changes
Package: redis-mongo-postgres-create-read-user
Script for creating read only user for MongoDB, PostgreSQL, RedisPostgresQLcreate-read-user postgres --uri Postgres_URI -u USERNAME -p PASSWORDRediscreate-read-user redis --uri Redis_URI -u USERNAME -p PASSWORDMongoDBcreate-read-user mongodb --uri Mongo_URI -u USERNAME -p PASSWORD
Package: redis-mongo-postgres-read-user
Script for creating read only user for MongoDB, PostgreSQL, RedisPostgresQLcreate-read-user postgres --uri Postgres_URI -u USERNAME -p PASSWORDRediscreate-read-user redis --uri Redis_URI -u USERNAME -p PASSWORDMongoDBcreate-read-user mongodb --uri Mongo_URI -u USERNAME -p PASSWORD
Package: redis-monitor
redis-monitor is a web app base onPython Flask + SQLAchemy + Redis + React.Aims to deploy a redis monitor platform easilyHow to deploy & run ?> pip install redis-monitorredis-monitor initwill init config into HOME dir,then you can modify it or not.redis-monitor createdb : will init database. (optional)redis-monitor start : run web server, with default port 9527 (LZSB)> then visit ip:9527
Package: redis-namespace
redis-namespaceredis-namespacefor pythonRedis namespace provides an interface to a namespaced subset of yourrediskeyspace (e.g., keys with a common beginning), and requires theredis-py.importredisfromredis_namespaceimportStrictRedisredis_connection=redis.StrictRedis()namespaced_redis=StrictRedis(namespace='ns:')namespaced_redis.set('foo','bar')# redis_connection.set('ns:foo', 'bar')namespaced_redis.get('foo')redis_connection.get('ns:foo')namespaced_redis.delete('foo')namespaced_redis.get('foo')redis_connection.get('ns:foo')Installationpip install redis-namespace
Package: redis_netlock
###一个用redis实现的分布式锁，含有retry和timetout的功能。* 用with做锁的逻辑语句* timeout避免了避免了任务出现异常，没有做delete操作* 对于长时间的业务，增加retry重试锁的次数更新:1. 增加了ask_lock接口```#coding:utf-8#my blog: http://xiaorui.ccfrom __future__ import with_statementimport redisimport timefrom redis_netlock import dist_lockclient = redis.Redis(connection_pool=redis.BlockingConnectionPool(max_connections=15, host='localhost', port=6379))with dist_lock('test', client):time.sleep(10)print 'welcome to my blog, http://xiaorui.cc'```#####同时运行test.py and test2.pypython test.py```root@li568-252 redis_netlock]# python test.pywelcome to my blog, http://xiaorui.cc```python test2.py```[root@li568-252 redis_netlock]# python test2.pySleeipng for 0.404031367603Sleeipng for 1.19347232007Sleeipng for 2.47668271021Sleeipng for 4.55280708824hello```
Package: redisobjects
RedisobjectsSimple wrapper foraioredisto provide asynchronous functionality with a clean object-oriented interface for Redis in Python 3.6+.InstallationpipinstallredisobjectsExamplesExample showing how to use atoms (defined as single key-value pairs):importredisobjectsimportasyncioasyncdefmain(loop):redis=awaitredisobjects.connect('redis://localhost',loop=loop)atom=redis.atom('example.atom')print(awaitatom.get())awaitatom.set('bla')print(awaitatom.get())awaitatom.remove()print(awaitatom.get())redis.close()loop=asyncio.get_event_loop()loop.run_until_complete(main(loop))loop.close()Example that shows how to use a list:importredisobjectsimportasyncioasyncdefmain(loop):redis=awaitredisobjects.connect('redis://localhost',loop=loop)example_list=redis.list('example.list')print(awaitexample_list.list())awaitexample_list.push_right('b')awaitexample_list.push_right('c')print(awaitexample_list.list())awaitexample_list.push_left('a')print(awaitexample_list.list())awaitexample_list.pop_left()awaitexample_list.pop_left()print(awaitexample_list.list())awaitexample_list.pop_left()print(awaitexample_list.list())redis.close()loop=asyncio.get_event_loop()loop.run_until_complete(main(loop))loop.close()Example that shows how to use a dict/map:importredisobjectsimportasyncioasyncdefmain(loop):redis=awaitredisobjects.connect('redis://localhost',loop=loop)d=redis.dict('example.dict')print(dict(awaitd.items()))awaitd.set('a','1')print(dict(awaitd.items()))awaitd.set('b','2')print(dict(awaitd.items()))awaitd.set('c','3')print(dict(awaitd.items()))awaitd.remove('a','b')print(dict(awaitd.items()))awaitd.remove('c')print(dict(awaitd.items()))redis.close()loop=asyncio.get_event_loop()loop.run_until_complete(main(loop))loop.close()Example that shows how to use transactions:importredisobjectsimportasyncioasyncdefmain(loop):redis=awaitredisobjects.connect('redis://localhost',loop=loop)list=redis.list('example.list')atom=redis.atom('example.atom')tx=redis.create_transaction()awaitlist.push_right('a','b',tx=tx)awaitatom.set('a',tx=tx)print(awaitlist.list())print(awaitatom.get())awaittx.commit()print(awaitlist.list())print(awaitatom.get())# Clean upawaitlist.remove('a')awaitlist.remove('b')awaitatom.remove()redis.close()loop=asyncio.get_event_loop()loop.run_until_complete(main(loop))loop.close()
Package: redis-observer
Track your python file usage!Python package to track the usage of any python script / generate events and send them to a redis stream.Sample usage in your scriptfromredis_observer.logstreamimportlogstreamimportoslogstream(redis_host='redis-15205.c266.us-east-1-3.ec2.cloud.redislabs.com',redis_port=15205,redis_username='default',redis_password='omkarkonnur',appname='mycoolscript',maxlength=100,# Custom parametersfilename=os.path.basename(__file__),email='omkar.konnur@redis.com')
Package: redisolar-sample-data-generator
Redisolar Sample Data GeneratorThis is a fast sample data generator for the Education team's
"redisolar" applications.Python VersionThis package requires Python 3.7.InstallationAfter checking out the repository, make sure you are using a virtualenv.
Create one in the checkout directory like this:python3 -m venv envThen activate it:source env/bin/activateNext you can install the Python dependencies with pip:pip install .If you're going to work on the code, install it in "editable" mode
and include the dev dependencies:pip install -e ".[dev]"RunningThis package installs theload_redisolarcommand. Running it generates
sample data and uploads it to a target Redis instance.By default,redisolaruploads to a Redis instance running on localhost at
port 6379, with no password. It uses an included JSON fixture file containing
Site data.You can override the hostname, port, and fixture file with the--hostname,--port, and--filenameoptions:$ load_redisolar --hostname 192.168.1.2 --port 16379 --filename path/to/sites.jsonSpecifying a passwordFor password-protected Redis instances, you can specify a password
interactively with the--request-passwordoption.$ load_redisolar --request-password
Redis password: xyzSpecify a password non-interactively by setting the environment variableREDISOLAR_REDIS_PASSWORD.$ export REDISOLAR_REDIS_PASSWORD=xyz
$ load_redisolar
Package: redison
Redison : Redis + Json : Shared objects in memory using redis and json filesGetting StartednumpyfromredisonimportRedisObject
importnumpyasnparray=np.random.rand(10)# Set the object in python stackprint(array)# Retrieve the object from the stackarray=RedisObject(array)# Set the object in redisprint(array.get())# Retrieve the object from the redis databasemultiprocProcessus 1fromredisonimportRedisObject
importnumpyasnpwhileTrue:# Push array1RedisObject(id="array1",data=np.random.rand(10))# Pull array2array2=RedisObject(id="array2")# Wait for array1 to be set in redis by proc2print(array2.get(blocking=True))Processus 2fromredisonimportRedisObject
importnumpyasnpwhileTrue:# Push array2RedisObject(id="array2",data=np.random.rand(10))# Pull array1array1=RedisObject(id="array1")# Wait for array1 to be set in redis by proc1print(array1.get(blocking=True))multiproc remoteProcessus 1fromredisonimportRedisObject
importnumpyasnpwhileTrue:# Create array2array1=np.random.rand(10)# Push array2RedisObject(id="array1",data=array1,host="10.1.0.2")# Pull array1array2=RedisObject(id="array2",host="10.2.0.2")# Wait for array1 to be set on the remote machine 2print(array2.get(blocking=True))Processus 2fromredisonimportRedisObject
importnumpyasnpwhileTrue:# Create array2array2=np.random.rand(10)# Push array2RedisObject(id="array2",data=array2,host="10.2.0.2")# Pull array1array1=RedisObject(id="array1",host="10.1.0.2")# Wait for array1 to be set on the remote machine 1print(array1.get(blocking=True))ContributionsEmail me atj.cadic@9dw-lab.comfor any questions.
Package: redis-opentracing
Redis OpentracingThis package enables distributed tracing for the Python redis library.Note: If you need to use the old OpenTracing 1.0 API, use the 0.x releases.InstallationRun the following command:$ pip install redis_opentracingGetting startedTracing a Redis client requires setting up an OpenTracing-compatible tracer, and callinginit_tracing()to set up the tracing wrappers. See the examples directory for several different approaches.importredisimportredis_opentracingredis_opentracing.init_tracing(tracer)client=redis.StrictRedis()client.set('last_access',datetime.datetime.now())It’s possible to trace only specific Redis clients:redis_opentracing.init_tracing(tracer,trace_all_classes=False)redis_opentracing.trace_client(client)# Only commands and pipelines executed through this client will# be traced.res=client.get('last_access')It’s also possible to trace only specific pipelines:redis_opentracing.init_tracing(tracer,trace_all_classes=False)pipe=client.pipeline()redis_opentracing.trace_pipeline(pipe)# This pipeline will be executed as a single MULTI command.pipe.lpush('fruits','lemon','watermelon')pipe.rpush('fruits','pineapple','apple')pipe.execute()When pipeline commands are executed as a transaction, these commands will be grouped under a singleMULTIoperation. They’ll also appear as a single operation in the trace. Outside of a transaction, each command will generate a span.And it’s also possible to trace only specific pubsub objects:redis_opentracing.init_tracing(tracer,trace_all_classes=False)pubsub=client.pubsub()redis_opentracing.trace_pubsub(pubsub)pubsub.subscribe('incoming-fruits')msg=pubsub.get_message()# This message will appear as a 'SUB' operation.Incoming messages throughget_message(),listen()andrun_in_thread()will be traced, and any command executed through the pubsub’sexecute_command()method will be traced too.Further informationIf you’re interested in learning more about the OpenTracing standard, please visitopentracing.ioorjoin the mailing list. If you would like to implement OpenTracing in your project and need help, feel free to send us a note atcommunity@opentracing.io.LicenseApache 2.0 License
Package: redisopy
DocumentHistory2022-12-01: v0.0.2Add DatetimeFieldadd FieldValidator2022-12-05: v0.0.3Add redis set and list2022-12-05: v0.0.4Add is_init param to only update, when not read2022-12-05: v0.0.5Add hash actions2022-12-05: v0.0.6use utc in datetime2022-12-05: v0.0.7Add JSONField